OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSParserContext.h" | 5 #include "core/css/parser/CSSParserContext.h" |
6 | 6 |
7 #include "core/css/CSSStyleSheet.h" | 7 #include "core/css/CSSStyleSheet.h" |
8 #include "core/css/StyleSheetContents.h" | 8 #include "core/css/StyleSheetContents.h" |
9 #include "core/frame/Deprecation.h" | 9 #include "core/frame/Deprecation.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // static | 25 // static |
26 CSSParserContext* CSSParserContext::createWithStyleSheetContents( | 26 CSSParserContext* CSSParserContext::createWithStyleSheetContents( |
27 const CSSParserContext* other, | 27 const CSSParserContext* other, |
28 const StyleSheetContents* styleSheetContents) { | 28 const StyleSheetContents* styleSheetContents) { |
29 return CSSParserContext::create( | 29 return CSSParserContext::create( |
30 other, StyleSheetContents::singleOwnerDocument(styleSheetContents)); | 30 other, StyleSheetContents::singleOwnerDocument(styleSheetContents)); |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 CSSParserContext* CSSParserContext::create(const CSSParserContext* other, | 34 CSSParserContext* CSSParserContext::create(const CSSParserContext* other, |
35 const Document* m_document) { | 35 const Document* useCounterDocument) { |
dcheng
2017/03/22 21:09:59
Personally I'd just call it document if we're goin
| |
36 return new CSSParserContext( | 36 return new CSSParserContext( |
37 other->m_baseURL, other->m_charset, other->m_mode, other->m_matchMode, | 37 other->m_baseURL, other->m_charset, other->m_mode, other->m_matchMode, |
38 other->m_profile, other->m_referrer, other->m_isHTMLDocument, | 38 other->m_profile, other->m_referrer, other->m_isHTMLDocument, |
39 other->m_useLegacyBackgroundSizeShorthandBehavior, | 39 other->m_useLegacyBackgroundSizeShorthandBehavior, |
40 other->m_shouldCheckContentSecurityPolicy, m_document); | 40 other->m_shouldCheckContentSecurityPolicy, useCounterDocument); |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 CSSParserContext* CSSParserContext::create(CSSParserMode mode, | 44 CSSParserContext* CSSParserContext::create(CSSParserMode mode, |
45 SelectorProfile profile, | 45 SelectorProfile profile, |
46 const Document* m_document) { | 46 const Document* useCounterDocument) { |
47 return new CSSParserContext(KURL(), emptyString, mode, mode, profile, | 47 return new CSSParserContext( |
48 Referrer(), false, false, | 48 KURL(), emptyString, mode, mode, profile, Referrer(), false, false, |
49 DoNotCheckContentSecurityPolicy, m_document); | 49 DoNotCheckContentSecurityPolicy, useCounterDocument); |
50 } | 50 } |
51 | 51 |
52 // static | 52 // static |
53 CSSParserContext* CSSParserContext::create(const Document& document, | 53 CSSParserContext* CSSParserContext::create(const Document& document, |
54 const Document* m_document) { | 54 const Document* useCounterDocument) { |
jochen (gone - plz use gerrit)
2017/03/22 21:10:47
this would collide here...
| |
55 return CSSParserContext::create(document, KURL(), emptyString, DynamicProfile, | 55 return CSSParserContext::create(document, KURL(), emptyString, DynamicProfile, |
56 m_document); | 56 useCounterDocument); |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 CSSParserContext* CSSParserContext::create(const Document& document, | 60 CSSParserContext* CSSParserContext::create(const Document& document, |
61 const KURL& baseURLOverride, | 61 const KURL& baseURLOverride, |
62 const String& charset, | 62 const String& charset, |
63 SelectorProfile profile, | 63 SelectorProfile profile, |
64 const Document* m_document) { | 64 const Document* useCounterDocument) { |
65 const KURL baseURL = | 65 const KURL baseURL = |
66 baseURLOverride.isNull() ? document.baseURL() : baseURLOverride; | 66 baseURLOverride.isNull() ? document.baseURL() : baseURLOverride; |
67 | 67 |
68 CSSParserMode mode = | 68 CSSParserMode mode = |
69 document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode; | 69 document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode; |
70 CSSParserMode matchMode; | 70 CSSParserMode matchMode; |
71 if (HTMLImportsController* importsController = document.importsController()) { | 71 if (HTMLImportsController* importsController = document.importsController()) { |
72 matchMode = importsController->master()->inQuirksMode() ? HTMLQuirksMode | 72 matchMode = importsController->master()->inQuirksMode() ? HTMLQuirksMode |
73 : HTMLStandardMode; | 73 : HTMLStandardMode; |
74 } else { | 74 } else { |
(...skipping 10 matching lines...) Expand all Loading... | |
85 | 85 |
86 ContentSecurityPolicyDisposition policyDisposition; | 86 ContentSecurityPolicyDisposition policyDisposition; |
87 if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) | 87 if (ContentSecurityPolicy::shouldBypassMainWorld(&document)) |
88 policyDisposition = DoNotCheckContentSecurityPolicy; | 88 policyDisposition = DoNotCheckContentSecurityPolicy; |
89 else | 89 else |
90 policyDisposition = CheckContentSecurityPolicy; | 90 policyDisposition = CheckContentSecurityPolicy; |
91 | 91 |
92 return new CSSParserContext(baseURL, charset, mode, matchMode, profile, | 92 return new CSSParserContext(baseURL, charset, mode, matchMode, profile, |
93 referrer, document.isHTMLDocument(), | 93 referrer, document.isHTMLDocument(), |
94 useLegacyBackgroundSizeShorthandBehavior, | 94 useLegacyBackgroundSizeShorthandBehavior, |
95 policyDisposition, m_document); | 95 policyDisposition, useCounterDocument); |
96 } | 96 } |
97 | 97 |
98 CSSParserContext::CSSParserContext( | 98 CSSParserContext::CSSParserContext( |
99 const KURL& baseURL, | 99 const KURL& baseURL, |
100 const String& charset, | 100 const String& charset, |
101 CSSParserMode mode, | 101 CSSParserMode mode, |
102 CSSParserMode matchMode, | 102 CSSParserMode matchMode, |
103 SelectorProfile profile, | 103 SelectorProfile profile, |
104 const Referrer& referrer, | 104 const Referrer& referrer, |
105 bool isHTMLDocument, | 105 bool isHTMLDocument, |
106 bool useLegacyBackgroundSizeShorthandBehavior, | 106 bool useLegacyBackgroundSizeShorthandBehavior, |
107 ContentSecurityPolicyDisposition policyDisposition, | 107 ContentSecurityPolicyDisposition policyDisposition, |
108 const Document* m_document) | 108 const Document* useCounterDocument) |
109 : m_baseURL(baseURL), | 109 : m_baseURL(baseURL), |
110 m_charset(charset), | 110 m_charset(charset), |
111 m_mode(mode), | 111 m_mode(mode), |
112 m_matchMode(matchMode), | 112 m_matchMode(matchMode), |
113 m_profile(profile), | 113 m_profile(profile), |
114 m_referrer(referrer), | 114 m_referrer(referrer), |
115 m_isHTMLDocument(isHTMLDocument), | 115 m_isHTMLDocument(isHTMLDocument), |
116 m_useLegacyBackgroundSizeShorthandBehavior( | 116 m_useLegacyBackgroundSizeShorthandBehavior( |
117 useLegacyBackgroundSizeShorthandBehavior), | 117 useLegacyBackgroundSizeShorthandBehavior), |
118 m_shouldCheckContentSecurityPolicy(policyDisposition), | 118 m_shouldCheckContentSecurityPolicy(policyDisposition), |
119 m_document(m_document) {} | 119 m_document(useCounterDocument) {} |
120 | 120 |
121 bool CSSParserContext::operator==(const CSSParserContext& other) const { | 121 bool CSSParserContext::operator==(const CSSParserContext& other) const { |
122 return m_baseURL == other.m_baseURL && m_charset == other.m_charset && | 122 return m_baseURL == other.m_baseURL && m_charset == other.m_charset && |
123 m_mode == other.m_mode && m_matchMode == other.m_matchMode && | 123 m_mode == other.m_mode && m_matchMode == other.m_matchMode && |
124 m_profile == other.m_profile && | 124 m_profile == other.m_profile && |
125 m_isHTMLDocument == other.m_isHTMLDocument && | 125 m_isHTMLDocument == other.m_isHTMLDocument && |
126 m_useLegacyBackgroundSizeShorthandBehavior == | 126 m_useLegacyBackgroundSizeShorthandBehavior == |
127 other.m_useLegacyBackgroundSizeShorthandBehavior; | 127 other.m_useLegacyBackgroundSizeShorthandBehavior; |
128 } | 128 } |
129 | 129 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 | 161 |
162 bool CSSParserContext::isDocumentHandleEqual(const Document* other) const { | 162 bool CSSParserContext::isDocumentHandleEqual(const Document* other) const { |
163 return m_document.get() == other; | 163 return m_document.get() == other; |
164 } | 164 } |
165 | 165 |
166 DEFINE_TRACE(CSSParserContext) { | 166 DEFINE_TRACE(CSSParserContext) { |
167 visitor->trace(m_document); | 167 visitor->trace(m_document); |
168 } | 168 } |
169 | 169 |
170 } // namespace blink | 170 } // namespace blink |
OLD | NEW |