diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-08 13:23:24 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-08 17:37:54 +0000 |
commit | 9f0e85ac36826e39a242f8039c2b2c333ee99f4f (patch) | |
tree | c93f2a9322968f7723a4b3da5ea5e4cb7b79b075 /core/fxcrt/css/cfx_csscomputedstyle.h | |
parent | 78fc9aa402409f3fcd8dc1f458e67798cb3b483e (diff) | |
download | pdfium-9f0e85ac36826e39a242f8039c2b2c333ee99f4f.tar.xz |
Move CSS code to core
The xfa/fde/css code has no other links into xfa/. This CL moves the css
code to core/fxcrt/css and sets to only build when pdf_enable_xfa is
enabled.
Change-Id: Iefd208e1f83a28b80b567c574e841e87bce310be
Reviewed-on: https://pdfium-review.googlesource.com/9251
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/css/cfx_csscomputedstyle.h')
-rw-r--r-- | core/fxcrt/css/cfx_csscomputedstyle.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h new file mode 100644 index 0000000000..bd7cd8268b --- /dev/null +++ b/core/fxcrt/css/cfx_csscomputedstyle.h @@ -0,0 +1,111 @@ +// 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 CORE_FXCRT_CSS_CFX_CSSCOMPUTEDSTYLE_H_ +#define CORE_FXCRT_CSS_CFX_CSSCOMPUTEDSTYLE_H_ + +#include <vector> + +#include "core/fxcrt/css/cfx_css.h" +#include "core/fxcrt/css/cfx_csscustomproperty.h" +#include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/fx_string.h" + +class CFX_CSSValueList; + +class CFX_CSSComputedStyle : public CFX_Retainable { + public: + class InheritedData { + public: + InheritedData(); + ~InheritedData(); + + CFX_CSSLength m_LetterSpacing; + CFX_CSSLength m_WordSpacing; + CFX_CSSLength m_TextIndent; + CFX_RetainPtr<CFX_CSSValueList> m_pFontFamily; + float m_fFontSize; + float m_fLineHeight; + FX_ARGB m_dwFontColor; + uint16_t m_wFontWeight; + CFX_CSSFontVariant m_eFontVariant; + CFX_CSSFontStyle m_eFontStyle; + CFX_CSSTextAlign m_eTextAlign; + }; + + class NonInheritedData { + public: + NonInheritedData(); + + CFX_CSSRect m_MarginWidth; + CFX_CSSRect m_BorderWidth; + CFX_CSSRect m_PaddingWidth; + CFX_CSSLength m_Top; + CFX_CSSLength m_Bottom; + CFX_CSSLength m_Left; + CFX_CSSLength m_Right; + float m_fVerticalAlign; + CFX_CSSDisplay m_eDisplay; + CFX_CSSVerticalAlign m_eVerticalAlign; + uint8_t m_dwTextDecoration; + bool m_bHasMargin; + bool m_bHasBorder; + bool m_bHasPadding; + }; + + int32_t CountFontFamilies() const; + const CFX_WideString GetFontFamily(int32_t index) const; + uint16_t GetFontWeight() const; + CFX_CSSFontVariant GetFontVariant() const; + CFX_CSSFontStyle GetFontStyle() const; + float GetFontSize() const; + FX_ARGB GetColor() const; + void SetFontWeight(uint16_t wFontWeight); + void SetFontVariant(CFX_CSSFontVariant eFontVariant); + void SetFontStyle(CFX_CSSFontStyle eFontStyle); + void SetFontSize(float fFontSize); + void SetColor(FX_ARGB dwFontColor); + + const CFX_CSSRect* GetBorderWidth() const; + const CFX_CSSRect* GetMarginWidth() const; + const CFX_CSSRect* GetPaddingWidth() const; + void SetMarginWidth(const CFX_CSSRect& rect); + void SetPaddingWidth(const CFX_CSSRect& rect); + + CFX_CSSDisplay GetDisplay() const; + + float GetLineHeight() const; + const CFX_CSSLength& GetTextIndent() const; + CFX_CSSTextAlign GetTextAlign() const; + CFX_CSSVerticalAlign GetVerticalAlign() const; + float GetNumberVerticalAlign() const; + uint32_t GetTextDecoration() const; + const CFX_CSSLength& GetLetterSpacing() const; + void SetLineHeight(float fLineHeight); + void SetTextIndent(const CFX_CSSLength& textIndent); + void SetTextAlign(CFX_CSSTextAlign eTextAlign); + void SetNumberVerticalAlign(float fAlign); + void SetTextDecoration(uint32_t dwTextDecoration); + void SetLetterSpacing(const CFX_CSSLength& letterSpacing); + void AddCustomStyle(const CFX_CSSCustomProperty& prop); + + bool GetCustomStyle(const CFX_WideString& wsName, + CFX_WideString& wsValue) const; + + InheritedData m_InheritedData; + NonInheritedData m_NonInheritedData; + + private: + template <typename T, typename... Args> + friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + + CFX_CSSComputedStyle(); + ~CFX_CSSComputedStyle() override; + + std::vector<CFX_CSSCustomProperty> m_CustomProperties; +}; + +#endif // CORE_FXCRT_CSS_CFX_CSSCOMPUTEDSTYLE_H_ |