From 8e49f3fce1a56634284b254a0dc2d329da349355 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 18 Oct 2018 20:51:54 +0000 Subject: Do IWYU in core/fxcrt/css and fix lint errors. Change-Id: I6d2b35849e9f1935277986b6c72e6f507d976974 Reviewed-on: https://pdfium-review.googlesource.com/c/43948 Commit-Queue: Lei Zhang Reviewed-by: Ryan Harrison --- core/fxcrt/css/cfx_css.h | 2 +- core/fxcrt/css/cfx_csscolorvalue.h | 1 + core/fxcrt/css/cfx_csscomputedstyle.cpp | 10 +++++----- core/fxcrt/css/cfx_csscomputedstyle.h | 3 ++- core/fxcrt/css/cfx_cssdata.h | 1 + core/fxcrt/css/cfx_cssstringvalue.h | 1 + core/fxcrt/css/cfx_cssvalue.h | 1 + core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp | 1 + xfa/fxfa/cxfa_textparser.cpp | 18 +++++++++--------- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/core/fxcrt/css/cfx_css.h b/core/fxcrt/css/cfx_css.h index 5b70d0b2e1..30d9ff80fb 100644 --- a/core/fxcrt/css/cfx_css.h +++ b/core/fxcrt/css/cfx_css.h @@ -7,7 +7,7 @@ #ifndef CORE_FXCRT_CSS_CFX_CSS_H_ #define CORE_FXCRT_CSS_CFX_CSS_H_ -#include "core/fxge/fx_dib.h" +#include enum CFX_CSSVALUETYPE { CFX_CSSVALUETYPE_Primitive = 1 << 0, diff --git a/core/fxcrt/css/cfx_csscolorvalue.h b/core/fxcrt/css/cfx_csscolorvalue.h index 0156caa786..fdc3fcbe2f 100644 --- a/core/fxcrt/css/cfx_csscolorvalue.h +++ b/core/fxcrt/css/cfx_csscolorvalue.h @@ -8,6 +8,7 @@ #define CORE_FXCRT_CSS_CFX_CSSCOLORVALUE_H_ #include "core/fxcrt/css/cfx_cssvalue.h" +#include "core/fxge/fx_dib.h" class CFX_CSSColorValue final : public CFX_CSSValue { public: diff --git a/core/fxcrt/css/cfx_csscomputedstyle.cpp b/core/fxcrt/css/cfx_csscomputedstyle.cpp index eff708122b..11ae901185 100644 --- a/core/fxcrt/css/cfx_csscomputedstyle.cpp +++ b/core/fxcrt/css/cfx_csscomputedstyle.cpp @@ -9,16 +9,16 @@ #include "core/fxcrt/css/cfx_cssstringvalue.h" #include "core/fxcrt/css/cfx_cssvaluelist.h" -CFX_CSSComputedStyle::CFX_CSSComputedStyle() {} +CFX_CSSComputedStyle::CFX_CSSComputedStyle() = default; -CFX_CSSComputedStyle::~CFX_CSSComputedStyle() {} +CFX_CSSComputedStyle::~CFX_CSSComputedStyle() = default; bool CFX_CSSComputedStyle::GetCustomStyle(const WideString& wsName, - WideString& wsValue) const { + WideString* pValue) const { for (auto iter = m_CustomProperties.rbegin(); - iter != m_CustomProperties.rend(); iter++) { + iter != m_CustomProperties.rend(); ++iter) { if (wsName == iter->name()) { - wsValue = iter->value(); + *pValue = iter->value(); return true; } } diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h index f97f3f1d7d..d4959eef06 100644 --- a/core/fxcrt/css/cfx_csscomputedstyle.h +++ b/core/fxcrt/css/cfx_csscomputedstyle.h @@ -12,6 +12,7 @@ #include "core/fxcrt/css/cfx_css.h" #include "core/fxcrt/css/cfx_csscustomproperty.h" #include "core/fxcrt/fx_string.h" +#include "core/fxge/fx_dib.h" class CFX_CSSValueList; @@ -94,7 +95,7 @@ class CFX_CSSComputedStyle final : public Retainable { void SetLetterSpacing(const CFX_CSSLength& letterSpacing); void AddCustomStyle(const CFX_CSSCustomProperty& prop); - bool GetCustomStyle(const WideString& wsName, WideString& wsValue) const; + bool GetCustomStyle(const WideString& wsName, WideString* pValue) const; InheritedData m_InheritedData; NonInheritedData m_NonInheritedData; diff --git a/core/fxcrt/css/cfx_cssdata.h b/core/fxcrt/css/cfx_cssdata.h index a2f774b1af..8e1d265edf 100644 --- a/core/fxcrt/css/cfx_cssdata.h +++ b/core/fxcrt/css/cfx_cssdata.h @@ -11,6 +11,7 @@ #include "core/fxcrt/css/cfx_cssnumbervalue.h" #include "core/fxcrt/css/cfx_cssvalue.h" #include "core/fxcrt/string_view_template.h" +#include "core/fxge/fx_dib.h" class CFX_CSSData { public: diff --git a/core/fxcrt/css/cfx_cssstringvalue.h b/core/fxcrt/css/cfx_cssstringvalue.h index d49393c305..b59cef097e 100644 --- a/core/fxcrt/css/cfx_cssstringvalue.h +++ b/core/fxcrt/css/cfx_cssstringvalue.h @@ -8,6 +8,7 @@ #define CORE_FXCRT_CSS_CFX_CSSSTRINGVALUE_H_ #include "core/fxcrt/css/cfx_cssvalue.h" +#include "core/fxcrt/widestring.h" class CFX_CSSStringValue final : public CFX_CSSValue { public: diff --git a/core/fxcrt/css/cfx_cssvalue.h b/core/fxcrt/css/cfx_cssvalue.h index f143e96036..30aace2b64 100644 --- a/core/fxcrt/css/cfx_cssvalue.h +++ b/core/fxcrt/css/cfx_cssvalue.h @@ -8,6 +8,7 @@ #define CORE_FXCRT_CSS_CFX_CSSVALUE_H_ #include "core/fxcrt/css/cfx_css.h" +#include "core/fxcrt/retain_ptr.h" class CFX_CSSValue : public Retainable { public: diff --git a/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp b/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp index e232a2dc65..9d19d275f6 100644 --- a/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp +++ b/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp @@ -6,6 +6,7 @@ #include "core/fxcrt/css/cfx_cssvaluelistparser.h" +#include "core/fxcrt/widestring.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" #include "third_party/base/ptr_util.h" diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index d8150a6fa0..24276e1ce0 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp @@ -316,21 +316,21 @@ XFA_AttributeEnum CXFA_TextParser::GetVAlign( float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const { WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue)) + if (pStyle && pStyle->GetCustomStyle(L"tab-interval", &wsValue)) return CXFA_Measurement(wsValue.AsStringView()).ToUnit(XFA_Unit::Pt); return 36; } int32_t CXFA_TextParser::CountTabs(CFX_CSSComputedStyle* pStyle) const { WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(L"xfa-tab-count", wsValue)) + if (pStyle && pStyle->GetCustomStyle(L"xfa-tab-count", &wsValue)) return wsValue.GetInteger(); return 0; } bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const { WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(L"xfa-spacerun", wsValue)) { + if (pStyle && pStyle->GetCustomStyle(L"xfa-spacerun", &wsValue)) { wsValue.MakeLower(); return wsValue == L"yes"; } @@ -382,7 +382,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, const CFX_XMLNode* pXMLNode) const { if (pStyle) { WideString wsValue; - if (pStyle->GetCustomStyle(L"xfa-font-horizontal-scale", wsValue)) + if (pStyle->GetCustomStyle(L"xfa-font-horizontal-scale", &wsValue)) return wsValue.GetInteger(); while (pXMLNode) { @@ -391,7 +391,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, CXFA_TextParseContext* pContext = it->second.get(); if (pContext && pContext->m_pParentStyle && pContext->m_pParentStyle->GetCustomStyle( - L"xfa-font-horizontal-scale", wsValue)) { + L"xfa-font-horizontal-scale", &wsValue)) { return wsValue.GetInteger(); } } @@ -407,7 +407,7 @@ int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider, CFX_CSSComputedStyle* pStyle) const { if (pStyle) { WideString wsValue; - if (pStyle->GetCustomStyle(L"xfa-font-vertical-scale", wsValue)) + if (pStyle->GetCustomStyle(L"xfa-font-vertical-scale", &wsValue)) return wsValue.GetInteger(); } @@ -437,7 +437,7 @@ void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider, iUnderline = 1; WideString wsValue; - if (pStyle->GetCustomStyle(L"underlinePeriod", wsValue)) { + if (pStyle->GetCustomStyle(L"underlinePeriod", &wsValue)) { if (wsValue == L"word") iPeriod = XFA_AttributeEnum::Word; } else if (font) { @@ -551,8 +551,8 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle, return false; WideString wsValue; - if (!pStyle->GetCustomStyle(L"xfa-tab-stops", wsValue) && - !pStyle->GetCustomStyle(L"tab-stops", wsValue)) { + if (!pStyle->GetCustomStyle(L"xfa-tab-stops", &wsValue) && + !pStyle->GetCustomStyle(L"tab-stops", &wsValue)) { return false; } -- cgit v1.2.3