diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-12-13 18:29:02 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-13 18:29:02 +0000 |
commit | 2614250d4f11ed02033a7da095a1694ece12ab78 (patch) | |
tree | cc41c5770c17ea47537856991fa44cd1e2acfeb8 /xfa/fxfa/parser/cxfa_validatedata.cpp | |
parent | 14768f3264a4cff8ca0096a27e41f1861b2c422b (diff) | |
download | pdfium-2614250d4f11ed02033a7da095a1694ece12ab78.tar.xz |
Methods are on CJX_Object not CJX_Node now
This CL converts all of the JSNode() to JSObject() calls as all of the
original CJX_Node methods have been moved to CJX_Object. This fixes
potential bad casts from things like CJX_Content which do not inhert
from CJX_Node.
Bug: pdfium:793372
Change-Id: I6c7f63a78f3d47bb6bad74faed3fd8c535bf095e
Reviewed-on: https://pdfium-review.googlesource.com/21090
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_validatedata.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_validatedata.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/xfa/fxfa/parser/cxfa_validatedata.cpp b/xfa/fxfa/parser/cxfa_validatedata.cpp index 3f7ce1705a..934edba764 100644 --- a/xfa/fxfa/parser/cxfa_validatedata.cpp +++ b/xfa/fxfa/parser/cxfa_validatedata.cpp @@ -20,28 +20,29 @@ constexpr wchar_t kScriptTest[] = L"scriptTest"; CXFA_ValidateData::CXFA_ValidateData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} XFA_AttributeEnum CXFA_ValidateData::GetFormatTest() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::FormatTest); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::FormatTest); } void CXFA_ValidateData::SetNullTest(const WideString& wsValue) { pdfium::Optional<XFA_AttributeEnum> item = CXFA_Node::NameToAttributeEnum(wsValue.AsStringView()); - m_pNode->JSNode()->SetEnum(XFA_Attribute::NullTest, - item ? *item : XFA_AttributeEnum::Disabled, false); + m_pNode->JSObject()->SetEnum(XFA_Attribute::NullTest, + item ? *item : XFA_AttributeEnum::Disabled, + false); } XFA_AttributeEnum CXFA_ValidateData::GetNullTest() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::NullTest); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::NullTest); } XFA_AttributeEnum CXFA_ValidateData::GetScriptTest() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::ScriptTest); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::ScriptTest); } WideString CXFA_ValidateData::GetMessageText( const WideString& wsMessageType) const { CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Message, false); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Message, false); if (!pNode) return L""; @@ -51,9 +52,9 @@ WideString CXFA_ValidateData::GetMessageText( if (pItemNode->GetElementType() != XFA_Element::Text) continue; - WideString wsName = pItemNode->JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); if (wsName.IsEmpty() || wsName == wsMessageType) - return pItemNode->JSNode()->GetContent(false); + return pItemNode->JSObject()->GetContent(false); } return L""; } @@ -85,7 +86,7 @@ void CXFA_ValidateData::SetScriptMessageText(const WideString& wsMessage) { void CXFA_ValidateData::SetMessageText(const WideString& wsMessageType, const WideString& wsMessage) { CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Message, true); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Message, true); if (!pNode) return; @@ -95,24 +96,25 @@ void CXFA_ValidateData::SetMessageText(const WideString& wsMessageType, if (pItemNode->GetElementType() != XFA_Element::Text) continue; - WideString wsName = pItemNode->JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); if (wsName.IsEmpty() || wsName == wsMessageType) { - pItemNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true); + pItemNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, + true); return; } } CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text); pNode->InsertChild(pTextNode, nullptr); - pTextNode->JSNode()->SetCData(XFA_Attribute::Name, wsMessageType, false, - false); - pTextNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true); + pTextNode->JSObject()->SetCData(XFA_Attribute::Name, wsMessageType, false, + false); + pTextNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, true); } WideString CXFA_ValidateData::GetPicture() const { CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture, false); if (pNode) - return pNode->JSNode()->GetContent(false); + return pNode->JSObject()->GetContent(false); return L""; } |