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 17 matching lines...) Expand all Loading... |
28 * SUCH DAMAGE. | 28 * SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef CSSParserMode_h | 31 #ifndef CSSParserMode_h |
32 #define CSSParserMode_h | 32 #define CSSParserMode_h |
33 | 33 |
34 #include "platform/weborigin/KURL.h" | 34 #include "platform/weborigin/KURL.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class Document; | 38 class TreeScope; |
39 | 39 |
40 // Must not grow beyond 3 bits, due to packing in StylePropertySet. | 40 // Must not grow beyond 3 bits, due to packing in StylePropertySet. |
41 enum CSSParserMode { | 41 enum CSSParserMode { |
42 HTMLStandardMode, | 42 HTMLStandardMode, |
43 HTMLQuirksMode, | 43 HTMLQuirksMode, |
44 // HTML attributes are parsed in quirks mode but also allows internal proper
ties and values. | 44 // HTML attributes are parsed in quirks mode but also allows internal proper
ties and values. |
45 HTMLAttributeMode, | 45 HTMLAttributeMode, |
46 // SVG attributes are parsed in quirks mode but rules differ slightly. | 46 // SVG attributes are parsed in quirks mode but rules differ slightly. |
47 SVGAttributeMode, | 47 SVGAttributeMode, |
48 // @viewport rules are parsed in standards mode but CSSOM modifications (via
StylePropertySet) | 48 // @viewport rules are parsed in standards mode but CSSOM modifications (via
StylePropertySet) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 inline bool isUseCounterEnabledForMode(CSSParserMode mode) | 85 inline bool isUseCounterEnabledForMode(CSSParserMode mode) |
86 { | 86 { |
87 // We don't count the UA style sheet in our statistics. | 87 // We don't count the UA style sheet in our statistics. |
88 return mode != UASheetMode; | 88 return mode != UASheetMode; |
89 } | 89 } |
90 | 90 |
91 class CSSParserContext { | 91 class CSSParserContext { |
92 WTF_MAKE_FAST_ALLOCATED; | 92 WTF_MAKE_FAST_ALLOCATED; |
93 public: | 93 public: |
94 CSSParserContext(CSSParserMode); | 94 CSSParserContext(CSSParserMode); |
95 CSSParserContext(const Document&, const KURL& baseURL = KURL(), const String
& charset = emptyString()); | 95 CSSParserContext(const TreeScope&, const KURL& baseURL = KURL(), const Strin
g& charset = emptyString()); |
96 | 96 |
97 bool operator==(const CSSParserContext&) const; | 97 bool operator==(const CSSParserContext&) const; |
98 bool operator!=(const CSSParserContext& other) const { return !(*this == oth
er); } | 98 bool operator!=(const CSSParserContext& other) const { return !(*this == oth
er); } |
99 | 99 |
100 CSSParserMode mode() const { return m_mode; } | 100 CSSParserMode mode() const { return m_mode; } |
101 const KURL& baseURL() const { return m_baseURL; } | 101 const KURL& baseURL() const { return m_baseURL; } |
102 const String& charset() const { return m_charset; } | 102 const String& charset() const { return m_charset; } |
103 bool isHTMLDocument() const { return m_isHTMLDocument; } | 103 bool isHTMLDocument() const { return m_isHTMLDocument; } |
104 | 104 |
105 // This quirk is to maintain compatibility with Android apps built on | 105 // This quirk is to maintain compatibility with Android apps built on |
(...skipping 15 matching lines...) Expand all Loading... |
121 CSSParserMode m_mode; | 121 CSSParserMode m_mode; |
122 bool m_isHTMLDocument; | 122 bool m_isHTMLDocument; |
123 bool m_useLegacyBackgroundSizeShorthandBehavior; | 123 bool m_useLegacyBackgroundSizeShorthandBehavior; |
124 }; | 124 }; |
125 | 125 |
126 const CSSParserContext& strictCSSParserContext(); | 126 const CSSParserContext& strictCSSParserContext(); |
127 | 127 |
128 }; | 128 }; |
129 | 129 |
130 #endif // CSSParserMode_h | 130 #endif // CSSParserMode_h |
OLD | NEW |