From d66f39a421233931d4da0832c72aae965ad909ee Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 18 Oct 2018 18:49:46 +0000 Subject: Change CXFA_LoaderContext::dwFlags to bFilterSpace. Only 1 bit in the flag is ever used, so simplify it. Change-Id: I75fb7d89c18cbb2538a1c8702bb85b4f3c10d420 Reviewed-on: https://pdfium-review.googlesource.com/c/44256 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- xfa/fxfa/cxfa_loadercontext.h | 2 +- xfa/fxfa/cxfa_textlayout.cpp | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_loadercontext.h b/xfa/fxfa/cxfa_loadercontext.h index 87a795be9c..91ffee64f9 100644 --- a/xfa/fxfa/cxfa_loadercontext.h +++ b/xfa/fxfa/cxfa_loadercontext.h @@ -22,13 +22,13 @@ struct CXFA_LoaderContext { ~CXFA_LoaderContext(); bool bSaveLineHeight = false; + bool bFilterSpace = false; float fWidth = 0; float fHeight = 0; float fLastPos = 0; float fStartLineOffset = 0; int32_t iChar = 0; int32_t iTotalLines = -1; - uint32_t dwFlags = 0; UnownedPtr pXMLNode; UnownedPtr pNode; RetainPtr pParentStyle; diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index ec36bcb7a3..44a7c64fc0 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -34,8 +34,6 @@ #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_para.h" -#define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 - namespace { void ProcessText(WideString* pText) { @@ -807,20 +805,19 @@ bool CXFA_TextLayout::LoadRichText( ProcessText(&wsText); if (m_pLoader) { - if (wsText.GetLength() > 0 && - (m_pLoader->dwFlags & XFA_LOADERCNTXTFLG_FILTERSPACE)) { + if (wsText.GetLength() > 0 && m_pLoader->bFilterSpace) { wsText.TrimLeft(L" "); } if (CFX_CSSDisplay::Block == eDisplay) { - m_pLoader->dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE; + m_pLoader->bFilterSpace = true; } else if (CFX_CSSDisplay::Inline == eDisplay && - (m_pLoader->dwFlags & XFA_LOADERCNTXTFLG_FILTERSPACE)) { - m_pLoader->dwFlags &= ~XFA_LOADERCNTXTFLG_FILTERSPACE; + m_pLoader->bFilterSpace) { + m_pLoader->bFilterSpace = false; } else if (wsText.GetLength() > 0 && (0x20 == wsText[wsText.GetLength() - 1])) { - m_pLoader->dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE; + m_pLoader->bFilterSpace = true; } else if (wsText.GetLength() != 0) { - m_pLoader->dwFlags &= ~XFA_LOADERCNTXTFLG_FILTERSPACE; + m_pLoader->bFilterSpace = false; } } @@ -833,7 +830,7 @@ bool CXFA_TextLayout::LoadRichText( if (AppendChar(wsText, pLinePos, 0, bSavePieces)) { if (m_pLoader) - m_pLoader->dwFlags &= ~XFA_LOADERCNTXTFLG_FILTERSPACE; + m_pLoader->bFilterSpace = false; if (IsEnd(bSavePieces)) { if (m_pLoader && m_pLoader->iTotalLines > -1) { m_pLoader->pXMLNode = pXMLNode; @@ -860,7 +857,7 @@ bool CXFA_TextLayout::LoadRichText( if (m_pLoader) { if (CFX_CSSDisplay::Block == eDisplay) - m_pLoader->dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE; + m_pLoader->bFilterSpace = true; } if (bCurLi) EndBreak(CFX_BreakType::Line, pLinePos, bSavePieces); -- cgit v1.2.3