OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
5 * All rights reserved. | 5 * All rights reserved. |
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 10 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
(...skipping 29 matching lines...) Expand all Loading... |
40 : m_mode(mode), | 40 : m_mode(mode), |
41 m_matchMode(mode), | 41 m_matchMode(mode), |
42 m_isHTMLDocument(false), | 42 m_isHTMLDocument(false), |
43 m_useLegacyBackgroundSizeShorthandBehavior(false), | 43 m_useLegacyBackgroundSizeShorthandBehavior(false), |
44 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), | 44 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), |
45 m_useCounter(useCounter) {} | 45 m_useCounter(useCounter) {} |
46 | 46 |
47 CSSParserContext::CSSParserContext(const Document& document, | 47 CSSParserContext::CSSParserContext(const Document& document, |
48 UseCounter* useCounter, | 48 UseCounter* useCounter, |
49 const KURL& baseURL, | 49 const KURL& baseURL, |
50 const String& charset) | 50 const String& charset, |
| 51 SelectorProfile profile) |
51 : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL), | 52 : m_baseURL(baseURL.isNull() ? document.baseURL() : baseURL), |
52 m_charset(charset), | 53 m_charset(charset), |
53 m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode), | 54 m_mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode), |
| 55 m_profile(profile), |
54 m_referrer(m_baseURL.strippedForUseAsReferrer(), | 56 m_referrer(m_baseURL.strippedForUseAsReferrer(), |
55 document.getReferrerPolicy()), | 57 document.getReferrerPolicy()), |
56 m_isHTMLDocument(document.isHTMLDocument()), | 58 m_isHTMLDocument(document.isHTMLDocument()), |
57 m_useLegacyBackgroundSizeShorthandBehavior( | 59 m_useLegacyBackgroundSizeShorthandBehavior( |
58 document.settings() | 60 document.settings() |
59 ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() | 61 ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() |
60 : false), | 62 : false), |
61 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), | 63 m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy), |
62 m_useCounter(useCounter) { | 64 m_useCounter(useCounter) { |
63 if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) | 65 if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) |
64 m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy; | 66 m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy; |
65 else | 67 else |
66 m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy; | 68 m_shouldCheckContentSecurityPolicy = CheckContentSecurityPolicy; |
67 | 69 |
68 if (HTMLImportsController* importsController = document.importsController()) | 70 if (HTMLImportsController* importsController = document.importsController()) |
69 m_matchMode = importsController->master()->inQuirksMode() | 71 m_matchMode = importsController->master()->inQuirksMode() |
70 ? HTMLQuirksMode | 72 ? HTMLQuirksMode |
71 : HTMLStandardMode; | 73 : HTMLStandardMode; |
72 else | 74 else |
73 m_matchMode = m_mode; | 75 m_matchMode = m_mode; |
74 } | 76 } |
75 | 77 |
76 CSSParserContext::CSSParserContext(const CSSParserContext& other, | 78 CSSParserContext::CSSParserContext(const CSSParserContext& other, |
77 UseCounter* useCounter) | 79 UseCounter* useCounter) |
78 : m_baseURL(other.m_baseURL), | 80 : m_baseURL(other.m_baseURL), |
79 m_charset(other.m_charset), | 81 m_charset(other.m_charset), |
80 m_mode(other.m_mode), | 82 m_mode(other.m_mode), |
81 m_matchMode(other.m_matchMode), | 83 m_matchMode(other.m_matchMode), |
| 84 m_profile(other.m_profile), |
82 m_referrer(other.m_referrer), | 85 m_referrer(other.m_referrer), |
83 m_isHTMLDocument(other.m_isHTMLDocument), | 86 m_isHTMLDocument(other.m_isHTMLDocument), |
84 m_useLegacyBackgroundSizeShorthandBehavior( | 87 m_useLegacyBackgroundSizeShorthandBehavior( |
85 other.m_useLegacyBackgroundSizeShorthandBehavior), | 88 other.m_useLegacyBackgroundSizeShorthandBehavior), |
86 m_shouldCheckContentSecurityPolicy( | 89 m_shouldCheckContentSecurityPolicy( |
87 other.m_shouldCheckContentSecurityPolicy), | 90 other.m_shouldCheckContentSecurityPolicy), |
88 m_useCounter(useCounter) {} | 91 m_useCounter(useCounter) {} |
89 | 92 |
90 bool CSSParserContext::operator==(const CSSParserContext& other) const { | 93 bool CSSParserContext::operator==(const CSSParserContext& other) const { |
91 return m_baseURL == other.m_baseURL && m_charset == other.m_charset && | 94 return m_baseURL == other.m_baseURL && m_charset == other.m_charset && |
92 m_mode == other.m_mode && m_matchMode == other.m_matchMode && | 95 m_mode == other.m_mode && m_matchMode == other.m_matchMode && |
| 96 m_profile == other.m_profile && |
93 m_isHTMLDocument == other.m_isHTMLDocument && | 97 m_isHTMLDocument == other.m_isHTMLDocument && |
94 m_useLegacyBackgroundSizeShorthandBehavior == | 98 m_useLegacyBackgroundSizeShorthandBehavior == |
95 other.m_useLegacyBackgroundSizeShorthandBehavior; | 99 other.m_useLegacyBackgroundSizeShorthandBehavior; |
96 } | 100 } |
97 | 101 |
98 const CSSParserContext& strictCSSParserContext() { | 102 const CSSParserContext& strictCSSParserContext() { |
99 DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, | 103 DEFINE_STATIC_LOCAL(CSSParserContext, strictContext, |
100 (HTMLStandardMode, nullptr)); | 104 (HTMLStandardMode, nullptr)); |
101 return strictContext; | 105 return strictContext; |
102 } | 106 } |
103 | 107 |
104 KURL CSSParserContext::completeURL(const String& url) const { | 108 KURL CSSParserContext::completeURL(const String& url) const { |
105 if (url.isNull()) | 109 if (url.isNull()) |
106 return KURL(); | 110 return KURL(); |
107 if (charset().isEmpty()) | 111 if (charset().isEmpty()) |
108 return KURL(baseURL(), url); | 112 return KURL(baseURL(), url); |
109 return KURL(baseURL(), url, charset()); | 113 return KURL(baseURL(), url, charset()); |
110 } | 114 } |
111 | 115 |
112 } // namespace blink | 116 } // namespace blink |
OLD | NEW |