summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-18 18:49:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-18 18:49:46 +0000
commitd66f39a421233931d4da0832c72aae965ad909ee (patch)
tree1192fc157d424fd98ac527b19afcaf05987f4d70 /xfa/fxfa
parentb8fd43f9ca1ec790ef16590dbd909b81c3e09580 (diff)
downloadpdfium-d66f39a421233931d4da0832c72aae965ad909ee.tar.xz
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 <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/cxfa_loadercontext.h2
-rw-r--r--xfa/fxfa/cxfa_textlayout.cpp19
2 files changed, 9 insertions, 12 deletions
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<const CFX_XMLNode> pXMLNode;
UnownedPtr<CXFA_Node> pNode;
RetainPtr<CFX_CSSComputedStyle> 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);