Return void from UpdateFWLData() and PerformLayout().
The return value is unused, nor are these near cases where an
observed widget hints at a return code that should have been
processed.
Change-Id: I4d533286d1f12211475ed25711fba01bde0815d6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129574
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index 9ed2cf8..f662a79 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -97,7 +97,7 @@
dwStyleEx, FWL_STYLEEXT_CKB_SignShapeMask | FWL_STYLEEXT_CKB_3State);
}
-bool CXFA_FFCheckButton::PerformLayout() {
+void CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
float fCheckSize = m_pNode->GetCheckButtonSize();
@@ -193,8 +193,6 @@
SetFWLRect();
if (GetNormalWidget())
GetNormalWidget()->Update();
-
- return true;
}
void CXFA_FFCheckButton::CapLeftRightPlacement(
@@ -293,13 +291,12 @@
GetNormalWidget()->RemoveStates(FWL_STATE_CKB_Checked);
}
-bool CXFA_FFCheckButton::UpdateFWLData() {
- if (!GetNormalWidget())
- return false;
-
+void CXFA_FFCheckButton::UpdateFWLData() {
+ if (!GetNormalWidget()) {
+ return;
+ }
SetFWLCheckState(m_pNode->GetCheckState());
GetNormalWidget()->Update();
- return true;
}
void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) {
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h
index b394225..2bc14d8 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.h
+++ b/xfa/fxfa/cxfa_ffcheckbutton.h
@@ -27,8 +27,8 @@
HighlightOption highlight) override;
bool LoadWidget() override;
- bool PerformLayout() override;
- bool UpdateFWLData() override;
+ void PerformLayout() override;
+ void UpdateFWLData() override;
void UpdateWidgetProperty() override;
bool OnLButtonUp(Mask<XFA_FWL_KeyFlag> dwFlags,
const CFX_PointF& point) override;
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index 4bc15ad..ea236eb 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -200,10 +200,10 @@
return dwExtendedStyle;
}
-bool CXFA_FFComboBox::UpdateFWLData() {
+void CXFA_FFComboBox::UpdateFWLData() {
auto* pComboBox = ToComboBox(GetNormalWidget());
if (!pComboBox)
- return false;
+ return;
std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
if (!iSelArray.empty()) {
@@ -213,7 +213,6 @@
pComboBox->SetEditText(m_pNode->GetValue(XFA_ValuePicture::kRaw));
}
pComboBox->Update();
- return true;
}
bool CXFA_FFComboBox::CanUndo() {
diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h
index 58529de..8cfb954 100644
--- a/xfa/fxfa/cxfa_ffcombobox.h
+++ b/xfa/fxfa/cxfa_ffcombobox.h
@@ -70,7 +70,7 @@
// CXFA_FFField:
bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
- bool UpdateFWLData() override;
+ void UpdateFWLData() override;
bool IsDataChanged() override;
uint32_t GetAlignment();
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index 44a32d5..ca5dac6 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -152,9 +152,9 @@
return true;
}
-bool CXFA_FFDateTimeEdit::UpdateFWLData() {
+void CXFA_FFDateTimeEdit::UpdateFWLData() {
if (!GetNormalWidget())
- return false;
+ return;
XFA_ValuePicture eType = XFA_ValuePicture::kDisplay;
if (IsFocused())
@@ -172,7 +172,6 @@
}
}
GetNormalWidget()->Update();
- return true;
}
bool CXFA_FFDateTimeEdit::IsDataChanged() {
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.h b/xfa/fxfa/cxfa_ffdatetimeedit.h
index c2786b8..f8e182b 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.h
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.h
@@ -51,7 +51,7 @@
private:
bool PtInActiveRect(const CFX_PointF& point) override;
bool CommitData() override;
- bool UpdateFWLData() override;
+ void UpdateFWLData() override;
bool IsDataChanged() override;
pdfium::CFWL_DateTimePicker* GetPickerWidget();
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 8c0a106..e23ca50 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -164,15 +164,15 @@
static_cast<CFWL_Edit*>(GetNormalWidget())->SetScrollOffset(fScrollOffset);
}
-bool CXFA_FFField::PerformLayout() {
+void CXFA_FFField::PerformLayout() {
CXFA_FFWidget::PerformLayout();
CapPlacement();
LayoutCaption();
SetFWLRect();
SetEditScrollOffset();
- if (GetNormalWidget())
+ if (GetNormalWidget()) {
GetNormalWidget()->Update();
- return true;
+ }
}
void CXFA_FFField::CapPlacement() {
diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h
index ab2267c..f252017 100644
--- a/xfa/fxfa/cxfa_fffield.h
+++ b/xfa/fxfa/cxfa_fffield.h
@@ -33,7 +33,7 @@
HighlightOption highlight) override;
bool IsLoaded() override;
bool LoadWidget() override;
- bool PerformLayout() override;
+ void PerformLayout() override;
bool AcceptsFocusOnButtonDown(
Mask<XFA_FWL_KeyFlag> dwFlags,
const CFX_PointF& point,
diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp
index 0e84c76..ba97f79 100644
--- a/xfa/fxfa/cxfa_ffimageedit.cpp
+++ b/xfa/fxfa/cxfa_ffimageedit.cpp
@@ -135,10 +135,9 @@
return true;
}
-bool CXFA_FFImageEdit::UpdateFWLData() {
+void CXFA_FFImageEdit::UpdateFWLData() {
m_pNode->SetEditImage(nullptr);
m_pNode->LoadEditImage(GetDoc());
- return true;
}
void CXFA_FFImageEdit::OnProcessMessage(CFWL_Message* pMessage) {
diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h
index bee08b6..ae9affa 100644
--- a/xfa/fxfa/cxfa_ffimageedit.h
+++ b/xfa/fxfa/cxfa_ffimageedit.h
@@ -42,7 +42,7 @@
explicit CXFA_FFImageEdit(CXFA_Node* pNode);
void SetFWLRect() override;
- bool UpdateFWLData() override;
+ void UpdateFWLData() override;
bool CommitData() override;
cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index 9397347..76ab86b 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -143,10 +143,10 @@
return dwExtendedStyle;
}
-bool CXFA_FFListBox::UpdateFWLData() {
+void CXFA_FFListBox::UpdateFWLData() {
auto* pListBox = ToListBox(GetNormalWidget());
if (!pListBox)
- return false;
+ return;
std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
std::vector<CFWL_ListBox::Item*> selItemArray(iSelArray.size());
@@ -158,7 +158,6 @@
pListBox->SetSelItem(pItem, true);
GetNormalWidget()->Update();
- return true;
}
void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) {
diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h
index ae2423f..6431e5d 100644
--- a/xfa/fxfa/cxfa_fflistbox.h
+++ b/xfa/fxfa/cxfa_fflistbox.h
@@ -41,7 +41,7 @@
explicit CXFA_FFListBox(CXFA_Node* pNode);
bool CommitData() override;
- bool UpdateFWLData() override;
+ void UpdateFWLData() override;
bool IsDataChanged() override;
uint32_t GetAlignment();
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 8828b37..9f29b25 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -98,7 +98,7 @@
GetNormalWidget()->ModifyStyleExts(dwStyleEx, 0xFFFFFFFF);
}
-bool CXFA_FFPushButton::PerformLayout() {
+void CXFA_FFPushButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
CFX_RectF rtWidget = GetRectWithoutRotate();
@@ -114,10 +114,9 @@
LayoutHighlightCaption();
SetFWLRect();
- if (GetNormalWidget())
+ if (GetNormalWidget()) {
GetNormalWidget()->Update();
-
- return true;
+ }
}
float CXFA_FFPushButton::GetLineWidth() {
diff --git a/xfa/fxfa/cxfa_ffpushbutton.h b/xfa/fxfa/cxfa_ffpushbutton.h
index fcec556..6ad8a98 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.h
+++ b/xfa/fxfa/cxfa_ffpushbutton.h
@@ -30,7 +30,7 @@
const CFX_Matrix& matrix,
HighlightOption highlight) override;
bool LoadWidget() override;
- bool PerformLayout() override;
+ void PerformLayout() override;
void UpdateWidgetProperty() override;
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(pdfium::CFWL_Event* pEvent) override;
diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp
index a9604c8..fd8f861 100644
--- a/xfa/fxfa/cxfa_fftext.cpp
+++ b/xfa/fxfa/cxfa_fftext.cpp
@@ -67,19 +67,17 @@
return pTextLayout && !pTextLayout->HasBlock();
}
-bool CXFA_FFText::PerformLayout() {
+void CXFA_FFText::PerformLayout() {
CXFA_FFWidget::PerformLayout();
CXFA_TextLayout* pTextLayout = m_pNode->GetTextLayout();
- if (!pTextLayout)
- return false;
- if (!pTextLayout->HasBlock())
- return true;
-
+ if (!pTextLayout || !pTextLayout->HasBlock()) {
+ return;
+ }
pTextLayout->ClearBlocks();
CXFA_ContentLayoutItem* pItem = GetLayoutItem();
- if (!pItem->GetPrev() && !pItem->GetNext())
- return true;
-
+ if (!pItem->GetPrev() && !pItem->GetNext()) {
+ return;
+ }
pItem = pItem->GetFirst();
while (pItem) {
CFX_RectF rtText = pItem->GetAbsoluteRect();
@@ -94,7 +92,6 @@
pItem = pItem->GetNext();
}
pTextLayout->ResetHasBlock();
- return true;
}
bool CXFA_FFText::AcceptsFocusOnButtonDown(
diff --git a/xfa/fxfa/cxfa_fftext.h b/xfa/fxfa/cxfa_fftext.h
index c4bc471..2c8b357 100644
--- a/xfa/fxfa/cxfa_fftext.h
+++ b/xfa/fxfa/cxfa_fftext.h
@@ -30,7 +30,7 @@
const CFX_Matrix& matrix,
HighlightOption highlight) override;
bool IsLoaded() override;
- bool PerformLayout() override;
+ void PerformLayout() override;
private:
explicit CXFA_FFText(CXFA_Node* pNode);
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index cbf5d4c..ba39219 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -267,10 +267,10 @@
return dwExtendedStyle;
}
-bool CXFA_FFTextEdit::UpdateFWLData() {
+void CXFA_FFTextEdit::UpdateFWLData() {
CFWL_Edit* pEdit = ToEdit(GetNormalWidget());
if (!pEdit)
- return false;
+ return;
XFA_ValuePicture eType = XFA_ValuePicture::kDisplay;
if (IsFocused())
@@ -303,10 +303,9 @@
pEdit->SetTextSkipNotify(wsText);
bUpdate = true;
}
- if (bUpdate)
+ if (bUpdate) {
GetNormalWidget()->Update();
-
- return true;
+ }
}
void CXFA_FFTextEdit::OnTextWillChange(CFWL_Widget* pWidget,
diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h
index d03ba6d..bdbfe5c 100644
--- a/xfa/fxfa/cxfa_fftextedit.h
+++ b/xfa/fxfa/cxfa_fftextedit.h
@@ -82,7 +82,7 @@
private:
bool CommitData() override;
- bool UpdateFWLData() override;
+ void UpdateFWLData() override;
bool IsDataChanged() override;
void ValidateNumberField(const WideString& wsText);
};
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index bd42bf4..057d280 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -289,14 +289,11 @@
return true;
}
-bool CXFA_FFWidget::PerformLayout() {
+void CXFA_FFWidget::PerformLayout() {
RecacheWidgetRect();
- return true;
}
-bool CXFA_FFWidget::UpdateFWLData() {
- return false;
-}
+void CXFA_FFWidget::UpdateFWLData() {}
void CXFA_FFWidget::UpdateWidgetProperty() {}
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 5c3eb4e..de416b3 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -102,8 +102,8 @@
HighlightOption highlight);
virtual bool IsLoaded();
virtual bool LoadWidget();
- virtual bool PerformLayout();
- virtual bool UpdateFWLData();
+ virtual void PerformLayout();
+ virtual void UpdateFWLData();
virtual void UpdateWidgetProperty();
// |command| must be LeftButtonDown or RightButtonDown.
virtual bool AcceptsFocusOnButtonDown(