Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_cssstyleselector.h
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXCRT_CSS_CFX_CSSSTYLESELECTOR_H_
8#define CORE_FXCRT_CSS_CFX_CSSSTYLESELECTOR_H_
9
10#include <stdint.h>
11
12#include <memory>
13#include <vector>
14
15#include "core/fxcrt/css/cfx_css.h"
16#include "core/fxcrt/css/cfx_cssrulecollection.h"
17#include "core/fxcrt/css/cfx_cssvalue.h"
18#include "core/fxcrt/mask.h"
19#include "core/fxcrt/retain_ptr.h"
20
21class CFX_CSSComputedStyle;
25class CFX_CSSSelector;
27class CFX_CSSValueList;
28
30 public:
33
34 void SetDefaultFontSize(float fFontSize);
35 void SetUAStyleSheet(std::unique_ptr<CFX_CSSStyleSheet> pSheet);
36 void UpdateStyleIndex();
37
38 RetainPtr<CFX_CSSComputedStyle> CreateComputedStyle(
39 const CFX_CSSComputedStyle* pParentStyle);
40
41 // Note, the dest style has to be an out param because the CXFA_TextParser
42 // adds non-inherited data from the parent style. Attempting to copy
43 // internally will fail as you'll lose the non-inherited data.
44 void ComputeStyle(const std::vector<const CFX_CSSDeclaration*>& declArray,
45 const WideString& styleString,
46 const WideString& alignString,
47 CFX_CSSComputedStyle* pDestStyle);
48
50 const WideString& tagname);
51
52 private:
53 bool MatchSelector(const WideString& tagname, CFX_CSSSelector* pSel);
54
55 void AppendInlineStyle(CFX_CSSDeclaration* pDecl, const WideString& style);
56 void ApplyDeclarations(
57 const std::vector<const CFX_CSSDeclaration*>& declArray,
58 const CFX_CSSDeclaration* extraDecl,
59 CFX_CSSComputedStyle* pDestStyle);
60 void ApplyProperty(CFX_CSSProperty eProperty,
61 const RetainPtr<CFX_CSSValue>& pValue,
62 CFX_CSSComputedStyle* pComputedStyle);
63 void ExtractValues(const CFX_CSSDeclaration* decl,
64 std::vector<const CFX_CSSPropertyHolder*>* importants,
65 std::vector<const CFX_CSSPropertyHolder*>* normals,
66 std::vector<const CFX_CSSCustomProperty*>* custom);
67
68 bool SetLengthWithPercent(CFX_CSSLength& width,
70 const RetainPtr<CFX_CSSValue>& pValue,
71 float fFontSize);
72 float ToFontSize(CFX_CSSPropertyValue eValue, float fCurFontSize);
73 CFX_CSSDisplay ToDisplay(CFX_CSSPropertyValue eValue);
74 CFX_CSSTextAlign ToTextAlign(CFX_CSSPropertyValue eValue);
75 uint16_t ToFontWeight(CFX_CSSPropertyValue eValue);
76 CFX_CSSFontStyle ToFontStyle(CFX_CSSPropertyValue eValue);
77 CFX_CSSVerticalAlign ToVerticalAlign(CFX_CSSPropertyValue eValue);
78 Mask<CFX_CSSTEXTDECORATION> ToTextDecoration(
79 const RetainPtr<CFX_CSSValueList>& pList);
80 CFX_CSSFontVariant ToFontVariant(CFX_CSSPropertyValue eValue);
81
82 float m_fDefaultFontSize = 12.0f;
83 std::unique_ptr<CFX_CSSStyleSheet> m_UAStyles;
84 CFX_CSSRuleCollection m_UARules;
85};
86
87#endif // CORE_FXCRT_CSS_CFX_CSSSTYLESELECTOR_H_
CFX_CSSFontVariant
Definition cfx_css.h:82
CFX_CSSFontStyle
Definition cfx_css.h:57
CFX_CSSDisplay
Definition cfx_css.h:48
CFX_CSSVerticalAlign
Definition cfx_css.h:70
CFX_CSSTextAlign
Definition cfx_css.h:62
CFX_CSSPropertyValue
Definition cfx_css.h:35
CFX_CSSProperty
Definition cfx_css.h:28
CFX_CSSTEXTDECORATION
Definition cfx_css.h:87
static const Property * GetPropertyByEnum(CFX_CSSProperty property)
static const Color * GetColorByName(WideStringView wsName)
static const LengthUnit * GetLengthUnitByName(WideStringView wsName)
static const Property * GetPropertyByName(WideStringView name)
static const PropertyValue * GetPropertyValueByName(WideStringView wsName)
CFX_CSSNumberValue(Unit unit, float value)
float Apply(float percentBase) const
~CFX_CSSNumberValue() override
void SetUAStyleSheet(std::unique_ptr< CFX_CSSStyleSheet > pSheet)
void ComputeStyle(const std::vector< const CFX_CSSDeclaration * > &declArray, const WideString &styleString, const WideString &alignString, CFX_CSSComputedStyle *pDestStyle)
void SetDefaultFontSize(float fFontSize)
RetainPtr< CFX_CSSComputedStyle > CreateComputedStyle(const CFX_CSSComputedStyle *pParentStyle)
std::vector< const CFX_CSSDeclaration * > MatchDeclarations(const WideString &tagname)
const wchar_t * name
Definition cfx_cssdata.h:35
CFX_CSSNumberValue::Unit type
Definition cfx_cssdata.h:31
const wchar_t * value
Definition cfx_cssdata.h:30
CFX_CSSPropertyValue eName
Definition cfx_cssdata.h:25
CFX_CSSValueTypeMask dwTypes
Definition cfx_cssdata.h:21
CFX_CSSProperty eName
Definition cfx_cssdata.h:19