diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-16 16:07:41 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-17 19:00:07 +0000 |
commit | b9fbe6e9af590a91ab030d2523a147e972816b32 (patch) | |
tree | c74b7124a47142da64cc0e84c82fcff743309405 /xfa/fde | |
parent | 6b71f22093fc4abb2da39f5a58b29c45c17ff99a (diff) | |
download | pdfium-b9fbe6e9af590a91ab030d2523a147e972816b32.tar.xz |
Rename FDE_CSSRECT and FDE_CSSLENGTH
This Cl converts the names to FDE_CSSRect and FDE_CSSLength to better match
other parts of the code base.
Change-Id: I33367ae3d93d912755671486d6d5317cddbc4f62
Reviewed-on: https://pdfium-review.googlesource.com/2179
Commit-Queue: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde')
-rw-r--r-- | xfa/fde/css/fde_css.h | 26 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.cpp | 4 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.cpp | 20 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.h | 40 |
4 files changed, 46 insertions, 44 deletions
diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 40f234e878..b18a67f238 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -248,20 +248,21 @@ enum class FDE_CSSStyleSheetPriority : uint8_t { Low, }; -struct FDE_CSSLENGTH { - FDE_CSSLENGTH() {} +class FDE_CSSLength { + public: + FDE_CSSLength() {} - explicit FDE_CSSLENGTH(FDE_CSSLengthUnit eUnit) : m_unit(eUnit) {} + explicit FDE_CSSLength(FDE_CSSLengthUnit eUnit) : m_unit(eUnit) {} - FDE_CSSLENGTH(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) + FDE_CSSLength(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) : m_unit(eUnit), m_fValue(fValue) {} - FDE_CSSLENGTH& Set(FDE_CSSLengthUnit eUnit) { + FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit) { m_unit = eUnit; return *this; } - FDE_CSSLENGTH& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { + FDE_CSSLength& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { m_unit = eUnit; m_fValue = fValue; return *this; @@ -277,23 +278,24 @@ struct FDE_CSSLENGTH { FX_FLOAT m_fValue; }; -struct FDE_CSSRECT { - FDE_CSSRECT() {} +class FDE_CSSRect { + public: + FDE_CSSRect() {} - FDE_CSSRECT(FDE_CSSLengthUnit eUnit, FX_FLOAT val) + FDE_CSSRect(FDE_CSSLengthUnit eUnit, FX_FLOAT val) : left(eUnit, val), top(eUnit, val), right(eUnit, val), bottom(eUnit, val) {} - FDE_CSSRECT& Set(FDE_CSSLengthUnit eUnit) { + FDE_CSSRect& Set(FDE_CSSLengthUnit eUnit) { left.Set(eUnit); top.Set(eUnit); right.Set(eUnit); bottom.Set(eUnit); return *this; } - FDE_CSSRECT& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { + FDE_CSSRect& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { left.Set(eUnit, fValue); top.Set(eUnit, fValue); right.Set(eUnit, fValue); @@ -301,7 +303,7 @@ struct FDE_CSSRECT { return *this; } - FDE_CSSLENGTH left, top, right, bottom; + FDE_CSSLength left, top, right, bottom; }; #endif // XFA_FDE_CSS_FDE_CSS_H_ diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 8ebded5c2d..569a6f2bf9 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -18,7 +18,7 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { } // namespace -bool FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, +bool FDE_CSSLengthToFloat(const FDE_CSSLength& len, FX_FLOAT fPercentBase, FX_FLOAT& fResult) { switch (len.GetUnit()) { @@ -38,7 +38,7 @@ CFX_FloatRect FDE_CSSBoundaryToRect(CFDE_CSSComputedStyle* pBoundStyle, bool bBorder, bool bMargin) { FX_FLOAT fResult; - const FDE_CSSRECT* pRect; + const FDE_CSSRect* pRect; CFX_FloatRect rect(0, 0, 0, 0); if (bPadding) { pRect = pBoundStyle->GetPaddingWidth(); diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index 838a5042e9..5e981d96eb 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -708,7 +708,7 @@ FDE_CSSFontStyle CFDE_CSSStyleSelector::ToFontStyle( } bool CFDE_CSSStyleSelector::SetLengthWithPercent( - FDE_CSSLENGTH& width, + FDE_CSSLength& width, FDE_CSSPrimitiveType eType, CFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize) { @@ -909,27 +909,27 @@ void CFDE_CSSComputedStyle::SetColor(FX_ARGB dwFontColor) { m_InheritedData.m_dwFontColor = dwFontColor; } -const FDE_CSSRECT* CFDE_CSSComputedStyle::GetBorderWidth() const { +const FDE_CSSRect* CFDE_CSSComputedStyle::GetBorderWidth() const { return m_NonInheritedData.m_bHasBorder ? &(m_NonInheritedData.m_BorderWidth) : nullptr; } -const FDE_CSSRECT* CFDE_CSSComputedStyle::GetMarginWidth() const { +const FDE_CSSRect* CFDE_CSSComputedStyle::GetMarginWidth() const { return m_NonInheritedData.m_bHasMargin ? &(m_NonInheritedData.m_MarginWidth) : nullptr; } -const FDE_CSSRECT* CFDE_CSSComputedStyle::GetPaddingWidth() const { +const FDE_CSSRect* CFDE_CSSComputedStyle::GetPaddingWidth() const { return m_NonInheritedData.m_bHasPadding ? &(m_NonInheritedData.m_PaddingWidth) : nullptr; } -void CFDE_CSSComputedStyle::SetMarginWidth(const FDE_CSSRECT& rect) { +void CFDE_CSSComputedStyle::SetMarginWidth(const FDE_CSSRect& rect) { m_NonInheritedData.m_MarginWidth = rect; m_NonInheritedData.m_bHasMargin = true; } -void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRECT& rect) { +void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRect& rect) { m_NonInheritedData.m_PaddingWidth = rect; m_NonInheritedData.m_bHasPadding = true; } @@ -942,7 +942,7 @@ FX_FLOAT CFDE_CSSComputedStyle::GetLineHeight() const { return m_InheritedData.m_fLineHeight; } -const FDE_CSSLENGTH& CFDE_CSSComputedStyle::GetTextIndent() const { +const FDE_CSSLength& CFDE_CSSComputedStyle::GetTextIndent() const { return m_InheritedData.m_TextIndent; } @@ -962,7 +962,7 @@ uint32_t CFDE_CSSComputedStyle::GetTextDecoration() const { return m_NonInheritedData.m_dwTextDecoration; } -const FDE_CSSLENGTH& CFDE_CSSComputedStyle::GetLetterSpacing() const { +const FDE_CSSLength& CFDE_CSSComputedStyle::GetLetterSpacing() const { return m_InheritedData.m_LetterSpacing; } @@ -970,7 +970,7 @@ void CFDE_CSSComputedStyle::SetLineHeight(FX_FLOAT fLineHeight) { m_InheritedData.m_fLineHeight = fLineHeight; } -void CFDE_CSSComputedStyle::SetTextIndent(const FDE_CSSLENGTH& textIndent) { +void CFDE_CSSComputedStyle::SetTextIndent(const FDE_CSSLength& textIndent) { m_InheritedData.m_TextIndent = textIndent; } @@ -988,7 +988,7 @@ void CFDE_CSSComputedStyle::SetTextDecoration(uint32_t dwTextDecoration) { } void CFDE_CSSComputedStyle::SetLetterSpacing( - const FDE_CSSLENGTH& letterSpacing) { + const FDE_CSSLength& letterSpacing) { m_InheritedData.m_LetterSpacing = letterSpacing; } diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index 4de54a8c91..f9833f7594 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -132,7 +132,7 @@ class CFDE_CSSStyleSelector { FX_FLOAT ApplyNumber(FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue, FX_FLOAT fPercentBase); - bool SetLengthWithPercent(FDE_CSSLENGTH& width, + bool SetLengthWithPercent(FDE_CSSLength& width, FDE_CSSPrimitiveType eType, CFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize); @@ -158,9 +158,9 @@ class CFDE_CSSInheritedData { public: CFDE_CSSInheritedData(); - FDE_CSSLENGTH m_LetterSpacing; - FDE_CSSLENGTH m_WordSpacing; - FDE_CSSLENGTH m_TextIndent; + FDE_CSSLength m_LetterSpacing; + FDE_CSSLength m_WordSpacing; + FDE_CSSLength m_TextIndent; CFDE_CSSValueList* m_pFontFamily; FX_FLOAT m_fFontSize; FX_FLOAT m_fLineHeight; @@ -175,13 +175,13 @@ class CFDE_CSSNonInheritedData { public: CFDE_CSSNonInheritedData(); - FDE_CSSRECT m_MarginWidth; - FDE_CSSRECT m_BorderWidth; - FDE_CSSRECT m_PaddingWidth; - FDE_CSSLENGTH m_Top; - FDE_CSSLENGTH m_Bottom; - FDE_CSSLENGTH m_Left; - FDE_CSSLENGTH m_Right; + FDE_CSSRect m_MarginWidth; + FDE_CSSRect m_BorderWidth; + FDE_CSSRect m_PaddingWidth; + FDE_CSSLength m_Top; + FDE_CSSLength m_Bottom; + FDE_CSSLength m_Left; + FDE_CSSLength m_Right; FX_FLOAT m_fVerticalAlign; FDE_CSSDisplay m_eDisplay; FDE_CSSVerticalAlign m_eVerticalAlign; @@ -213,27 +213,27 @@ class CFDE_CSSComputedStyle : public IFX_Retainable { void SetFontSize(FX_FLOAT fFontSize); void SetColor(FX_ARGB dwFontColor); - const FDE_CSSRECT* GetBorderWidth() const; - const FDE_CSSRECT* GetMarginWidth() const; - const FDE_CSSRECT* GetPaddingWidth() const; - void SetMarginWidth(const FDE_CSSRECT& rect); - void SetPaddingWidth(const FDE_CSSRECT& rect); + const FDE_CSSRect* GetBorderWidth() const; + const FDE_CSSRect* GetMarginWidth() const; + const FDE_CSSRect* GetPaddingWidth() const; + void SetMarginWidth(const FDE_CSSRect& rect); + void SetPaddingWidth(const FDE_CSSRect& rect); FDE_CSSDisplay GetDisplay() const; FX_FLOAT GetLineHeight() const; - const FDE_CSSLENGTH& GetTextIndent() const; + const FDE_CSSLength& GetTextIndent() const; FDE_CSSTextAlign GetTextAlign() const; FDE_CSSVerticalAlign GetVerticalAlign() const; FX_FLOAT GetNumberVerticalAlign() const; uint32_t GetTextDecoration() const; - const FDE_CSSLENGTH& GetLetterSpacing() const; + const FDE_CSSLength& GetLetterSpacing() const; void SetLineHeight(FX_FLOAT fLineHeight); - void SetTextIndent(const FDE_CSSLENGTH& textIndent); + void SetTextIndent(const FDE_CSSLength& textIndent); void SetTextAlign(FDE_CSSTextAlign eTextAlign); void SetNumberVerticalAlign(FX_FLOAT fAlign); void SetTextDecoration(uint32_t dwTextDecoration); - void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing); + void SetLetterSpacing(const FDE_CSSLength& letterSpacing); void AddCustomStyle(const CFX_WideString& wsName, const CFX_WideString& wsValue); |