summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_csscomputedstyle.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-19 10:27:58 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-19 15:49:07 +0000
commit95bec8046a28928df627ce4d48eee8b209b3e36e (patch)
tree46913cf24aacfc88a89bb55edcce8e3a2e724c4b /xfa/fde/css/cfde_csscomputedstyle.h
parentdd533baad22f5143c093b98e98463a0dc62899ea (diff)
downloadpdfium-95bec8046a28928df627ce4d48eee8b209b3e36e.tar.xz
Split fde/css files into individual class files.
This CL splits the files in xfa/fde/css into class per file and renames any needed files to match the class names. Update some of the classes to use std::stack. Change-Id: I4eca0fb3556d949a15a873bb0f0fd732f47e4fb1 Reviewed-on: https://pdfium-review.googlesource.com/2253 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_csscomputedstyle.h')
-rw-r--r--xfa/fde/css/cfde_csscomputedstyle.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/xfa/fde/css/cfde_csscomputedstyle.h b/xfa/fde/css/cfde_csscomputedstyle.h
new file mode 100644
index 0000000000..73eb996f0d
--- /dev/null
+++ b/xfa/fde/css/cfde_csscomputedstyle.h
@@ -0,0 +1,112 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FDE_CSS_CFDE_CSSCOMPUTEDSTYLE_H_
+#define XFA_FDE_CSS_CFDE_CSSCOMPUTEDSTYLE_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_string.h"
+#include "xfa/fde/css/fde_css.h"
+
+class CFDE_CSSValueList;
+
+class CFDE_CSSComputedStyle : public IFX_Retainable {
+ public:
+ class InheritedData {
+ public:
+ InheritedData();
+
+ FDE_CSSLength m_LetterSpacing;
+ FDE_CSSLength m_WordSpacing;
+ FDE_CSSLength m_TextIndent;
+ CFDE_CSSValueList* m_pFontFamily;
+ FX_FLOAT m_fFontSize;
+ FX_FLOAT m_fLineHeight;
+ FX_ARGB m_dwFontColor;
+ uint16_t m_wFontWeight;
+ FDE_CSSFontVariant m_eFontVariant;
+ FDE_CSSFontStyle m_eFontStyle;
+ FDE_CSSTextAlign m_eTextAlign;
+ };
+
+ class NonInheritedData {
+ public:
+ NonInheritedData();
+
+ 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;
+ uint8_t m_dwTextDecoration;
+ bool m_bHasMargin;
+ bool m_bHasBorder;
+ bool m_bHasPadding;
+ };
+
+ CFDE_CSSComputedStyle();
+ ~CFDE_CSSComputedStyle() override;
+
+ // IFX_Retainable
+ uint32_t Retain() override;
+ uint32_t Release() override;
+
+ int32_t CountFontFamilies() const;
+ const CFX_WideString GetFontFamily(int32_t index) const;
+ uint16_t GetFontWeight() const;
+ FDE_CSSFontVariant GetFontVariant() const;
+ FDE_CSSFontStyle GetFontStyle() const;
+ FX_FLOAT GetFontSize() const;
+ FX_ARGB GetColor() const;
+ void SetFontWeight(uint16_t wFontWeight);
+ void SetFontVariant(FDE_CSSFontVariant eFontVariant);
+ void SetFontStyle(FDE_CSSFontStyle eFontStyle);
+ 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);
+
+ FDE_CSSDisplay GetDisplay() const;
+
+ FX_FLOAT GetLineHeight() 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;
+ void SetLineHeight(FX_FLOAT fLineHeight);
+ 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 AddCustomStyle(const CFX_WideString& wsName,
+ const CFX_WideString& wsValue);
+
+ bool GetCustomStyle(const CFX_WideStringC& wsName,
+ CFX_WideString& wsValue) const;
+
+ InheritedData m_InheritedData;
+ NonInheritedData m_NonInheritedData;
+
+ private:
+ uint32_t m_dwRefCount;
+ std::vector<CFX_WideString> m_CustomProperties;
+};
+
+#endif // XFA_FDE_CSS_CFDE_CSSCOMPUTEDSTYLE_H_