| 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 21 matching lines...) Expand all Loading... |
| 32 #define CSSParserMode_h | 32 #define CSSParserMode_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/fetch/ResourceLoaderOptions.h" | 35 #include "core/fetch/ResourceLoaderOptions.h" |
| 36 #include "platform/weborigin/KURL.h" | 36 #include "platform/weborigin/KURL.h" |
| 37 #include "platform/weborigin/Referrer.h" | 37 #include "platform/weborigin/Referrer.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class Document; | 41 class Document; |
| 42 class LocalFrame; |
| 42 | 43 |
| 43 // Must not grow beyond 3 bits, due to packing in StylePropertySet. | 44 // Must not grow beyond 3 bits, due to packing in StylePropertySet. |
| 44 enum CSSParserMode { | 45 enum CSSParserMode { |
| 45 HTMLStandardMode, | 46 HTMLStandardMode, |
| 46 HTMLQuirksMode, | 47 HTMLQuirksMode, |
| 47 // HTML attributes are parsed in quirks mode but also allows internal proper
ties and values. | 48 // HTML attributes are parsed in quirks mode but also allows internal proper
ties and values. |
| 48 HTMLAttributeMode, | 49 HTMLAttributeMode, |
| 49 // SVG attributes are parsed in quirks mode but rules differ slightly. | 50 // SVG attributes are parsed in quirks mode but rules differ slightly. |
| 50 SVGAttributeMode, | 51 SVGAttributeMode, |
| 51 // @viewport rules are parsed in standards mode but CSSOM modifications (via
StylePropertySet) | 52 // @viewport rules are parsed in standards mode but CSSOM modifications (via
StylePropertySet) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 86 |
| 86 class CORE_EXPORT CSSParserContext { | 87 class CORE_EXPORT CSSParserContext { |
| 87 WTF_MAKE_FAST_ALLOCATED(CSSParserContext); | 88 WTF_MAKE_FAST_ALLOCATED(CSSParserContext); |
| 88 public: | 89 public: |
| 89 CSSParserContext(CSSParserMode, UseCounter*); | 90 CSSParserContext(CSSParserMode, UseCounter*); |
| 90 // FIXME: We shouldn't need the UseCounter argument as we could infer it fro
m the Document | 91 // FIXME: We shouldn't need the UseCounter argument as we could infer it fro
m the Document |
| 91 // but some callers want to disable use counting (e.g. the WebInspector). | 92 // but some callers want to disable use counting (e.g. the WebInspector). |
| 92 CSSParserContext(const Document&, UseCounter*, const KURL& baseURL = KURL(),
const String& charset = emptyString()); | 93 CSSParserContext(const Document&, UseCounter*, const KURL& baseURL = KURL(),
const String& charset = emptyString()); |
| 93 // FIXME: This constructor shouldn't exist if we properly piped the UseCount
er through the CSS | 94 // FIXME: This constructor shouldn't exist if we properly piped the UseCount
er through the CSS |
| 94 // subsystem. Currently the UseCounter life time is too crazy and we need a
way to override it. | 95 // subsystem. Currently the UseCounter life time is too crazy and we need a
way to override it. |
| 95 CSSParserContext(const CSSParserContext&, UseCounter*); | 96 CSSParserContext(const CSSParserContext&, LocalFrame*, UseCounter*); |
| 97 ~CSSParserContext(); |
| 96 | 98 |
| 97 bool operator==(const CSSParserContext&) const; | 99 bool operator==(const CSSParserContext&) const; |
| 98 bool operator!=(const CSSParserContext& other) const { return !(*this == oth
er); } | 100 bool operator!=(const CSSParserContext& other) const { return !(*this == oth
er); } |
| 99 | 101 |
| 100 CSSParserMode mode() const { return m_mode; } | 102 CSSParserMode mode() const { return m_mode; } |
| 101 const KURL& baseURL() const { return m_baseURL; } | 103 const KURL& baseURL() const { return m_baseURL; } |
| 102 const String& charset() const { return m_charset; } | 104 const String& charset() const { return m_charset; } |
| 103 const Referrer& referrer() const { return m_referrer; } | 105 const Referrer& referrer() const { return m_referrer; } |
| 104 bool isHTMLDocument() const { return m_isHTMLDocument; } | 106 bool isHTMLDocument() const { return m_isHTMLDocument; } |
| 105 | 107 |
| 106 // This quirk is to maintain compatibility with Android apps built on | 108 // This quirk is to maintain compatibility with Android apps built on |
| 107 // the Android SDK prior to and including version 18. Presumably, this | 109 // the Android SDK prior to and including version 18. Presumably, this |
| 108 // can be removed any time after 2015. See http://crbug.com/277157. | 110 // can be removed any time after 2015. See http://crbug.com/277157. |
| 109 bool useLegacyBackgroundSizeShorthandBehavior() const { return m_useLegacyBa
ckgroundSizeShorthandBehavior; } | 111 bool useLegacyBackgroundSizeShorthandBehavior() const { return m_useLegacyBa
ckgroundSizeShorthandBehavior; } |
| 110 | 112 |
| 111 // FIXME: These setters shouldn't exist, however the current lifetime of CSS
ParserContext | 113 // FIXME: These setters shouldn't exist, however the current lifetime of CSS
ParserContext |
| 112 // is not well understood and thus we sometimes need to override these field
s. | 114 // is not well understood and thus we sometimes need to override these field
s. |
| 113 void setMode(CSSParserMode mode) { m_mode = mode; } | 115 void setMode(CSSParserMode mode) { m_mode = mode; } |
| 114 void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; } | 116 void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; } |
| 115 void setCharset(const String& charset) { m_charset = charset; } | 117 void setCharset(const String& charset) { m_charset = charset; } |
| 116 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } | 118 void setReferrer(const Referrer& referrer) { m_referrer = referrer; } |
| 117 | 119 |
| 118 KURL completeURL(const String& url) const; | 120 KURL completeURL(const String& url) const; |
| 119 | 121 |
| 122 LocalFrame* frame() const { return m_frame.get(); } // may be null |
| 120 UseCounter* useCounter() const { return m_useCounter; } | 123 UseCounter* useCounter() const { return m_useCounter; } |
| 121 | 124 |
| 122 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy() const {
return m_shouldCheckContentSecurityPolicy; } | 125 ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy() const {
return m_shouldCheckContentSecurityPolicy; } |
| 123 | 126 |
| 124 private: | 127 private: |
| 125 KURL m_baseURL; | 128 KURL m_baseURL; |
| 126 String m_charset; | 129 String m_charset; |
| 127 CSSParserMode m_mode; | 130 CSSParserMode m_mode; |
| 128 Referrer m_referrer; | 131 Referrer m_referrer; |
| 129 bool m_isHTMLDocument; | 132 bool m_isHTMLDocument; |
| 130 bool m_useLegacyBackgroundSizeShorthandBehavior; | 133 bool m_useLegacyBackgroundSizeShorthandBehavior; |
| 131 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; | 134 ContentSecurityPolicyDisposition m_shouldCheckContentSecurityPolicy; |
| 132 | 135 |
| 136 RefPtrWillBePersistent<LocalFrame> m_frame; |
| 133 UseCounter* m_useCounter; | 137 UseCounter* m_useCounter; |
| 134 }; | 138 }; |
| 135 | 139 |
| 136 CORE_EXPORT const CSSParserContext& strictCSSParserContext(); | 140 CORE_EXPORT const CSSParserContext& strictCSSParserContext(); |
| 137 | 141 |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 #endif // CSSParserMode_h | 144 #endif // CSSParserMode_h |
| OLD | NEW |