Changeset 225650 in webkit
- Timestamp:
- Dec 7, 2017 3:58:39 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r225649 r225650 1 2017-12-07 Antti Koivisto <antti@apple.com> 2 3 Move security origin filtering for getMatchedCSSRules out of StyleResolver 4 https://bugs.webkit.org/show_bug.cgi?id=180468 5 6 Reviewed by Zalan Bujtas. 7 8 The non-standard getMatchedCSSRules API should not return rules from stylesheets in different security origins. 9 To implement this we currently have lots of invasive code in StyleResolver, RuleSets and ElementRuleCollector 10 basically passing around a bit. This also makes RuleSets document specific blocking optimizations. 11 12 This patches replaces the mechanism with a bit in StyleRule which is much simpler. 13 14 * css/DocumentRuleSets.cpp: 15 (WebCore::makeRuleSet): 16 * css/ElementRuleCollector.cpp: 17 (WebCore::ElementRuleCollector::collectMatchingRulesForList): 18 * css/ElementRuleCollector.h: 19 (WebCore::ElementRuleCollector::setPseudoStyleRequest): 20 (WebCore::ElementRuleCollector::setSameOriginOnly): Deleted. 21 * css/RuleFeature.cpp: 22 (WebCore::RuleFeatureSet::collectFeatures): 23 * css/RuleFeature.h: 24 (WebCore::RuleFeature::RuleFeature): 25 * css/RuleSet.cpp: 26 (WebCore::RuleData::RuleData): 27 (WebCore::RuleSet::addRule): 28 (WebCore::RuleSet::addChildRules): 29 (WebCore::RuleSet::addRulesFromSheet): 30 (WebCore::RuleSet::addStyleRule): 31 * css/RuleSet.h: 32 (WebCore::RuleData::linkMatchType const): 33 (WebCore::RuleData::hasDocumentSecurityOrigin const): Deleted. 34 * css/StyleResolver.cpp: 35 (WebCore::StyleResolver::pseudoStyleRulesForElement): 36 * css/StyleResolver.h: 37 * css/StyleRule.cpp: 38 (WebCore::StyleRule::StyleRule): 39 (WebCore::StyleRule::createForSplitting): 40 (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const): 41 (WebCore::StyleRule::create): Deleted. 42 * css/StyleRule.h: 43 (WebCore::StyleRuleBase::StyleRuleBase): 44 (WebCore::StyleRuleBase::hasDocumentSecurityOrigin const): 45 46 Add a bit. 47 48 * css/parser/CSSParser.cpp: 49 (WebCore::CSSParserContext::CSSParserContext): 50 51 Include hasDocumentSecurityOrigin bit to parser context. This means that a stylesheet data structures 52 can't be shared between a contexts where this differs. This likely very rare in practice. 53 54 (WebCore::operator==): 55 * css/parser/CSSParserImpl.cpp: 56 (WebCore::CSSParserImpl::consumeStyleRule): 57 * css/parser/CSSParserMode.h: 58 (WebCore::CSSParserContextHash::hash): 59 * editing/EditingStyle.cpp: 60 (WebCore::EditingStyle::mergeStyleFromRules): 61 * page/DOMWindow.cpp: 62 (WebCore::DOMWindow::getMatchedCSSRules const): 63 64 Filter out rules from different security origin after getting them from style resolver. 65 1 66 2017-12-07 Zalan Bujtas <zalan@apple.com> 2 67 -
trunk/Source/WebCore/css/DocumentRuleSets.cpp
r224495 r225650 115 115 auto ruleSet = std::make_unique<RuleSet>(); 116 116 for (size_t i = 0; i < size; ++i) 117 ruleSet->addRule(rules[i].rule, rules[i].selectorIndex , rules[i].hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState);117 ruleSet->addRule(rules[i].rule, rules[i].selectorIndex); 118 118 ruleSet->shrinkToFit(); 119 119 return ruleSet; -
trunk/Source/WebCore/css/ElementRuleCollector.cpp
r225482 r225650 477 477 continue; 478 478 479 // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.480 if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())481 continue;482 483 479 unsigned specificity; 484 480 if (ruleMatches(ruleData, specificity)) -
trunk/Source/WebCore/css/ElementRuleCollector.h
r224495 r225650 55 55 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } 56 56 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyleRequest = request; } 57 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; }58 57 void setMedium(const MediaQueryEvaluator* medium) { m_isPrintStyle = medium->mediaTypeMatchSpecific("print"); } 59 58 … … 98 97 bool m_isPrintStyle { false }; 99 98 PseudoStyleRequest m_pseudoStyleRequest { NOPSEUDO }; 100 bool m_sameOriginOnly { false };101 99 SelectorChecker::Mode m_mode { SelectorChecker::Mode::ResolvingStyle }; 102 100 bool m_isMatchingSlottedPseudoElements { false }; -
trunk/Source/WebCore/css/RuleFeature.cpp
r214255 r225650 97 97 recursivelyCollectFeaturesFromSelector(selectorFeatures, *ruleData.selector()); 98 98 if (selectorFeatures.hasSiblingSelector) 99 siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex() , ruleData.hasDocumentSecurityOrigin()));99 siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex())); 100 100 if (ruleData.containsUncommonAttributeSelector()) 101 uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex() , ruleData.hasDocumentSecurityOrigin()));101 uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex())); 102 102 for (auto& className : selectorFeatures.classesMatchingAncestors) { 103 103 auto addResult = ancestorClassRules.ensure(className, [] { 104 104 return std::make_unique<Vector<RuleFeature>>(); 105 105 }); 106 addResult.iterator->value->append(RuleFeature(ruleData.rule(), ruleData.selectorIndex() , ruleData.hasDocumentSecurityOrigin()));106 addResult.iterator->value->append(RuleFeature(ruleData.rule(), ruleData.selectorIndex())); 107 107 } 108 108 for (auto* selector : selectorFeatures.attributeSelectorsMatchingAncestors) { … … 112 112 }); 113 113 auto& rules = *addResult.iterator->value; 114 rules.features.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex() , ruleData.hasDocumentSecurityOrigin()));114 rules.features.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex())); 115 115 // Deduplicate selectors. 116 116 rules.selectors.add(makeAttributeSelectorKey(*selector), selector); -
trunk/Source/WebCore/css/RuleFeature.h
r214255 r225650 35 35 36 36 struct RuleFeature { 37 RuleFeature(StyleRule* rule, unsigned selectorIndex , bool hasDocumentSecurityOrigin)37 RuleFeature(StyleRule* rule, unsigned selectorIndex) 38 38 : rule(rule) 39 39 , selectorIndex(selectorIndex) 40 , hasDocumentSecurityOrigin(hasDocumentSecurityOrigin) 41 { 40 { 42 41 } 43 42 StyleRule* rule; 44 43 unsigned selectorIndex; 45 bool hasDocumentSecurityOrigin;46 44 }; 47 45 -
trunk/Source/WebCore/css/RuleSet.cpp
r225596 r225650 149 149 } 150 150 151 RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position , AddRuleFlags addRuleFlags)151 RuleData::RuleData(StyleRule* rule, unsigned selectorIndex, unsigned position) 152 152 : m_rule(rule) 153 153 , m_selectorIndex(selectorIndex) 154 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin)155 154 , m_position(position) 156 155 , m_matchBasedOnRuleHash(static_cast<unsigned>(computeMatchBasedOnRuleHash(*selector()))) … … 203 202 } 204 203 205 void RuleSet::addRule(StyleRule* rule, unsigned selectorIndex , AddRuleFlags addRuleFlags)206 { 207 RuleData ruleData(rule, selectorIndex, m_ruleCount++ , addRuleFlags);204 void RuleSet::addRule(StyleRule* rule, unsigned selectorIndex) 205 { 206 RuleData ruleData(rule, selectorIndex, m_ruleCount++); 208 207 m_features.collectFeatures(ruleData); 209 208 … … 361 360 } 362 361 363 void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase>>& rules, const MediaQueryEvaluator& medium, StyleResolver* resolver, bool hasDocumentSecurityOrigin, bool isInitiatingElementInUserAgentShadowTree, AddRuleFlags addRuleFlags)362 void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase>>& rules, const MediaQueryEvaluator& medium, StyleResolver* resolver, bool isInitiatingElementInUserAgentShadowTree) 364 363 { 365 364 for (auto& rule : rules) { 366 365 if (is<StyleRule>(*rule)) 367 addStyleRule(downcast<StyleRule>(rule.get()) , addRuleFlags);366 addStyleRule(downcast<StyleRule>(rule.get())); 368 367 else if (is<StyleRulePage>(*rule)) 369 368 addPageRule(downcast<StyleRulePage>(rule.get())); … … 371 370 auto& mediaRule = downcast<StyleRuleMedia>(*rule); 372 371 if ((!mediaRule.mediaQueries() || medium.evaluate(*mediaRule.mediaQueries(), resolver))) 373 addChildRules(mediaRule.childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);372 addChildRules(mediaRule.childRules(), medium, resolver, isInitiatingElementInUserAgentShadowTree); 374 373 } else if (is<StyleRuleFontFace>(*rule) && resolver) { 375 374 // Add this font face to our set. … … 379 378 resolver->addKeyframeStyle(downcast<StyleRuleKeyframes>(*rule)); 380 379 else if (is<StyleRuleSupports>(*rule) && downcast<StyleRuleSupports>(*rule).conditionIsSupported()) 381 addChildRules(downcast<StyleRuleSupports>(*rule).childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);380 addChildRules(downcast<StyleRuleSupports>(*rule).childRules(), medium, resolver, isInitiatingElementInUserAgentShadowTree); 382 381 #if ENABLE(CSS_DEVICE_ADAPTATION) 383 382 else if (is<StyleRuleViewport>(*rule) && resolver) { … … 395 394 } 396 395 397 bool hasDocumentSecurityOrigin = resolver && resolver->document().securityOrigin().canRequest(sheet.baseURL());398 AddRuleFlags addRuleFlags = static_cast<AddRuleFlags>((hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : 0));399 400 396 // FIXME: Skip Content Security Policy check when stylesheet is in a user agent shadow tree. 401 397 // See <https://bugs.webkit.org/show_bug.cgi?id=146663>. 402 398 bool isInitiatingElementInUserAgentShadowTree = false; 403 addChildRules(sheet.childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);399 addChildRules(sheet.childRules(), medium, resolver, isInitiatingElementInUserAgentShadowTree); 404 400 405 401 if (m_autoShrinkToFitEnabled) … … 407 403 } 408 404 409 void RuleSet::addStyleRule(StyleRule* rule , AddRuleFlags addRuleFlags)405 void RuleSet::addStyleRule(StyleRule* rule) 410 406 { 411 407 for (size_t selectorIndex = 0; selectorIndex != notFound; selectorIndex = rule->selectorList().indexOfNextSelectorAfter(selectorIndex)) 412 addRule(rule, selectorIndex , addRuleFlags);408 addRule(rule, selectorIndex); 413 409 } 414 410 -
trunk/Source/WebCore/css/RuleSet.h
r225482 r225650 33 33 namespace WebCore { 34 34 35 enum AddRuleFlags {36 RuleHasNoSpecialState = 0,37 RuleHasDocumentSecurityOrigin = 1,38 };39 40 35 enum PropertyWhitelistType { 41 36 PropertyWhitelistNone = 0, … … 65 60 static const unsigned maximumSelectorComponentCount = 8192; 66 61 67 RuleData(StyleRule*, unsigned selectorIndex, unsigned position , AddRuleFlags);62 RuleData(StyleRule*, unsigned selectorIndex, unsigned position); 68 63 69 64 unsigned position() const { return m_position; } … … 76 71 bool containsUncommonAttributeSelector() const { return m_containsUncommonAttributeSelector; } 77 72 unsigned linkMatchType() const { return m_linkMatchType; } 78 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; }79 73 PropertyWhitelistType propertyWhitelistType() const { return static_cast<PropertyWhitelistType>(m_propertyWhitelistType); } 80 74 const SelectorFilter::Hashes& descendantSelectorIdentifierHashes() const { return m_descendantSelectorIdentifierHashes; } … … 103 97 RefPtr<StyleRule> m_rule; 104 98 unsigned m_selectorIndex : 13; 105 unsigned m_hasDocumentSecurityOrigin : 1;106 99 // This number was picked fairly arbitrarily. We can probably lower it if we need to. 107 100 // Some simple testing showed <100,000 RuleData's on large sites. … … 159 152 void addRulesFromSheet(StyleSheetContents&, const MediaQueryEvaluator&, StyleResolver* = 0); 160 153 161 void addStyleRule(StyleRule* , AddRuleFlags);162 void addRule(StyleRule*, unsigned selectorIndex , AddRuleFlags);154 void addStyleRule(StyleRule*); 155 void addRule(StyleRule*, unsigned selectorIndex); 163 156 void addPageRule(StyleRulePage*); 164 157 void addToRuleSet(const AtomicString& key, AtomRuleMap&, const RuleData&); … … 189 182 190 183 private: 191 void addChildRules(const Vector<RefPtr<StyleRuleBase>>&, const MediaQueryEvaluator& medium, StyleResolver*, bool hasDocumentSecurityOrigin, bool isInitiatingElementInUserAgentShadowTree, AddRuleFlags);184 void addChildRules(const Vector<RefPtr<StyleRuleBase>>&, const MediaQueryEvaluator& medium, StyleResolver*, bool isInitiatingElementInUserAgentShadowTree); 192 185 193 186 AtomRuleMap m_idRules; -
trunk/Source/WebCore/css/StyleResolver.cpp
r225641 r225650 1133 1133 } 1134 1134 1135 if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) { 1136 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); 1137 1138 // Check the rules in author sheets. 1135 if (m_matchAuthorAndUserStyles && (rulesToInclude & AuthorCSSRules)) 1139 1136 collector.matchAuthorRules(rulesToInclude & EmptyCSSRules); 1140 }1141 1137 1142 1138 return collector.matchedRuleList(); -
trunk/Source/WebCore/css/StyleResolver.h
r225485 r225650 168 168 AuthorCSSRules = 1 << 2, 169 169 EmptyCSSRules = 1 << 3, 170 CrossOriginCSSRules = 1 << 4, 171 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCSSRules, 170 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules, 172 171 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, 173 172 }; -
trunk/Source/WebCore/css/StyleRule.cpp
r223728 r225650 182 182 } 183 183 184 StyleRule::StyleRule(Ref<StylePropertiesBase>&& properties )185 : StyleRuleBase(Style )184 StyleRule::StyleRule(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin) 185 : StyleRuleBase(Style, hasDocumentSecurityOrigin) 186 186 , m_properties(WTFMove(properties)) 187 187 { … … 211 211 } 212 212 213 Ref<StyleRule> StyleRule::create (const Vector<const CSSSelector*>& selectors, Ref<StyleProperties>&& properties)213 Ref<StyleRule> StyleRule::createForSplitting(const Vector<const CSSSelector*>& selectors, Ref<StyleProperties>&& properties, bool hasDocumentSecurityOrigin) 214 214 { 215 215 ASSERT_WITH_SECURITY_IMPLICATION(!selectors.isEmpty()); … … 218 218 new (NotNull, &selectorListArray[i]) CSSSelector(*selectors.at(i)); 219 219 selectorListArray[selectors.size() - 1].setLastInSelectorList(); 220 auto rule = StyleRule::create(WTFMove(properties) );220 auto rule = StyleRule::create(WTFMove(properties), hasDocumentSecurityOrigin); 221 221 rule.get().parserAdoptSelectorArray(selectorListArray); 222 222 return rule; … … 236 236 237 237 if (componentsInThisSelector.size() + componentsSinceLastSplit.size() > maxCount && !componentsSinceLastSplit.isEmpty()) { 238 rules.append(create (componentsSinceLastSplit, const_cast<StyleProperties&>(properties())));238 rules.append(createForSplitting(componentsSinceLastSplit, const_cast<StyleProperties&>(properties()), hasDocumentSecurityOrigin())); 239 239 componentsSinceLastSplit.clear(); 240 240 } … … 244 244 245 245 if (!componentsSinceLastSplit.isEmpty()) 246 rules.append(create (componentsSinceLastSplit, const_cast<StyleProperties&>(properties())));246 rules.append(createForSplitting(componentsSinceLastSplit, const_cast<StyleProperties&>(properties()), hasDocumentSecurityOrigin())); 247 247 248 248 return rules; -
trunk/Source/WebCore/css/StyleRule.h
r223728 r225650 87 87 88 88 protected: 89 StyleRuleBase(Type type )89 StyleRuleBase(Type type, bool hasDocumentSecurityOrigin = false) 90 90 : m_type(type) 91 { } 91 , m_hasDocumentSecurityOrigin(hasDocumentSecurityOrigin) 92 { 93 } 92 94 93 95 StyleRuleBase(const StyleRuleBase& o) 94 96 : WTF::RefCountedBase() 95 97 , m_type(o.m_type) 96 { } 98 , m_hasDocumentSecurityOrigin(o.m_hasDocumentSecurityOrigin) 99 { 100 } 97 101 98 102 ~StyleRuleBase() = default; 99 103 104 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; } 105 100 106 private: 101 107 WEBCORE_EXPORT void destroy(); … … 104 110 105 111 unsigned m_type : 5; 112 // This is only needed to support getMatchedCSSRules. 113 unsigned m_hasDocumentSecurityOrigin : 1; 106 114 }; 107 115 … … 109 117 WTF_MAKE_FAST_ALLOCATED; 110 118 public: 111 static Ref<StyleRule> create(Ref<StylePropertiesBase>&& properties )112 { 113 return adoptRef(*new StyleRule(WTFMove(properties) ));119 static Ref<StyleRule> create(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin) 120 { 121 return adoptRef(*new StyleRule(WTFMove(properties), hasDocumentSecurityOrigin)); 114 122 } 115 123 … … 122 130 const StyleProperties* propertiesWithoutDeferredParsing() const; 123 131 132 using StyleRuleBase::hasDocumentSecurityOrigin; 133 124 134 void parserAdoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectors) { m_selectorList.adoptSelectorVector(selectors); } 125 135 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList = WTFMove(selectors); } … … 133 143 134 144 private: 135 StyleRule(Ref<StylePropertiesBase>&& );145 StyleRule(Ref<StylePropertiesBase>&&, bool hasDocumentSecurityOrigin); 136 146 StyleRule(const StyleRule&); 137 147 138 static Ref<StyleRule> create (const Vector<const CSSSelector*>&, Ref<StyleProperties>&&);148 static Ref<StyleRule> createForSplitting(const Vector<const CSSSelector*>&, Ref<StyleProperties>&&, bool hasDocumentSecurityOrigin); 139 149 140 150 mutable Ref<StylePropertiesBase> m_properties; -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r224165 r225650 73 73 } 74 74 75 CSSParserContext::CSSParserContext(Document& document, const URL& baseURL, const String& charset)76 : baseURL( baseURL.isNull() ? document.baseURL() : baseURL)75 CSSParserContext::CSSParserContext(Document& document, const URL& sheetBaseURL, const String& charset) 76 : baseURL(sheetBaseURL.isNull() ? document.baseURL() : sheetBaseURL) 77 77 , charset(charset) 78 78 , mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode) 79 79 , isHTMLDocument(document.isHTMLDocument()) 80 80 , cssGridLayoutEnabled(document.isCSSGridLayoutEnabled()) 81 , hasDocumentSecurityOrigin(document.securityOrigin().canRequest(baseURL)) 81 82 { 82 83 needsSiteSpecificQuirks = document.settings().needsSiteSpecificQuirks(); … … 112 113 && a.constantPropertiesEnabled == b.constantPropertiesEnabled 113 114 && a.conicGradientsEnabled == b.conicGradientsEnabled 114 && a.deferredCSSParserEnabled == b.deferredCSSParserEnabled; 115 && a.deferredCSSParserEnabled == b.deferredCSSParserEnabled 116 && a.hasDocumentSecurityOrigin == b.hasDocumentSecurityOrigin; 115 117 } 116 118 -
trunk/Source/WebCore/css/parser/CSSParserImpl.cpp
r222259 r225650 739 739 blockCopy.consumeWhitespace(); 740 740 if (!blockCopy.atEnd()) { 741 rule = StyleRule::create(createDeferredStyleProperties(block) );741 rule = StyleRule::create(createDeferredStyleProperties(block), m_context.hasDocumentSecurityOrigin); 742 742 rule->wrapperAdoptSelectorList(selectorList); 743 743 return rule; … … 746 746 747 747 consumeDeclarationList(block, StyleRule::Style); 748 rule = StyleRule::create(createStyleProperties(m_parsedProperties, m_context.mode) );748 rule = StyleRule::create(createStyleProperties(m_parsedProperties, m_context.mode), m_context.hasDocumentSecurityOrigin); 749 749 rule->wrapperAdoptSelectorList(selectorList); 750 750 return rule; -
trunk/Source/WebCore/css/parser/CSSParserMode.h
r224165 r225650 108 108 bool conicGradientsEnabled { false }; 109 109 bool deferredCSSParserEnabled { false }; 110 // This is only needed to support getMatchedCSSRules. 111 bool hasDocumentSecurityOrigin { false }; 110 112 111 113 URL completeURL(const String& url) const … … 142 144 & key.conicGradientsEnabled << 8 143 145 & key.deferredCSSParserEnabled << 9 144 & key.mode << 10; 146 & key.hasDocumentSecurityOrigin << 10 147 & key.mode << 11; 145 148 hash ^= WTF::intHash(bits); 146 149 return hash; -
trunk/Source/WebCore/editing/EditingStyle.cpp
r224649 r225650 1270 1270 { 1271 1271 RefPtr<MutableStyleProperties> styleFromMatchedRules = styleFromMatchedRulesForElement(element, 1272 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules);1272 StyleResolver::AuthorCSSRules); 1273 1273 // Styles from the inline style declaration, held in the variable "style", take precedence 1274 1274 // over those from matched rules. -
trunk/Source/WebCore/page/DOMWindow.cpp
r225142 r225650 1483 1483 if (!authorOnly) 1484 1484 rulesToInclude |= StyleResolver::UAAndUserCSSRules; 1485 if (m_frame->settings().crossOriginCheckInGetMatchedCSSRulesDisabled())1486 rulesToInclude |= StyleResolver::CrossOriginCSSRules;1487 1485 1488 1486 PseudoId pseudoId = CSSSelector::pseudoId(pseudoType); … … 1492 1490 return nullptr; 1493 1491 1492 bool allowCrossOrigin = m_frame->settings().crossOriginCheckInGetMatchedCSSRulesDisabled(); 1493 1494 1494 RefPtr<StaticCSSRuleList> ruleList = StaticCSSRuleList::create(); 1495 for (auto& rule : matchedRules) 1495 for (auto& rule : matchedRules) { 1496 if (!allowCrossOrigin && !rule->hasDocumentSecurityOrigin()) 1497 continue; 1496 1498 ruleList->rules().append(rule->createCSSOMWrapper()); 1499 } 1500 1501 if (ruleList->rules().isEmpty()) 1502 return nullptr; 1497 1503 1498 1504 return ruleList;
Note: See TracChangeset
for help on using the changeset viewer.