diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-30 21:38:40 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-30 21:38:40 +0000 |
commit | 90d9386825b872a0b668eac5dff3e268fa7ad16c (patch) | |
tree | b615bf156a49b6d4b4dc9d4dd1b628967044f0b2 /xfa/fxfa/parser | |
parent | 7311006b16f30da32fed5145e2e1c2c04a5cea41 (diff) | |
download | pdfium-90d9386825b872a0b668eac5dff3e268fa7ad16c.tar.xz |
Shuffle more code out of CXFA_Node
This CL moves more code out of the CXFA_Node class and into specific
subclasses.
Change-Id: Idca36f251431bf7efd4da045aeabf097ab23f0ce
Reviewed-on: https://pdfium-review.googlesource.com/24714
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_button.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_button.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_checkbutton.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_checkbutton.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 34 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_passwordedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_passwordedit.h | 1 |
8 files changed, 23 insertions, 30 deletions
diff --git a/xfa/fxfa/parser/cxfa_button.cpp b/xfa/fxfa/parser/cxfa_button.cpp index 7b56d2b712..4a951b3ee9 100644 --- a/xfa/fxfa/parser/cxfa_button.cpp +++ b/xfa/fxfa/parser/cxfa_button.cpp @@ -41,3 +41,7 @@ CXFA_Button::~CXFA_Button() {} XFA_FFWidgetType CXFA_Button::GetDefaultFFWidgetType() const { return XFA_FFWidgetType::kButton; } + +XFA_AttributeEnum CXFA_Button::GetHighlight() { + return JSObject()->GetEnum(XFA_Attribute::Highlight); +} diff --git a/xfa/fxfa/parser/cxfa_button.h b/xfa/fxfa/parser/cxfa_button.h index 75d62a6159..cea685fa4e 100644 --- a/xfa/fxfa/parser/cxfa_button.h +++ b/xfa/fxfa/parser/cxfa_button.h @@ -15,6 +15,8 @@ class CXFA_Button : public CXFA_Node { ~CXFA_Button() override; XFA_FFWidgetType GetDefaultFFWidgetType() const override; + + XFA_AttributeEnum GetHighlight(); }; #endif // XFA_FXFA_PARSER_CXFA_BUTTON_H_ diff --git a/xfa/fxfa/parser/cxfa_checkbutton.cpp b/xfa/fxfa/parser/cxfa_checkbutton.cpp index 59afe5ac98..6b5fa8fada 100644 --- a/xfa/fxfa/parser/cxfa_checkbutton.cpp +++ b/xfa/fxfa/parser/cxfa_checkbutton.cpp @@ -55,3 +55,7 @@ bool CXFA_CheckButton::IsRound() { XFA_AttributeEnum CXFA_CheckButton::GetMark() { return JSObject()->GetEnum(XFA_Attribute::Mark); } + +bool CXFA_CheckButton::IsAllowNeutral() { + return JSObject()->GetBoolean(XFA_Attribute::AllowNeutral); +} diff --git a/xfa/fxfa/parser/cxfa_checkbutton.h b/xfa/fxfa/parser/cxfa_checkbutton.h index b603dd0ca1..e239a46ecb 100644 --- a/xfa/fxfa/parser/cxfa_checkbutton.h +++ b/xfa/fxfa/parser/cxfa_checkbutton.h @@ -17,6 +17,7 @@ class CXFA_CheckButton : public CXFA_Node { XFA_FFWidgetType GetDefaultFFWidgetType() const override; bool IsRound(); + bool IsAllowNeutral(); XFA_AttributeEnum GetMark(); }; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 0c28f4b5c6..451c98f8f0 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -3523,13 +3523,6 @@ RetainPtr<CFGAS_GEFont> CXFA_Node::GetFDEFont(CXFA_FFDoc* doc) { dwFontStyle); } -XFA_AttributeEnum CXFA_Node::GetButtonHighlight() { - CXFA_Node* pUIChild = GetUIChildNode(); - if (pUIChild) - return pUIChild->JSObject()->GetEnum(XFA_Attribute::Highlight); - return XFA_AttributeEnum::Inverted; -} - bool CXFA_Node::HasButtonRollover() { CXFA_Items* pItems = GetChild<CXFA_Items>(0, XFA_Element::Items, false); if (!pItems) @@ -3571,12 +3564,6 @@ float CXFA_Node::GetCheckButtonSize() { return CXFA_Measurement(10, XFA_Unit::Pt).ToUnit(XFA_Unit::Pt); } -bool CXFA_Node::IsAllowNeutral() { - CXFA_Node* pUIChild = GetUIChildNode(); - return pUIChild && - pUIChild->JSObject()->GetBoolean(XFA_Attribute::AllowNeutral); -} - XFA_CHECKSTATE CXFA_Node::GetCheckState() { WideString wsValue = GetRawValue(); if (wsValue.IsEmpty()) @@ -4232,12 +4219,6 @@ Optional<int32_t> CXFA_Node::GetNumberOfCells() { return {}; } -WideString CXFA_Node::GetPasswordChar() { - CXFA_Node* pUIChild = GetUIChildNode(); - return pUIChild ? pUIChild->JSObject()->GetCData(XFA_Attribute::PasswordChar) - : L"*"; -} - bool CXFA_Node::IsMultiLine() { CXFA_Node* pUIChild = GetUIChildNode(); return pUIChild && pUIChild->JSObject()->GetBoolean(XFA_Attribute::MultiLine); @@ -4327,13 +4308,11 @@ bool CXFA_Node::SetValue(XFA_VALUEPICTURE eValueType, bSyncData = true; } - } else { - if (eType == XFA_Element::NumericEdit) { - if (wsNewText != L"0") - wsNewText = NumericLimit(wsNewText, GetLeadDigits(), GetFracDigits()); + } else if (eType == XFA_Element::NumericEdit) { + if (wsNewText != L"0") + wsNewText = NumericLimit(wsNewText, GetLeadDigits(), GetFracDigits()); - bSyncData = true; - } + bSyncData = true; } if (eType != XFA_Element::NumericEdit || bSyncData) SyncValue(wsNewText, true); @@ -4432,7 +4411,7 @@ WideString CXFA_Node::GetValue(XFA_VALUEPICTURE eValueType) { if (!pNode) return wsValue; - switch (GetUIChildNode()->GetElementType()) { + switch (pNode->GetElementType()) { case XFA_Element::ChoiceList: { if (eValueType == XFA_VALUEPICTURE_Display) { int32_t iSelItemIndex = GetSelectedItem(0); @@ -4441,7 +4420,8 @@ WideString CXFA_Node::GetValue(XFA_VALUEPICTURE eValueType) { wsPicture.clear(); } } - } break; + break; + } case XFA_Element::NumericEdit: if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) { IFX_Locale* pLocale = GetLocale(); diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 819b2f9a40..dfe5ab0127 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -310,11 +310,9 @@ class CXFA_Node : public CXFA_Object { RetainPtr<CFGAS_GEFont> GetFDEFont(CXFA_FFDoc* doc); bool IsListBox(); - bool IsAllowNeutral(); bool IsRadioButton(); bool IsMultiLine(); - XFA_AttributeEnum GetButtonHighlight(); bool HasButtonRollover(); bool HasButtonDown(); @@ -375,7 +373,6 @@ class CXFA_Node : public CXFA_Object { WideString GetFormatDataValue(const WideString& wsValue); WideString NormalizeNumStr(const WideString& wsValue); - WideString GetPasswordChar(); std::pair<XFA_Element, int32_t> GetMaxChars(); int32_t GetFracDigits(); int32_t GetLeadDigits(); diff --git a/xfa/fxfa/parser/cxfa_passwordedit.cpp b/xfa/fxfa/parser/cxfa_passwordedit.cpp index 68267af183..6d38c344fe 100644 --- a/xfa/fxfa/parser/cxfa_passwordedit.cpp +++ b/xfa/fxfa/parser/cxfa_passwordedit.cpp @@ -43,3 +43,7 @@ CXFA_PasswordEdit::~CXFA_PasswordEdit() {} XFA_FFWidgetType CXFA_PasswordEdit::GetDefaultFFWidgetType() const { return XFA_FFWidgetType::kPasswordEdit; } + +WideString CXFA_PasswordEdit::GetPasswordChar() { + return JSObject()->GetCData(XFA_Attribute::PasswordChar); +} diff --git a/xfa/fxfa/parser/cxfa_passwordedit.h b/xfa/fxfa/parser/cxfa_passwordedit.h index e390aaa2b1..6c8e8e5856 100644 --- a/xfa/fxfa/parser/cxfa_passwordedit.h +++ b/xfa/fxfa/parser/cxfa_passwordedit.h @@ -15,6 +15,7 @@ class CXFA_PasswordEdit : public CXFA_Node { ~CXFA_PasswordEdit() override; XFA_FFWidgetType GetDefaultFFWidgetType() const override; + WideString GetPasswordChar(); }; #endif // XFA_FXFA_PARSER_CXFA_PASSWORDEDIT_H_ |