summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_widgetdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-04 10:05:36 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 16:14:31 +0000
commit72fe435e80807c91dbf8edc41d5bf3ec3c9bd9e4 (patch)
treef171ca51a643ea905908e98daf9bbe99590fdb73 /xfa/fxfa/parser/cxfa_widgetdata.cpp
parenta0af75cc4d1e50bb2832dc58636043afe565b02b (diff)
downloadpdfium-72fe435e80807c91dbf8edc41d5bf3ec3c9bd9e4.tar.xz
Remove CXFA_DataData
This CL removes the CXFA_DataData base class and the functionality is moved to where it's needed. Change-Id: Ieba31aa924b9b513466144b31f0e1613923c50aa Reviewed-on: https://pdfium-review.googlesource.com/22250 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp97
1 files changed, 50 insertions, 47 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 5833655156..7771d33d01 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -223,12 +223,14 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) {
} // namespace
CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode)
- : CXFA_DataData(pNode),
+ : m_pNode(pNode),
m_bIsNull(true),
m_bPreNull(true),
m_pUiChildNode(nullptr),
m_eUIType(XFA_Element::Unknown) {}
+CXFA_WidgetData::~CXFA_WidgetData() = default;
+
CXFA_Node* CXFA_WidgetData::GetUIChild() {
if (m_eUIType == XFA_Element::Unknown)
m_pUiChildNode = CreateUIChild(m_pNode, m_eUIType);
@@ -338,27 +340,27 @@ CXFA_Bind* CXFA_WidgetData::GetBind() {
}
pdfium::Optional<float> CXFA_WidgetData::TryWidth() {
- return TryMeasureAsFloat(XFA_Attribute::W);
+ return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::W);
}
pdfium::Optional<float> CXFA_WidgetData::TryHeight() {
- return TryMeasureAsFloat(XFA_Attribute::H);
+ return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::H);
}
pdfium::Optional<float> CXFA_WidgetData::TryMinWidth() {
- return TryMeasureAsFloat(XFA_Attribute::MinW);
+ return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MinW);
}
pdfium::Optional<float> CXFA_WidgetData::TryMinHeight() {
- return TryMeasureAsFloat(XFA_Attribute::MinH);
+ return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MinH);
}
pdfium::Optional<float> CXFA_WidgetData::TryMaxWidth() {
- return TryMeasureAsFloat(XFA_Attribute::MaxW);
+ return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxW);
}
pdfium::Optional<float> CXFA_WidgetData::TryMaxHeight() {
- return TryMeasureAsFloat(XFA_Attribute::MaxH);
+ return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxH);
}
CXFA_Border* CXFA_WidgetData::GetUIBorder() {
@@ -502,46 +504,8 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() {
}
void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) {
- CXFA_WidgetData exclGroup(GetExclGroupNode());
- if (exclGroup.HasValidNode()) {
- WideString wsValue;
- if (eCheckState != XFA_CHECKSTATE_Off) {
- if (CXFA_Items* pItems =
- m_pNode->GetChild<CXFA_Items>(0, XFA_Element::Items, false)) {
- CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (pText)
- wsValue = pText->JSObject()->GetContent(false);
- }
- }
- CXFA_Node* pChild =
- exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
- if (pChild->GetElementType() != XFA_Element::Field)
- continue;
-
- CXFA_Items* pItem =
- pChild->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
- if (!pItem)
- continue;
-
- CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
- if (!pItemchild)
- continue;
-
- WideString text = pItemchild->JSObject()->GetContent(false);
- WideString wsChildValue = text;
- if (wsValue != text) {
- pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling);
- if (pItemchild)
- wsChildValue = pItemchild->JSObject()->GetContent(false);
- else
- wsChildValue.clear();
- }
- CXFA_WidgetData ch(pChild);
- ch.SyncValue(wsChildValue, bNotify);
- }
- exclGroup.SyncValue(wsValue, bNotify);
- } else {
+ CXFA_Node* node = GetExclGroupNode();
+ if (!node) {
CXFA_Items* pItems =
m_pNode->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
if (!pItems)
@@ -559,7 +523,46 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) {
pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling);
}
SyncValue(wsContent, bNotify);
+ return;
+ }
+
+ CXFA_WidgetData exclGroup(node);
+ WideString wsValue;
+ if (eCheckState != XFA_CHECKSTATE_Off) {
+ if (CXFA_Items* pItems =
+ m_pNode->GetChild<CXFA_Items>(0, XFA_Element::Items, false)) {
+ CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
+ if (pText)
+ wsValue = pText->JSObject()->GetContent(false);
+ }
+ }
+ CXFA_Node* pChild = exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
+ for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ if (pChild->GetElementType() != XFA_Element::Field)
+ continue;
+
+ CXFA_Items* pItem =
+ pChild->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
+ if (!pItem)
+ continue;
+
+ CXFA_Node* pItemchild = pItem->GetNodeItem(XFA_NODEITEM_FirstChild);
+ if (!pItemchild)
+ continue;
+
+ WideString text = pItemchild->JSObject()->GetContent(false);
+ WideString wsChildValue = text;
+ if (wsValue != text) {
+ pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ if (pItemchild)
+ wsChildValue = pItemchild->JSObject()->GetContent(false);
+ else
+ wsChildValue.clear();
+ }
+ CXFA_WidgetData ch(pChild);
+ ch.SyncValue(wsChildValue, bNotify);
}
+ exclGroup.SyncValue(wsValue, bNotify);
}
CXFA_Node* CXFA_WidgetData::GetExclGroupNode() {