diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-22 18:44:39 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-22 18:44:39 +0000 |
commit | 2157c4baba28123304affa48ec0a5973151faccf (patch) | |
tree | 2de8bae634ebb204a1f31683c79a8c70d7bbfacc /xfa/fxfa | |
parent | ed4038bc335385b7e341d8de5c2bec8db5dcdcb6 (diff) | |
download | pdfium-2157c4baba28123304affa48ec0a5973151faccf.tar.xz |
Move IsNull and PreNull to CXFA_Node
This CL moves the m_bIsNull and m_bPreNull flags from CXFA_WidgetAcc to
CXFA_Node.
Change-Id: Ibdcdb8611699d6d908ab3c6ed05cbce7bba872ae
Reviewed-on: https://pdfium-review.googlesource.com/23310
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.h | 7 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.h | 7 |
4 files changed, 12 insertions, 14 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 49ccade894..4fa744a098 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -348,10 +348,7 @@ bool SplitDateTime(const WideString& wsDateTime, } // namespace -CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_Node* pNode) - : m_bIsNull(true), - m_bPreNull(true), - m_pNode(pNode) {} +CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_Node* pNode) : m_pNode(pNode) {} CXFA_WidgetAcc::~CXFA_WidgetAcc() = default; @@ -2132,8 +2129,9 @@ bool CXFA_WidgetAcc::SetValue(XFA_VALUEPICTURE eValueType, return true; } - m_bPreNull = m_bIsNull; - m_bIsNull = false; + m_pNode->SetPreNull(m_pNode->IsNull()); + m_pNode->SetIsNull(false); + WideString wsNewText(wsValue); WideString wsPicture = GetPictureContent(eValueType); bool bValidate = true; diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index ac885cb2f2..8f0bf3948b 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -176,11 +176,6 @@ class CXFA_WidgetAcc { int32_t iLead, int32_t iTread) const; - bool IsPreNull() const { return m_bPreNull; } - void SetPreNull(bool val) { m_bPreNull = val; } - bool IsNull() const { return m_bIsNull; } - void SetIsNull(bool val) { m_bIsNull = val; } - private: void CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap); bool CalculateFieldAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size); @@ -213,8 +208,6 @@ class CXFA_WidgetAcc { void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData; - bool m_bIsNull; - bool m_bPreNull; CXFA_Node* m_pNode; }; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 935392373a..6a510cc0d4 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1992,7 +1992,7 @@ int32_t CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* docView, bool bVersionFlag) { if (!GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Raw).IsEmpty()) return XFA_EVENTERROR_Success; - if (GetWidgetAcc()->IsNull() && GetWidgetAcc()->IsPreNull()) + if (m_bIsNull && m_bPreNull) return XFA_EVENTERROR_Success; XFA_AttributeEnum eNullTest = validate->GetNullTest(); diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 4fae752ea0..e99180e0dd 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -299,6 +299,11 @@ class CXFA_Node : public CXFA_Object { CFX_RectF GetUIMargin(); CXFA_Border* GetUIBorder(); + bool IsPreNull() const { return m_bPreNull; } + void SetPreNull(bool val) { m_bPreNull = val; } + bool IsNull() const { return m_bIsNull; } + void SetIsNull(bool val) { m_bIsNull = val; } + protected: CXFA_Node(CXFA_Document* pDoc, XFA_PacketType ePacket, @@ -364,6 +369,8 @@ class CXFA_Node : public CXFA_Object { std::vector<UnownedPtr<CXFA_Node>> binding_nodes_; CXFA_Node* m_pUiChildNode = nullptr; XFA_Element m_eUIType = XFA_Element::Unknown; + bool m_bIsNull = true; + bool m_bPreNull = true; }; #endif // XFA_FXFA_PARSER_CXFA_NODE_H_ |