From b9fbe6e9af590a91ab030d2523a147e972816b32 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 16 Jan 2017 16:07:41 -0500 Subject: 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 Commit-Queue: Tom Sepez Reviewed-by: Tom Sepez --- xfa/fde/css/fde_css.h | 26 ++++++++++++----------- xfa/fde/css/fde_cssdatatable.cpp | 4 ++-- xfa/fde/css/fde_cssstyleselector.cpp | 20 +++++++++--------- xfa/fde/css/fde_cssstyleselector.h | 40 ++++++++++++++++++------------------ xfa/fxfa/app/cxfa_textlayout.cpp | 14 ++++++------- xfa/fxfa/app/cxfa_textparser.cpp | 8 ++++---- 6 files changed, 57 insertions(+), 55 deletions(-) (limited to 'xfa') 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); diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index a1870f1f58..3f3058bf4e 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -203,8 +203,8 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, } m_pBreak->SetAlignment(iAlign); FX_FLOAT fStart = 0; - const FDE_CSSRECT* pRect = pStyle->GetMarginWidth(); - const FDE_CSSRECT* pPaddingRect = pStyle->GetPaddingWidth(); + const FDE_CSSRect* pRect = pStyle->GetMarginWidth(); + const FDE_CSSRect* pPaddingRect = pStyle->GetPaddingWidth(); if (pRect) { fStart = pRect->left.GetValue(); fLineWidth -= pRect->right.GetValue(); @@ -213,8 +213,8 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, fLineWidth -= pPaddingRect->right.GetValue(); } if (eDisplay == FDE_CSSDisplay::ListItem) { - const FDE_CSSRECT* pParRect = pParentStyle->GetMarginWidth(); - const FDE_CSSRECT* pParPaddingRect = pParentStyle->GetPaddingWidth(); + const FDE_CSSRect* pParRect = pParentStyle->GetMarginWidth(); + const FDE_CSSRect* pParPaddingRect = pParentStyle->GetPaddingWidth(); if (pParRect) { fStart += pParRect->left.GetValue(); fLineWidth -= pParRect->right.GetValue(); @@ -223,7 +223,7 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle, fLineWidth -= pParPaddingRect->right.GetValue(); } } - FDE_CSSRECT pNewRect; + FDE_CSSRect pNewRect; pNewRect.left.Set(FDE_CSSLengthUnit::Point, fStart); pNewRect.right.Set(FDE_CSSLengthUnit::Point, pRect->right.GetValue()); pNewRect.top.Set(FDE_CSSLengthUnit::Point, pRect->top.GetValue()); @@ -775,7 +775,7 @@ bool CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, (wsName.IsEmpty() || (wsName != FX_WSTRC(L"body") && wsName != FX_WSTRC(L"html") && wsName != FX_WSTRC(L"ol") && wsName != FX_WSTRC(L"ul")))) { - const FDE_CSSRECT* pRect = pStyle->GetMarginWidth(); + const FDE_CSSRect* pRect = pStyle->GetMarginWidth(); if (pRect) { fLinePos += pRect->top.GetValue(); fSpaceBelow = pRect->bottom.GetValue(); @@ -1186,7 +1186,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, if (pStyle) { FX_FLOAT fStart = 0; - const FDE_CSSRECT* pRect = pStyle->GetMarginWidth(); + const FDE_CSSRect* pRect = pStyle->GetMarginWidth(); if (pRect) fStart = pRect->left.GetValue(); diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index 77f22515be..a0da99c8dc 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -110,7 +110,7 @@ CFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( if (para) { fLineHeight = para.GetLineHeight(); - FDE_CSSLENGTH indent; + FDE_CSSLength indent; indent.Set(FDE_CSSLengthUnit::Point, para.GetTextIndent()); pStyle->SetTextIndent(indent); FDE_CSSTextAlign hAlign = FDE_CSSTextAlign::Left; @@ -129,7 +129,7 @@ CFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( break; } pStyle->SetTextAlign(hAlign); - FDE_CSSRECT rtMarginWidth; + FDE_CSSRect rtMarginWidth; rtMarginWidth.left.Set(FDE_CSSLengthUnit::Point, para.GetMarginLeft()); rtMarginWidth.top.Set(FDE_CSSLengthUnit::Point, para.GetSpaceAbove()); rtMarginWidth.right.Set(FDE_CSSLengthUnit::Point, para.GetMarginRight()); @@ -144,7 +144,7 @@ CFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( pStyle->SetFontWeight(font.IsBold() ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); pStyle->SetNumberVerticalAlign(-font.GetBaselineShift()); fFontSize = font.GetFontSize(); - FDE_CSSLENGTH letterSpacing; + FDE_CSSLength letterSpacing; letterSpacing.Set(FDE_CSSLengthUnit::Point, font.GetLetterSpacing()); pStyle->SetLetterSpacing(letterSpacing); uint32_t dwDecoration = 0; @@ -178,7 +178,7 @@ CFDE_CSSComputedStyle* CXFA_TextParser::CreateStyle( pNewStyle->SetTextDecoration(dwDecoration); pNewStyle->SetNumberVerticalAlign(fBaseLine); - const FDE_CSSRECT* pRect = pParentStyle->GetMarginWidth(); + const FDE_CSSRect* pRect = pParentStyle->GetMarginWidth(); if (pRect) pNewStyle->SetMarginWidth(*pRect); return pNewStyle; -- cgit v1.2.3