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_cssdeclaration.h
Go to the documentation of this file.
1// Copyright 2014 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_CSSDECLARATION_H_
8#define CORE_FXCRT_CSS_CFX_CSSDECLARATION_H_
9
10#include <memory>
11#include <vector>
12
13#include "core/fxcrt/css/cfx_cssdata.h"
14#include "core/fxcrt/retain_ptr.h"
15
18
20 public:
25
26 static bool ParseCSSString(const wchar_t* pszValue,
27 size_t nValueLen,
28 size_t* nOffset,
29 size_t* nLength);
30 static bool ParseCSSColor(const wchar_t* pszValue,
31 size_t nValueLen,
32 FX_ARGB* dwColor);
33
36
38 bool* bImportant) const;
39
40 const_prop_iterator begin() const { return properties_.begin(); }
41 const_prop_iterator end() const { return properties_.end(); }
42
44 return custom_properties_.begin();
45 }
46 const_custom_iterator custom_end() const { return custom_properties_.end(); }
47
48 bool empty() const { return properties_.empty(); }
49
50 void AddProperty(const CFX_CSSData::Property* property, WideStringView value);
51 void AddProperty(const WideString& prop, const WideString& value);
52
54
55 FX_ARGB ParseColorForTest(const wchar_t* pszValue,
56 size_t nValueLen,
57 FX_ARGB* dwColor) const;
58
59 private:
60 void ParseFontProperty(const wchar_t* pszValue,
61 size_t nValueLen,
62 bool bImportant);
63 bool ParseBorderProperty(const wchar_t* pszValue,
64 size_t nValueLen,
65 RetainPtr<CFX_CSSValue>& pWidth) const;
66 void ParseValueListProperty(const CFX_CSSData::Property* pProperty,
67 const wchar_t* pszValue,
68 size_t nValueLen,
69 bool bImportant);
70 void Add4ValuesProperty(const std::vector<RetainPtr<CFX_CSSValue>>& list,
71 bool bImportant,
72 CFX_CSSProperty eLeft,
73 CFX_CSSProperty eTop,
74 CFX_CSSProperty eRight,
75 CFX_CSSProperty eBottom);
76 RetainPtr<CFX_CSSValue> ParseNumber(const wchar_t* pszValue,
77 size_t nValueLen);
78 RetainPtr<CFX_CSSValue> ParseEnum(const wchar_t* pszValue, size_t nValueLen);
79 RetainPtr<CFX_CSSValue> ParseColor(const wchar_t* pszValue, size_t nValueLen);
80 RetainPtr<CFX_CSSValue> ParseString(const wchar_t* pszValue,
81 size_t nValueLen);
82 void AddPropertyHolder(CFX_CSSProperty eProperty,
83 RetainPtr<CFX_CSSValue> pValue,
84 bool bImportant);
85
86 std::vector<std::unique_ptr<CFX_CSSPropertyHolder>> properties_;
87 std::vector<std::unique_ptr<CFX_CSSCustomProperty>> custom_properties_;
88};
89
90#endif // CORE_FXCRT_CSS_CFX_CSSDECLARATION_H_
CFX_CSSVALUETYPE
Definition cfx_css.h:14
@ CFX_CSSVALUETYPE_Shorthand
Definition cfx_css.h:17
@ CFX_CSSVALUETYPE_Primitive
Definition cfx_css.h:15
@ CFX_CSSVALUETYPE_MaybeEnum
Definition cfx_css.h:20
@ CFX_CSSVALUETYPE_MaybeString
Definition cfx_css.h:21
@ CFX_CSSVALUETYPE_MaybeColor
Definition cfx_css.h:22
@ CFX_CSSVALUETYPE_MaybeNumber
Definition cfx_css.h:19
CFX_CSSPropertyValue
Definition cfx_css.h:35
CFX_CSSProperty
Definition cfx_css.h:28
static const Color * GetColorByName(WideStringView wsName)
static const LengthUnit * GetLengthUnitByName(WideStringView wsName)
static const PropertyValue * GetPropertyValueByName(WideStringView wsName)
static bool ParseCSSString(const wchar_t *pszValue, size_t nValueLen, size_t *nOffset, size_t *nLength)
FX_ARGB ParseColorForTest(const wchar_t *pszValue, size_t nValueLen, FX_ARGB *dwColor) const
const_prop_iterator end() const
void AddProperty(const CFX_CSSData::Property *property, WideStringView value)
const_prop_iterator begin() const
void AddProperty(const WideString &prop, const WideString &value)
size_t PropertyCountForTesting() const
const_custom_iterator custom_begin() const
const_custom_iterator custom_end() const
RetainPtr< CFX_CSSValue > GetProperty(CFX_CSSProperty eProperty, bool *bImportant) const
static bool ParseCSSColor(const wchar_t *pszValue, size_t nValueLen, FX_ARGB *dwColor)
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
int FXSYS_HexCharToInt(char c)
int FXSYS_roundf(float f)
Definition fx_system.cpp:92
CFX_CSSNumberValue::Unit type
Definition cfx_cssdata.h:31
CFX_CSSPropertyValue eName
Definition cfx_cssdata.h:25
CFX_CSSProperty eName
Definition cfx_cssdata.h:19