OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above | 9 * 1. Redistributions of source code must retain the above |
10 * copyright notice, this list of conditions and the following | 10 * copyright notice, this list of conditions and the following |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // We don't count the UA style sheet in our statistics. | 78 // We don't count the UA style sheet in our statistics. |
79 return mode != UASheetMode; | 79 return mode != UASheetMode; |
80 } | 80 } |
81 | 81 |
82 class UseCounter; | 82 class UseCounter; |
83 | 83 |
84 class CORE_EXPORT CSSParserContext { | 84 class CORE_EXPORT CSSParserContext { |
85 USING_FAST_MALLOC(CSSParserContext); | 85 USING_FAST_MALLOC(CSSParserContext); |
86 | 86 |
87 public: | 87 public: |
88 // https://drafts.csswg.org/selectors/#profiles | |
89 enum Profile { DynamicProfile, StaticProfile }; | |
Timothy Loh
2016/11/15 02:27:07
SelectorProfile?
kochi
2016/11/15 04:24:38
Done.
SelectorProfile sounds better and clearer.
| |
90 | |
88 CSSParserContext(CSSParserMode, UseCounter*); | 91 CSSParserContext(CSSParserMode, UseCounter*); |
89 // FIXME: We shouldn't need the UseCounter argument as we could infer it from | 92 // FIXME: We shouldn't need the UseCounter argument as we could infer it from |
90 // the Document but some callers want to disable use counting (e.g. the | 93 // the Document but some callers want to disable use counting (e.g. the |
91 // WebInspector). | 94 // WebInspector). |
92 CSSParserContext(const Document&, | 95 CSSParserContext(const Document&, |
93 UseCounter*, | 96 UseCounter*, |
94 const KURL& baseURL = KURL(), | 97 const KURL& baseURL = KURL(), |
95 const String& charset = emptyString()); | 98 const String& charset = emptyString(), |
99 Profile = DynamicProfile); | |
96 // FIXME: This constructor shouldn't exist if we properly piped the UseCounter | 100 // FIXME: This constructor shouldn't exist if we properly piped the UseCounter |
97 // through the CSS subsystem. Currently the UseCounter life time is too crazy | 101 // through the CSS subsystem. Currently the UseCounter life time is too crazy |
98 // and we need a way to override it. | 102 // and we need a way to override it. |
99 CSSParserContext(const CSSParserContext&, UseCounter*); | 103 CSSParserContext(const CSSParserContext&, UseCounter*); |
100 | 104 |
101 bool operator==(const CSSParserContext&) const; | 105 bool operator==(const CSSParserContext&) const; |
102 bool operator!=(const CSSParserContext& other) const { | 106 bool operator!=(const CSSParserContext& other) const { |
103 return !(*this == other); | 107 return !(*this == other); |
104 } | 108 } |
105 | 109 |
106 CSSParserMode mode() const { return m_mode; } | 110 CSSParserMode mode() const { return m_mode; } |
107 CSSParserMode matchMode() const { return m_matchMode; } | 111 CSSParserMode matchMode() const { return m_matchMode; } |
108 const KURL& baseURL() const { return m_baseURL; } | 112 const KURL& baseURL() const { return m_baseURL; } |
109 const String& charset() const { return m_charset; } | 113 const String& charset() const { return m_charset; } |
110 const Referrer& referrer() const { return m_referrer; } | 114 const Referrer& referrer() const { return m_referrer; } |
111 bool isHTMLDocument() const { return m_isHTMLDocument; } | 115 bool isHTMLDocument() const { return m_isHTMLDocument; } |
116 bool isDynamicProfile() const { return m_profile == DynamicProfile; } | |
117 bool isStaticProfile() const { return m_profile == StaticProfile; } | |
112 | 118 |
113 // This quirk is to maintain compatibility with Android apps built on | 119 // This quirk is to maintain compatibility with Android apps built on |
114 // the Android SDK prior to and including version 18. Presumably, this | 120 // the Android SDK prior to and including version 18. Presumably, this |
115 // can be removed any time after 2015. See http://crbug.com/277157. | 121 // can be removed any time after 2015. See http://crbug.com/277157. |
116 bool useLegacyBackgroundSizeShorthandBehavior() const { | 122 bool useLegacyBackgroundSizeShorthandBehavior() const { |
117 return m_useLegacyBackgroundSizeShorthandBehavior; | 123 return m_useLegacyBackgroundSizeShorthandBehavior; |
118 } | 124 } |
119 | 125 |
120 // FIXME: These setters shouldn't exist, however the current lifetime of | 126 // FIXME: These setters shouldn't exist, however the current lifetime of |
121 // CSSParserContext is not well understood and thus we sometimes need to | 127 // CSSParserContext is not well understood and thus we sometimes need to |
(...skipping 11 matching lines...) Expand all Loading... | |
133 | 139 |
134 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy() const { | 140 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy() const { |
135 return m_shouldCheckContentSecurityPolicy; | 141 return m_shouldCheckContentSecurityPolicy; |
136 } | 142 } |
137 | 143 |
138 private: | 144 private: |
139 KURL m_baseURL; | 145 KURL m_baseURL; |
140 String m_charset; | 146 String m_charset; |
141 CSSParserMode m_mode; | 147 CSSParserMode m_mode; |
142 CSSParserMode m_matchMode; | 148 CSSParserMode m_matchMode; |
149 Profile m_profile = DynamicProfile; | |
143 Referrer m_referrer; | 150 Referrer m_referrer; |
144 bool m_isHTMLDocument; | 151 bool m_isHTMLDocument; |
145 bool m_useLegacyBackgroundSizeShorthandBehavior; | 152 bool m_useLegacyBackgroundSizeShorthandBehavior; |
146 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; | 153 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; |
147 | 154 |
148 UseCounter* m_useCounter; | 155 UseCounter* m_useCounter; |
149 }; | 156 }; |
150 | 157 |
151 CORE_EXPORT const CSSParserContext& strictCSSParserContext(); | 158 CORE_EXPORT const CSSParserContext& strictCSSParserContext(); |
152 | 159 |
153 } // namespace blink | 160 } // namespace blink |
154 | 161 |
155 #endif // CSSParserMode_h | 162 #endif // CSSParserMode_h |
OLD | NEW |