diff options
author | Lei Zhang <thestig@chromium.org> | 2018-08-22 16:14:49 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-22 16:14:49 +0000 |
commit | 03fdf3a2b5ee0974be13a9594a897003df412306 (patch) | |
tree | 3ba4cb34ef92e4245c6e81835760a76dc34418c7 /xfa/fxfa/cxfa_textlayout.cpp | |
parent | b9509d740966e16a94dc456c634b3f1005e8be95 (diff) | |
download | pdfium-03fdf3a2b5ee0974be13a9594a897003df412306.tar.xz |
Mark CFX_XMLNode pointers as const in various places.
Change-Id: I86c6f7526e2ef4c3e8de30ebaff223095ee70fc4
Reviewed-on: https://pdfium-review.googlesource.com/40811
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_textlayout.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_textlayout.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index 976988ee32..49cb13a714 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -167,7 +167,7 @@ void CXFA_TextLayout::InitBreak(float fLineWidth) { void CXFA_TextLayout::InitBreak(CFX_CSSComputedStyle* pStyle, CFX_CSSDisplay eDisplay, float fLineWidth, - CFX_XMLNode* pXMLNode, + const CFX_XMLNode* pXMLNode, CFX_CSSComputedStyle* pParentStyle) { if (!pStyle) { InitBreak(fLineWidth); @@ -457,11 +457,11 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { if (!pContainerNode) return true; - CFX_XMLNode* pXMLNode = m_pLoader->m_pXMLNode.Get(); + const CFX_XMLNode* pXMLNode = m_pLoader->m_pXMLNode.Get(); if (!pXMLNode) return true; - CFX_XMLNode* pSaveXMLNode = pXMLNode; + const CFX_XMLNode* pSaveXMLNode = pXMLNode; for (; pXMLNode; pXMLNode = pXMLNode->GetNextSibling()) { if (!LoadRichText(pXMLNode, szText.width, &fLinePos, m_pLoader->m_pParentStyle, true, nullptr, true, false, @@ -624,27 +624,28 @@ void CXFA_TextLayout::UpdateAlign(float fHeight, float fBottom) { } } -bool CXFA_TextLayout::Loader(float textWidth, +void CXFA_TextLayout::Loader(float textWidth, float* pLinePos, bool bSavePieces) { GetTextDataNode(); if (!m_pTextDataNode) - return true; - - if (m_bRichText) { - CFX_XMLNode* pXMLContainer = GetXMLContainerNode(); - if (pXMLContainer) { - if (!m_textParser.IsParsed()) - m_textParser.DoParse(pXMLContainer, m_pTextProvider); + return; - auto pRootStyle = m_textParser.CreateRootStyle(m_pTextProvider); - LoadRichText(pXMLContainer, textWidth, pLinePos, pRootStyle, bSavePieces, - nullptr, true, false, 0); - } - } else { + if (!m_bRichText) { LoadText(m_pTextDataNode, textWidth, pLinePos, bSavePieces); + return; } - return true; + + const CFX_XMLNode* pXMLContainer = GetXMLContainerNode(); + if (!pXMLContainer) + return; + + if (!m_textParser.IsParsed()) + m_textParser.DoParse(pXMLContainer, m_pTextProvider); + + auto pRootStyle = m_textParser.CreateRootStyle(m_pTextProvider); + LoadRichText(pXMLContainer, textWidth, pLinePos, pRootStyle, bSavePieces, + nullptr, true, false, 0); } void CXFA_TextLayout::LoadText(CXFA_Node* pNode, @@ -683,7 +684,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, } bool CXFA_TextLayout::LoadRichText( - CFX_XMLNode* pXMLNode, + const CFX_XMLNode* pXMLNode, float textWidth, float* pLinePos, const RetainPtr<CFX_CSSComputedStyle>& pParentStyle, @@ -705,7 +706,7 @@ bool CXFA_TextLayout::LoadRichText( if (bEndBreak) { bool bCurOl = false; bool bCurLi = false; - CFX_XMLElement* pElement = nullptr; + const CFX_XMLElement* pElement = nullptr; if (pContext) { if (m_bBlockContinue || (m_pLoader && pXMLNode == m_pLoader->m_pXMLNode)) { @@ -714,7 +715,7 @@ bool CXFA_TextLayout::LoadRichText( if (pXMLNode->GetType() == FX_XMLNODE_Text) { bContentNode = true; } else if (pXMLNode->GetType() == FX_XMLNODE_Element) { - pElement = static_cast<CFX_XMLElement*>(pXMLNode); + pElement = static_cast<const CFX_XMLElement*>(pXMLNode); wsName = pElement->GetLocalTagName(); } if (wsName == L"ol") { |