1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_H_
#include <memory>
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/css/css_property_value_set.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_context.h"
#include "third_party/blink/renderer/core/css_property_names.h"
namespace blink {
class Color;
class CSSParserObserver;
class CSSSelectorList;
class Element;
class ImmutableCSSPropertyValueSet;
class StyleRuleBase;
class StyleRuleKeyframe;
class StyleSheetContents;
class CSSValue;
enum class ParseSheetResult;
enum class SecureContextMode;
// This class serves as the public API for the css/parser subsystem
class CORE_EXPORT CSSParser {
STATIC_ONLY(CSSParser);
public:
// As well as regular rules, allows @import and @namespace but not @charset
static StyleRuleBase* ParseRule(const CSSParserContext*,
StyleSheetContents*,
const String&);
static ParseSheetResult ParseSheet(
const CSSParserContext*,
StyleSheetContents*,
const String&,
CSSDeferPropertyParsing defer_property_parsing =
CSSDeferPropertyParsing::kNo,
bool allow_import_rules = true);
static CSSSelectorList ParseSelector(const CSSParserContext*,
StyleSheetContents*,
const String&);
static CSSSelectorList ParsePageSelector(const CSSParserContext&,
StyleSheetContents*,
const String&);
static bool ParseDeclarationList(const CSSParserContext*,
MutableCSSPropertyValueSet*,
const String&);
static MutableCSSPropertyValueSet::SetResult ParseValue(
MutableCSSPropertyValueSet*,
CSSPropertyID unresolved_property,
const String&,
bool important,
SecureContextMode);
static MutableCSSPropertyValueSet::SetResult ParseValue(
MutableCSSPropertyValueSet*,
CSSPropertyID unresolved_property,
const String&,
bool important,
SecureContextMode,
StyleSheetContents*);
static MutableCSSPropertyValueSet::SetResult ParseValueForCustomProperty(
MutableCSSPropertyValueSet*,
const AtomicString& property_name,
const PropertyRegistry*,
const String& value,
bool important,
SecureContextMode,
StyleSheetContents*,
bool is_animation_tainted);
// This is for non-shorthands only
static const CSSValue* ParseSingleValue(CSSPropertyID,
const String&,
const CSSParserContext*);
static const CSSValue* ParseFontFaceDescriptor(CSSPropertyID,
const String&,
const CSSParserContext*);
static ImmutableCSSPropertyValueSet* ParseInlineStyleDeclaration(
const String&,
Element*);
static std::unique_ptr<Vector<double>> ParseKeyframeKeyList(const String&);
static StyleRuleKeyframe* ParseKeyframeRule(const CSSParserContext*,
const String&);
static bool ParseSupportsCondition(const String&, SecureContextMode);
// The color will only be changed when string contains a valid CSS color, so
// callers can set it to a default color and ignore the boolean result.
static bool ParseColor(Color&, const String&, bool strict = false);
static bool ParseSystemColor(Color&, const String&);
static void ParseSheetForInspector(const CSSParserContext*,
StyleSheetContents*,
const String&,
CSSParserObserver&);
static void ParseDeclarationListForInspector(const CSSParserContext*,
const String&,
CSSParserObserver&);
private:
static MutableCSSPropertyValueSet::SetResult ParseValue(
MutableCSSPropertyValueSet*,
CSSPropertyID unresolved_property,
const String&,
bool important,
const CSSParserContext*);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_H_
|