summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-16 21:22:42 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-16 21:22:42 +0000
commitaa5769a417251214d1a8b3ebb5153a9251f50448 (patch)
tree683409eb8a036de68e0934ef540ee7baf2e41620
parentdf4e68c5eb293c9929c7d66e59d08afc21b04c86 (diff)
downloadpdfium-aa5769a417251214d1a8b3ebb5153a9251f50448.tar.xz
Replace optional bool bDrawFocus with enum type.
Change-Id: Ide4a972337afaf346e46edc4ede48140cd4544c1 Reviewed-on: https://pdfium-review.googlesource.com/40390 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp14
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.h2
-rw-r--r--xfa/fxfa/cxfa_ffdatetimeedit.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffdatetimeedit.h2
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp6
-rw-r--r--xfa/fxfa/cxfa_fffield.h2
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h4
-rw-r--r--xfa/fxfa/cxfa_rendercontext.cpp3
10 files changed, 28 insertions, 23 deletions
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index a395eef038..82eda21469 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -79,17 +79,17 @@ void CPDFSDK_XFAWidgetHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot);
-
CXFA_Node* node = pAnnot->GetXFAWidget()->GetNode();
ASSERT(node->IsWidgetReady());
CFX_RectF rcBBox;
- if (node->GetFFWidgetType() == XFA_FFWidgetType::kSignature)
- rcBBox = pAnnot->GetXFAWidget()->GetBBox(XFA_WidgetStatus_Visible, true);
- else
- rcBBox = pAnnot->GetXFAWidget()->GetBBox(XFA_WidgetStatus_None);
-
+ if (node->GetFFWidgetType() == XFA_FFWidgetType::kSignature) {
+ rcBBox = pAnnot->GetXFAWidget()->GetBBox(XFA_WidgetStatus_Visible,
+ CXFA_FFWidget::kDrawFocus);
+ } else {
+ rcBBox = pAnnot->GetXFAWidget()->GetBBox(XFA_WidgetStatus_None,
+ CXFA_FFWidget::kDoNotDrawFocus);
+ }
CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top + rcBBox.height);
rcWidget.left -= 1.0f;
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index 893ee60aa1..af5d216790 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -29,8 +29,10 @@ CXFA_FFComboBox::CXFA_FFComboBox(CXFA_Node* pNode)
CXFA_FFComboBox::~CXFA_FFComboBox() {}
-CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- return bDrawFocus ? CFX_RectF() : CXFA_FFWidget::GetBBox(dwStatus);
+CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, FocusOption focus) {
+ if (focus == kDrawFocus)
+ return CFX_RectF();
+ return CXFA_FFWidget::GetBBox(dwStatus, kDoNotDrawFocus);
}
bool CXFA_FFComboBox::PtInActiveRect(const CFX_PointF& point) {
diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h
index d1c710bcc9..ed68df0358 100644
--- a/xfa/fxfa/cxfa_ffcombobox.h
+++ b/xfa/fxfa/cxfa_ffcombobox.h
@@ -18,7 +18,7 @@ class CXFA_FFComboBox : public CXFA_FFDropDown {
~CXFA_FFComboBox() override;
// CXFA_FFField
- CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, FocusOption focus) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index c1bea362b5..35ec007d30 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -28,10 +28,10 @@ CFWL_DateTimePicker* CXFA_FFDateTimeEdit::GetPickerWidget() {
return static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
}
-CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- if (bDrawFocus)
+CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, FocusOption focus) {
+ if (focus == kDrawFocus)
return CFX_RectF();
- return CXFA_FFWidget::GetBBox(dwStatus);
+ return CXFA_FFWidget::GetBBox(dwStatus, kDoNotDrawFocus);
}
bool CXFA_FFDateTimeEdit::PtInActiveRect(const CFX_PointF& point) {
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.h b/xfa/fxfa/cxfa_ffdatetimeedit.h
index 8041b313de..3a60adabf0 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.h
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.h
@@ -26,7 +26,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
~CXFA_FFDateTimeEdit() override;
// CXFA_FFTextEdit
- CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, FocusOption focus) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 8dd0a9ec4c..7fba69973c 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -43,9 +43,9 @@ CXFA_FFField::CXFA_FFField(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {}
CXFA_FFField::~CXFA_FFField() = default;
-CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- if (!bDrawFocus)
- return CXFA_FFWidget::GetBBox(dwStatus);
+CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, FocusOption focus) {
+ if (focus == kDoNotDrawFocus)
+ return CXFA_FFWidget::GetBBox(dwStatus, kDoNotDrawFocus);
switch (m_pNode->GetFFWidgetType()) {
case XFA_FFWidgetType::kButton:
diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h
index 5b3251145b..262231c797 100644
--- a/xfa/fxfa/cxfa_fffield.h
+++ b/xfa/fxfa/cxfa_fffield.h
@@ -25,7 +25,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate {
~CXFA_FFField() override;
// CXFA_FFWidget
- CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, FocusOption focus) override;
void RenderWidget(CXFA_Graphics* pGS,
const CFX_Matrix& matrix,
uint32_t dwStatus) override;
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 05330a9a51..f425ccf625 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -285,8 +285,8 @@ void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) {
m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded;
}
-CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
- if (bDrawFocus || !m_pPageView)
+CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, FocusOption focus) {
+ if (focus == kDrawFocus || !m_pPageView)
return CFX_RectF();
return m_pPageView->GetPageViewRect();
}
@@ -347,7 +347,7 @@ void CXFA_FFWidget::DrawBorderWithFlag(CXFA_Graphics* pGS,
}
void CXFA_FFWidget::InvalidateRect() {
- CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused);
+ CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused, kDoNotDrawFocus);
rtWidget.Inflate(2, 2);
m_pDocView->InvalidateRect(m_pPageView.Get(), rtWidget);
}
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 283c8cbbc7..0d951d4f1c 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -84,10 +84,12 @@ enum class XFA_FFWidgetType {
class CXFA_FFWidget : public CXFA_ContentLayoutItem {
public:
+ enum FocusOption { kDoNotDrawFocus = 0, kDrawFocus };
+
explicit CXFA_FFWidget(CXFA_Node* pNode);
~CXFA_FFWidget() override;
- virtual CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false);
+ virtual CFX_RectF GetBBox(uint32_t dwStatus, FocusOption focus);
virtual void RenderWidget(CXFA_Graphics* pGS,
const CFX_Matrix& matrix,
uint32_t dwStatus);
diff --git a/xfa/fxfa/cxfa_rendercontext.cpp b/xfa/fxfa/cxfa_rendercontext.cpp
index 6667d46068..f8c59c9b8d 100644
--- a/xfa/fxfa/cxfa_rendercontext.cpp
+++ b/xfa/fxfa/cxfa_rendercontext.cpp
@@ -26,7 +26,8 @@ CXFA_RenderContext::~CXFA_RenderContext() {}
void CXFA_RenderContext::DoRender(CXFA_Graphics* gs) {
while (m_pWidget) {
- CFX_RectF rtWidgetBox = m_pWidget->GetBBox(XFA_WidgetStatus_Visible);
+ CFX_RectF rtWidgetBox = m_pWidget->GetBBox(XFA_WidgetStatus_Visible,
+ CXFA_FFWidget::kDoNotDrawFocus);
rtWidgetBox.width += 1;
rtWidgetBox.height += 1;
if (rtWidgetBox.IntersectWith(m_rtClipRect))