Changeset 194762 in webkit
- Timestamp:
- Jan 8, 2016 1:06:10 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r194757 r194762 1 2016-01-07 Antti Koivisto <antti@apple.com> 2 3 Enable selector filtering for shadow trees 4 https://bugs.webkit.org/show_bug.cgi?id=152831 5 6 Reviewed by Simon Fraser. 7 8 Selector filtering doesn't currently work in shadow trees making style resolve for them slow. 9 This is because SelectorFilter is not in "consistent" state. 10 11 This patch moves SelectorFilter ownership from StyleResolver to TreeResolver and guarantees 12 it is always upadated consistently. It eliminates a bunch of now unnecessary consistency checks 13 and special cases. 14 15 * css/ElementRuleCollector.cpp: 16 (WebCore::ElementRuleCollector::ElementRuleCollector): 17 18 Assert for consistency instead of testing for it. 19 20 (WebCore::ElementRuleCollector::matchedResult): 21 (WebCore::ElementRuleCollector::collectMatchingRulesForList): 22 23 Selector filter can now be used if it exists. 24 25 * css/ElementRuleCollector.h: 26 (WebCore::ElementRuleCollector::ElementRuleCollector): Deleted. 27 * css/RuleSet.cpp: 28 (WebCore::RuleSet::addRule): 29 30 Disable selector filtering for custom shadow pseudo rules. They are resolved by shadow DOM resolver 31 but may contain components matching the normal DOM. 32 33 * css/RuleSet.h: 34 (WebCore::RuleData::descendantSelectorIdentifierHashes): 35 (WebCore::RuleData::disableSelectorFiltering): 36 (WebCore::RuleData::compilationStatus): 37 (WebCore::RuleData::compiledSelectorCodeRef): 38 * css/SelectorFilter.cpp: 39 (WebCore::collectElementIdentifierHashes): 40 (WebCore::SelectorFilter::parentStackIsConsistent): 41 42 New consistency conditions. This is now used for asserts only. 43 44 (WebCore::SelectorFilter::pushParentStackFrame): 45 (WebCore::SelectorFilter::popParentStackFrame): 46 47 Selector filter only filters the current tree context, replace parentOrShadowHostElement with parentElement. 48 49 (WebCore::SelectorFilter::setupParentStack): Deleted. 50 51 No longer needed. 52 53 (WebCore::SelectorFilter::pushParent): 54 55 Remove consistency check. These cases no longer happen. 56 57 * css/SelectorFilter.h: 58 (WebCore::SelectorFilter::popParent): 59 (WebCore::SelectorFilter::parentStackIsEmpty): 60 (WebCore::SelectorFilter::fastRejectSelector): 61 (WebCore::SelectorFilter::parentStackIsConsistent): Deleted. 62 * css/StyleInvalidationAnalysis.cpp: 63 (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): 64 (WebCore::StyleInvalidationAnalysis::invalidateStyle): 65 * css/StyleResolver.cpp: 66 (WebCore::StyleResolver::appendAuthorStyleSheets): 67 (WebCore::StyleResolver::addKeyframeStyle): 68 (WebCore::StyleResolver::initElement): 69 (WebCore::StyleResolver::State::initForStyleResolve): 70 71 We no longer owner the selector filter. Move it to State. 72 73 (WebCore::StyleResolver::styleSharingCandidateMatchesRuleSet): 74 (WebCore::isAtShadowBoundary): 75 (WebCore::StyleResolver::styleForElement): 76 (WebCore::StyleResolver::pseudoStyleForElement): 77 (WebCore::StyleResolver::pseudoStyleRulesForElement): 78 (WebCore::StyleResolver::pushParentElement): Deleted. 79 (WebCore::StyleResolver::popParentElement): Deleted. 80 81 No need for this logic. 82 83 * css/StyleResolver.h: 84 (WebCore::StyleResolver::ruleSets): 85 (WebCore::StyleResolver::mediaQueryEvaluator): 86 (WebCore::StyleResolver::State::document): 87 (WebCore::StyleResolver::State::setAuthorRollback): 88 (WebCore::StyleResolver::State::setUserRollback): 89 (WebCore::StyleResolver::State::selectorFilter): 90 (WebCore::StyleResolver::state): 91 (WebCore::checkRegionSelector): 92 (WebCore::StyleResolver::selectorFilter): Deleted. 93 (WebCore::StyleResolverParentPusher::StyleResolverParentPusher): Deleted. 94 (WebCore::StyleResolverParentPusher::push): Deleted. 95 (WebCore::StyleResolverParentPusher::~StyleResolverParentPusher): Deleted. 96 * style/StyleTreeResolver.cpp: 97 98 This now owns the selector filter for a tree context. 99 100 (WebCore::Style::SelectorFilterPusher::SelectorFilterPusher): 101 (WebCore::Style::SelectorFilterPusher::push): 102 (WebCore::Style::SelectorFilterPusher::~SelectorFilterPusher): 103 (WebCore::Style::TreeResolver::TreeResolver): 104 (WebCore::Style::TreeResolver::styleForElement): 105 (WebCore::Style::TreeResolver::createRenderTreeForSlotAssignees): 106 (WebCore::Style::TreeResolver::createRenderTreeRecursively): 107 (WebCore::Style::TreeResolver::resolveChildren): 108 (WebCore::Style::TreeResolver::resolveRecursively): 109 110 Push the filter in a few more places to keep it consistent in shadow trees. 111 112 * style/StyleTreeResolver.h: 113 1 114 2016-01-07 Zalan Bujtas <zalan@apple.com> 2 115 -
trunk/Source/WebCore/css/ElementRuleCollector.cpp
r190842 r194762 41 41 #include "SVGElement.h" 42 42 #include "SelectorCompiler.h" 43 #include "SelectorFilter.h" 43 44 #include "ShadowRoot.h" 44 45 #include "StyleProperties.h" … … 75 76 const bool includeEmptyRules; 76 77 }; 78 79 ElementRuleCollector::ElementRuleCollector(Element& element, RenderStyle* style, const DocumentRuleSets& ruleSets, const SelectorFilter* selectorFilter) 80 : m_element(element) 81 , m_style(style) 82 , m_ruleSets(ruleSets) 83 , m_selectorFilter(selectorFilter) 84 { 85 ASSERT(!m_selectorFilter || m_selectorFilter->parentStackIsConsistent(element.parentNode())); 86 } 77 87 78 88 StyleResolver::MatchResult& ElementRuleCollector::matchedResult() … … 353 363 continue; 354 364 355 if (m_ canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))365 if (m_selectorFilter && m_selectorFilter->fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes())) 356 366 continue; 357 367 -
trunk/Source/WebCore/css/ElementRuleCollector.h
r190842 r194762 46 46 class ElementRuleCollector { 47 47 public: 48 ElementRuleCollector(Element& element, RenderStyle* style, const DocumentRuleSets& ruleSets, const SelectorFilter& selectorFilter) 49 : m_element(element) 50 , m_style(style) 51 , m_ruleSets(ruleSets) 52 , m_selectorFilter(selectorFilter) 53 , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(element.parentNode())) 54 { 55 } 48 ElementRuleCollector(Element&, RenderStyle*, const DocumentRuleSets&, const SelectorFilter*); 56 49 57 50 void matchAllRules(bool matchAuthorAndUserStyles, bool includeSMILProperties); … … 95 88 RenderStyle* m_style; 96 89 const DocumentRuleSets& m_ruleSets; 97 const SelectorFilter &m_selectorFilter;90 const SelectorFilter* m_selectorFilter; 98 91 99 92 bool m_isPrintStyle { false }; … … 102 95 bool m_sameOriginOnly { false }; 103 96 SelectorChecker::Mode m_mode { SelectorChecker::Mode::ResolvingStyle }; 104 bool m_canUseFastReject;105 97 106 98 Vector<MatchedRule, 64> m_matchedRules; -
trunk/Source/WebCore/css/RuleSet.cpp
r194496 r194762 226 226 227 227 if (selector->isCustomPseudoElement()) { 228 // FIXME: Custom pseudo elements are handled by the shadow tree's selector filter. It doesn't know about the main DOM. 229 ruleData.disableSelectorFiltering(); 228 230 addToRuleSet(selector->value().impl(), m_shadowPseudoElementRules, ruleData); 229 231 return; -
trunk/Source/WebCore/css/RuleSet.h
r194496 r194762 84 84 static const unsigned maximumIdentifierCount = 4; 85 85 const unsigned* descendantSelectorIdentifierHashes() const { return m_descendantSelectorIdentifierHashes; } 86 87 void disableSelectorFiltering() { m_descendantSelectorIdentifierHashes[0] = 0; } 86 88 87 89 #if ENABLE(CSS_SELECTOR_JIT) -
trunk/Source/WebCore/css/SelectorFilter.cpp
r182321 r194762 31 31 32 32 #include "CSSSelector.h" 33 #include "ShadowRoot.h" 33 34 #include "StyledElement.h" 34 35 … … 54 55 } 55 56 57 bool SelectorFilter::parentStackIsConsistent(const ContainerNode* parentNode) const 58 { 59 if (!parentNode || is<Document>(parentNode) || is<ShadowRoot>(parentNode)) 60 return m_parentStack.isEmpty(); 61 62 return !m_parentStack.isEmpty() && m_parentStack.last().element == parentNode; 63 } 64 56 65 void SelectorFilter::pushParentStackFrame(Element* parent) 57 66 { 58 ASSERT(m_ancestorIdentifierFilter); 59 ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent->parentOrShadowHostElement()); 60 ASSERT(!m_parentStack.isEmpty() || !parent->parentOrShadowHostElement()); 67 ASSERT(m_parentStack.isEmpty() || m_parentStack.last().element == parent->parentElement()); 68 ASSERT(!m_parentStack.isEmpty() || !parent->parentElement()); 61 69 m_parentStack.append(ParentStackFrame(parent)); 62 70 ParentStackFrame& parentFrame = m_parentStack.last(); … … 66 74 size_t count = parentFrame.identifierHashes.size(); 67 75 for (size_t i = 0; i < count; ++i) 68 m_ancestorIdentifierFilter ->add(parentFrame.identifierHashes[i]);76 m_ancestorIdentifierFilter.add(parentFrame.identifierHashes[i]); 69 77 } 70 78 … … 72 80 { 73 81 ASSERT(!m_parentStack.isEmpty()); 74 ASSERT(m_ancestorIdentifierFilter);75 82 const ParentStackFrame& parentFrame = m_parentStack.last(); 76 83 size_t count = parentFrame.identifierHashes.size(); 77 84 for (size_t i = 0; i < count; ++i) 78 m_ancestorIdentifierFilter ->remove(parentFrame.identifierHashes[i]);85 m_ancestorIdentifierFilter.remove(parentFrame.identifierHashes[i]); 79 86 m_parentStack.removeLast(); 80 87 if (m_parentStack.isEmpty()) { 81 ASSERT(m_ancestorIdentifierFilter ->likelyEmpty());82 m_ancestorIdentifierFilter = nullptr;88 ASSERT(m_ancestorIdentifierFilter.likelyEmpty()); 89 m_ancestorIdentifierFilter.clear(); 83 90 } 84 }85 86 void SelectorFilter::setupParentStack(Element* parent)87 {88 ASSERT(m_parentStack.isEmpty() == !m_ancestorIdentifierFilter);89 // Kill whatever we stored before.90 m_parentStack.shrink(0);91 m_ancestorIdentifierFilter = std::make_unique<CountingBloomFilter<bloomFilterKeyBits>>();92 // Fast version if parent is a root element:93 if (!parent->parentNode() && !parent->isShadowRoot()) {94 pushParentStackFrame(parent);95 return;96 }97 // Otherwise climb up the tree.98 Vector<Element*, 30> ancestors;99 for (Element* ancestor = parent; ancestor; ancestor = ancestor->parentOrShadowHostElement())100 ancestors.append(ancestor);101 for (size_t n = ancestors.size(); n; --n)102 pushParentStackFrame(ancestors[n - 1]);103 91 } 104 92 105 93 void SelectorFilter::pushParent(Element* parent) 106 94 { 107 ASSERT(m_ancestorIdentifierFilter);108 // We may get invoked for some random elements in some wacky cases during style resolve.109 // Pause maintaining the stack in this case.110 if (m_parentStack.last().element != parent->parentOrShadowHostElement())111 return;112 95 pushParentStackFrame(parent); 113 96 } -
trunk/Source/WebCore/css/SelectorFilter.h
r182321 r194762 44 44 void popParentStackFrame(); 45 45 46 void setupParentStack(Element* parent);47 46 void pushParent(Element* parent); 48 47 void popParent() { popParentStackFrame(); } 49 48 bool parentStackIsEmpty() const { return m_parentStack.isEmpty(); } 50 bool parentStackIsConsistent(const ContainerNode* parentNode) const { return !m_parentStack.isEmpty() && m_parentStack.last().element == parentNode; }49 bool parentStackIsConsistent(const ContainerNode* parentNode) const; 51 50 52 51 template <unsigned maximumIdentifierCount> … … 65 64 // With 100 unique strings in the filter, 2^12 slot table has false positive rate of ~0.2%. 66 65 static const unsigned bloomFilterKeyBits = 12; 67 std::unique_ptr<CountingBloomFilter<bloomFilterKeyBits>> m_ancestorIdentifierFilter;66 CountingBloomFilter<bloomFilterKeyBits> m_ancestorIdentifierFilter; 68 67 }; 69 68 … … 71 70 inline bool SelectorFilter::fastRejectSelector(const unsigned* identifierHashes) const 72 71 { 73 ASSERT(m_ancestorIdentifierFilter);74 72 for (unsigned n = 0; n < maximumIdentifierCount && identifierHashes[n]; ++n) { 75 if (!m_ancestorIdentifierFilter ->mayContain(identifierHashes[n]))73 if (!m_ancestorIdentifierFilter.mayContain(identifierHashes[n])) 76 74 return true; 77 75 } -
trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp
r191871 r194762 98 98 switch (element.styleChangeType()) { 99 99 case NoStyleChange: { 100 ElementRuleCollector ruleCollector(element, nullptr, m_ruleSets, filter);100 ElementRuleCollector ruleCollector(element, nullptr, m_ruleSets, &filter); 101 101 ruleCollector.setMode(SelectorChecker::Mode::CollectingRulesIgnoringVirtualPseudoElements); 102 102 ruleCollector.matchAuthorRules(false); … … 146 146 it.traverseNextSkippingChildren(); 147 147 } 148 149 while (!parentStack.isEmpty()) {150 parentStack.removeLast();151 filter.popParent();152 }153 148 } 154 149 … … 164 159 165 160 SelectorFilter filter; 166 filter.setupParentStack(documentElement);167 161 invalidateStyleForTree(*documentElement, filter); 168 162 } -
trunk/Source/WebCore/css/StyleResolver.cpp
r194496 r194762 294 294 } 295 295 296 void StyleResolver::pushParentElement(Element* parent)297 {298 const ContainerNode* parentsParent = parent->parentOrShadowHostElement();299 300 // We are not always invoked consistently. For example, script execution can cause us to enter301 // style recalc in the middle of tree building. We may also be invoked from somewhere within the tree.302 // Reset the stack in this case, or if we see a new root element.303 // Otherwise just push the new parent.304 if (!parentsParent || m_selectorFilter.parentStackIsEmpty())305 m_selectorFilter.setupParentStack(parent);306 else307 m_selectorFilter.pushParent(parent);308 }309 310 void StyleResolver::popParentElement(Element* parent)311 {312 // Note that we may get invoked for some random elements in some wacky cases during style resolve.313 // Pause maintaining the stack in this case.314 if (m_selectorFilter.parentStackIsConsistent(parent))315 m_selectorFilter.popParent();316 }317 318 296 // This is a simplified style setting function for keyframe styles 319 297 void StyleResolver::addKeyframeStyle(PassRefPtr<StyleRuleKeyframes> rule) … … 388 366 } 389 367 390 inline void StyleResolver::State::initForStyleResolve(Document& document, Element* e, RenderStyle* parentStyle, const RenderRegion* regionForStyling )368 inline void StyleResolver::State::initForStyleResolve(Document& document, Element* e, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter) 391 369 { 392 370 m_regionForStyling = regionForStyling; … … 408 386 m_authorRollback = nullptr; 409 387 m_userRollback = nullptr; 388 389 m_selectorFilter = selectorFilter; 410 390 411 391 updateConversionData(); … … 476 456 return false; 477 457 478 ElementRuleCollector collector(*m_state.element(), m_state.style(), m_ruleSets, m_s electorFilter);458 ElementRuleCollector collector(*m_state.element(), m_state.style(), m_ruleSets, m_state.selectorFilter()); 479 459 return collector.hasAnyMatchingRules(ruleSet); 480 460 } … … 724 704 725 705 Ref<RenderStyle> StyleResolver::styleForElement(Element* element, RenderStyle* defaultParent, 726 StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling )706 StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter) 727 707 { 728 708 RELEASE_ASSERT(!m_inLoadPendingImages); … … 742 722 State& state = m_state; 743 723 initElement(element); 744 state.initForStyleResolve(document(), element, defaultParent, regionForStyling); 724 state.initForStyleResolve(document(), element, defaultParent, regionForStyling, selectorFilter); 725 745 726 if (sharingBehavior == AllowStyleSharing) { 746 727 if (RenderStyle* sharedStyle = locateSharedStyle()) { … … 774 755 m_ruleSets.collectFeatures(); 775 756 776 ElementRuleCollector collector(*element, state.style(), m_ruleSets, m_s electorFilter);757 ElementRuleCollector collector(*element, state.style(), m_ruleSets, m_state.selectorFilter()); 777 758 collector.setRegionForStyling(regionForStyling); 778 759 collector.setMedium(m_medium.get()); … … 940 921 941 922 // Check UA, user and author rules. 942 ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_s electorFilter);923 ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_state.selectorFilter()); 943 924 collector.setPseudoStyleRequest(pseudoStyleRequest); 944 925 collector.setMedium(m_medium.get()); … … 1419 1400 m_state.initForStyleResolve(document(), element, nullptr); 1420 1401 1421 ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_s electorFilter);1402 ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_state.selectorFilter()); 1422 1403 collector.setMode(SelectorChecker::Mode::CollectingRules); 1423 1404 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); -
trunk/Source/WebCore/css/StyleResolver.h
r194496 r194762 36 36 #include "ScrollTypes.h" 37 37 #include "SelectorChecker.h" 38 #include "SelectorFilter.h"39 38 #include "StyleInheritedData.h" 40 39 #include "ViewportStyleResolver.h" … … 77 76 class RuleData; 78 77 class RuleSet; 78 class SelectorFilter; 79 79 class Settings; 80 80 class StyleImage; … … 136 136 ~StyleResolver(); 137 137 138 // Using these during tree walk will allow style selector to optimize child and descendant selector lookups.139 void pushParentElement(Element*);140 void popParentElement(Element*);141 142 138 Ref<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing, 143 RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr );139 RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr); 144 140 145 141 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&); … … 161 157 DocumentRuleSets& ruleSets() { return m_ruleSets; } 162 158 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } 163 SelectorFilter& selectorFilter() { return m_selectorFilter; }164 159 165 160 const MediaQueryEvaluator& mediaQueryEvaluator() const { return *m_medium; } … … 386 381 public: 387 382 void initElement(Element*); 388 void initForStyleResolve(Document&, Element*, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr );383 void initForStyleResolve(Document&, Element*, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr); 389 384 void clear(); 390 385 … … 444 439 void setAuthorRollback(std::unique_ptr<CascadedProperties>& rollback) { m_authorRollback = WTFMove(rollback); } 445 440 void setUserRollback(std::unique_ptr<CascadedProperties>& rollback) { m_userRollback = WTFMove(rollback); } 441 442 const SelectorFilter* selectorFilter() const { return m_selectorFilter; } 446 443 447 444 private: … … 481 478 std::unique_ptr<CascadedProperties> m_authorRollback; 482 479 std::unique_ptr<CascadedProperties> m_userRollback; 480 481 const SelectorFilter* m_selectorFilter { nullptr }; 483 482 }; 484 483 … … 560 559 561 560 Document& m_document; 562 SelectorFilter m_selectorFilter;563 561 564 562 bool m_matchAuthorAndUserStyles; … … 619 617 } 620 618 621 class StyleResolverParentPusher {622 public:623 StyleResolverParentPusher(Element* parent)624 : m_parent(parent)625 , m_pushedStyleResolver(nullptr)626 { }627 void push()628 {629 if (m_pushedStyleResolver)630 return;631 m_pushedStyleResolver = &m_parent->styleResolver();632 m_pushedStyleResolver->pushParentElement(m_parent);633 }634 ~StyleResolverParentPusher()635 {636 if (!m_pushedStyleResolver)637 return;638 // This tells us that our pushed style selector is in a bad state,639 // so we should just bail out in that scenario.640 ASSERT(m_pushedStyleResolver == &m_parent->styleResolver());641 m_pushedStyleResolver->popParentElement(m_parent);642 }643 644 private:645 Element* m_parent;646 StyleResolver* m_pushedStyleResolver;647 };648 649 619 } // namespace WebCore 650 620 -
trunk/Source/WebCore/style/StyleTreeResolver.cpp
r194691 r194762 67 67 static void resolveTextNode(Text&, RenderTreePosition&); 68 68 69 class SelectorFilterPusher { 70 public: 71 enum PushMode { Push, NoPush }; 72 SelectorFilterPusher(SelectorFilter& selectorFilter, Element& parent, PushMode pushMode = Push) 73 : m_selectorFilter(selectorFilter) 74 , m_parent(parent) 75 { 76 if (pushMode == Push) 77 push(); 78 } 79 void push() 80 { 81 if (m_didPush) 82 return; 83 m_didPush = true; 84 m_selectorFilter.pushParent(&m_parent); 85 } 86 ~SelectorFilterPusher() 87 { 88 if (!m_didPush) 89 return; 90 m_selectorFilter.popParent(); 91 } 92 93 private: 94 SelectorFilter& m_selectorFilter; 95 Element& m_parent; 96 bool m_didPush { false }; 97 }; 98 69 99 TreeResolver::TreeResolver(Document& document) 70 100 : m_document(document) … … 98 128 return style.releaseNonNull(); 99 129 } 100 return m_styleResolver.styleForElement(&element, &inheritedStyle );130 return m_styleResolver.styleForElement(&element, &inheritedStyle, AllowStyleSharing, MatchAllRules, nullptr, &m_selectorFilter); 101 131 } 102 132 … … 411 441 m_shadowHostTreeResolver->createRenderTreeRecursively(downcast<Element>(*child), inheritedStyle, renderTreePosition, nullptr); 412 442 } 413 } else 443 } else { 444 SelectorFilterPusher selectorFilterPusher(m_selectorFilter, slot); 414 445 createRenderTreeForChildren(slot, inheritedStyle, renderTreePosition); 446 } 415 447 416 448 slot.clearNeedsStyleRecalc(); … … 437 469 438 470 if (auto* renderer = current.renderer()) { 439 S tyleResolverParentPusher parentPusher(¤t);471 SelectorFilterPusher selectorFilterPusher(m_selectorFilter, current, SelectorFilterPusher::NoPush); 440 472 441 473 RenderTreePosition childRenderTreePosition(*renderer); … … 443 475 444 476 auto* shadowRoot = current.shadowRoot(); 445 if (shadowRoot) 477 if (shadowRoot) { 478 selectorFilterPusher.push(); 446 479 createRenderTreeForShadowRoot(*shadowRoot); 447 else if (current.firstChild())448 parentPusher.push();480 } else if (current.firstChild()) 481 selectorFilterPusher.push(); 449 482 450 483 bool skipChildren = shadowRoot; … … 731 764 void TreeResolver::resolveChildren(Element& current, RenderStyle& inheritedStyle, Change change, RenderTreePosition& childRenderTreePosition) 732 765 { 733 S tyleResolverParentPusher parentPusher(¤t);766 SelectorFilterPusher selectorFilterPusher(m_selectorFilter, current, SelectorFilterPusher::NoPush); 734 767 735 768 bool elementNeedingStyleRecalcAffectsNextSiblingElementStyle = false; … … 752 785 elementNeedingStyleRecalcAffectsNextSiblingElementStyle = childElement.affectsNextSiblingElementStyle(); 753 786 if (change >= Inherit || childElement.childNeedsStyleRecalc() || childElement.needsStyleRecalc()) { 754 parentPusher.push();787 selectorFilterPusher.push(); 755 788 resolveRecursively(childElement, inheritedStyle, childRenderTreePosition, change); 756 789 } … … 804 837 auto* shadowRoot = current.shadowRoot(); 805 838 if (shadowRoot && (change >= Inherit || shadowRoot->childNeedsStyleRecalc() || shadowRoot->needsStyleRecalc())) { 839 SelectorFilterPusher selectorFilterPusher(m_selectorFilter, current); 840 806 841 TreeResolver shadowTreeResolver(*shadowRoot, *this); 807 842 shadowTreeResolver.resolveShadowTree(change, renderer->style()); -
trunk/Source/WebCore/style/StyleTreeResolver.h
r194691 r194762 28 28 29 29 #include "RenderStyleConstants.h" 30 #include "SelectorFilter.h" 30 31 #include "StyleChange.h" 31 32 #include <functional> … … 83 84 ShadowRoot* m_shadowRoot { nullptr }; 84 85 TreeResolver* m_shadowHostTreeResolver { nullptr }; 86 87 SelectorFilter m_selectorFilter; 85 88 }; 86 89
Note: See TracChangeset
for help on using the changeset viewer.