Improve a few member variables names in fpdfsdk
Give some variables simpler / clearer names.
Also simplify a few CPDFSDK_Widget getters/setters, since this CL is
already renaming the variable being accessed.
Change-Id: Iebbf379af9401d0f241c384aaf362af72b37bdd0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130690
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 331cada..8ba4b75 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -75,7 +75,7 @@
const CFX_Matrix& mtUser2Device,
CPDF_RenderOptions* pOptions,
const FX_RECT& pClip) {
- cur_matrix_ = mtUser2Device;
+ matrix_ = mtUser2Device;
#ifdef PDF_ENABLE_XFA
IPDF_Page* pPage = GetXFAPage();
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index a9af41b..306048c 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -91,7 +91,7 @@
bool SetIndexSelected(int index, bool selected);
bool IsIndexSelected(int index);
- const CFX_Matrix& GetCurrentMatrix() const { return cur_matrix_; }
+ const CFX_Matrix& GetCurrentMatrix() const { return matrix_; }
void UpdateRects(const std::vector<CFX_FloatRect>& rects);
void UpdateView(CPDFSDK_Annot* pAnnot);
@@ -120,7 +120,7 @@
Mask<FWL_EVENTFLAG> nFlags);
void ExitWidget(bool callExitCallback, Mask<FWL_EVENTFLAG> nFlags);
- CFX_Matrix cur_matrix_;
+ CFX_Matrix matrix_;
UnownedPtr<IPDF_Page> const page_;
std::unique_ptr<CPDF_AnnotList> annot_list_;
std::vector<std::unique_ptr<CPDFSDK_Annot>> sdkannot_array_;
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 99a4844..9c6c823 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -655,18 +655,6 @@
void CPDFSDK_Widget::SetTopVisibleIndex(int index) {}
-void CPDFSDK_Widget::SetAppModified() {
- app_modified_ = true;
-}
-
-void CPDFSDK_Widget::ClearAppModified() {
- app_modified_ = false;
-}
-
-bool CPDFSDK_Widget::IsAppModified() const {
- return app_modified_;
-}
-
#ifdef PDF_ENABLE_XFA
void CPDFSDK_Widget::ResetXFAAppearance(ValueChanged bValueChanged) {
switch (GetFieldType()) {
@@ -684,7 +672,7 @@
void CPDFSDK_Widget::ResetAppearance(std::optional<WideString> sValue,
ValueChanged bValueChanged) {
- SetAppModified();
+ set_appearance_modified(true);
appearance_age_++;
if (bValueChanged == kValueChanged) {
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index 739b65d..31b6164 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -131,9 +131,10 @@
void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView);
- void SetAppModified();
- void ClearAppModified();
- bool IsAppModified() const;
+ void set_appearance_modified(bool appearance_modified) {
+ appearance_modified_ = appearance_modified;
+ }
+ bool appearance_modified() const { return appearance_modified_; }
uint32_t GetAppearanceAge() const { return appearance_age_; }
uint32_t GetValueAge() const { return value_age_; }
@@ -183,7 +184,7 @@
#endif // PDF_ENABLE_XFA
UnownedPtr<CPDFSDK_InteractiveForm> const interactive_form_;
- bool app_modified_ = false;
+ bool appearance_modified_ = false;
uint32_t appearance_age_ = 0;
uint32_t value_age_ = 0;
};
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 1c6bea9..bdaa0c2 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -105,7 +105,7 @@
if (!notifying_) {
if (pWidget->GetAAction(CPDF_AAction::kCursorEnter).HasDict()) {
uint32_t nValueAge = pWidget->GetValueAge();
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
DCHECK(pPageView);
{
AutoRestorer<bool> restorer(¬ifying_);
@@ -120,7 +120,7 @@
return;
}
- if (pWidget->IsAppModified()) {
+ if (pWidget->appearance_modified()) {
CFFL_FormField* pFormField = GetFormField(pWidget.Get());
if (pFormField) {
pFormField->ResetPWLWindowForValueAge(pPageView, pWidget.Get(),
@@ -141,7 +141,7 @@
if (!notifying_) {
if (pWidget->GetAAction(CPDF_AAction::kCursorExit).HasDict()) {
uint32_t nValueAge = pWidget->GetValueAge();
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
DCHECK(pPageView);
{
AutoRestorer<bool> restorer(¬ifying_);
@@ -156,7 +156,7 @@
return;
}
- if (pWidget->IsAppModified()) {
+ if (pWidget->appearance_modified()) {
CFFL_FormField* pFormField = GetFormField(pWidget.Get());
if (pFormField) {
pFormField->ResetPWLWindowForValueAge(pPageView, pWidget.Get(),
@@ -179,7 +179,7 @@
if (Annot_HitTest(pWidget.Get(), point) &&
pWidget->GetAAction(CPDF_AAction::kButtonDown).HasDict()) {
uint32_t nValueAge = pWidget->GetValueAge();
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
DCHECK(pPageView);
{
AutoRestorer<bool> restorer(¬ifying_);
@@ -198,7 +198,7 @@
return true;
}
- if (pWidget->IsAppModified()) {
+ if (pWidget->appearance_modified()) {
CFFL_FormField* pFormField = GetFormField(pWidget.Get());
if (pFormField) {
pFormField->ResetPWLWindowForValueAge(pPageView, pWidget.Get(),
@@ -381,7 +381,7 @@
if (!notifying_) {
if (pWidget->GetAAction(CPDF_AAction::kGetFocus).HasDict()) {
uint32_t nValueAge = pWidget->GetValueAge();
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
CFFL_FormField* pFormField = GetOrCreateFormField(pWidget.Get());
if (!pFormField) {
@@ -404,7 +404,7 @@
return false;
}
- if (pWidget->IsAppModified()) {
+ if (pWidget->appearance_modified()) {
CFFL_FormField* pFiller = GetFormField(pWidget.Get());
if (pFiller) {
pFiller->ResetPWLWindowForValueAge(pPageView, pWidget.Get(),
@@ -446,7 +446,7 @@
return true;
}
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
CPDFSDK_PageView* pPageView = pWidget->GetPageView();
DCHECK(pPageView);
@@ -727,7 +727,7 @@
}
DCHECK(pPageView);
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
AutoRestorer<bool> restorer(¬ifying_);
notifying_ = true;
@@ -764,7 +764,7 @@
}
DCHECK(pPageView);
- pWidget->ClearAppModified();
+ pWidget->set_appearance_modified(false);
AutoRestorer<bool> restorer(¬ifying_);
notifying_ = true;
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index d3bb0e8..b76b0f2 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -52,7 +52,7 @@
}
if (pWnd->HasFlag(PLBS_MULTIPLESEL)) {
- origin_selections_.clear();
+ original_selections_.clear();
bool bSetCaret = false;
for (int32_t i = 0, sz = widget_->CountOptions(); i < sz; i++) {
@@ -62,7 +62,7 @@
bSetCaret = true;
}
pWnd->Select(i);
- origin_selections_.insert(i);
+ original_selections_.insert(i);
}
}
} else {
@@ -94,7 +94,7 @@
size_t nSelCount = 0;
for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; ++i) {
if (pListBox->IsItemSelected(i)) {
- if (!pdfium::Contains(origin_selections_, i)) {
+ if (!pdfium::Contains(original_selections_, i)) {
return true;
}
@@ -102,7 +102,7 @@
}
}
- return nSelCount != origin_selections_.size();
+ return nSelCount != original_selections_.size();
}
return pListBox->GetCurSel() != widget_->GetSelectedIndex(0);
}
diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h
index 99e03a0..d919f7e 100644
--- a/fpdfsdk/formfiller/cffl_listbox.h
+++ b/fpdfsdk/formfiller/cffl_listbox.h
@@ -44,7 +44,7 @@
CPWL_ListBox* GetPWLListBox(const CPDFSDK_PageView* pPageView) const;
CPWL_ListBox* CreateOrUpdatePWLListBox(const CPDFSDK_PageView* pPageView);
- std::set<int> origin_selections_;
+ std::set<int> original_selections_;
std::vector<int> state_;
};