Changeset 84517 in webkit
- Timestamp:
- Apr 21, 2011 10:37:47 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r84516 r84517 1 2011-04-20 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Reviewed by Kent Tamura. 4 5 REGRESSION (r75543): Styles bleed into new shadow DOM (like slider and video) 6 https://bugs.webkit.org/show_bug.cgi?id=52917 7 8 * fast/css/shadow-dom-scope-expected.txt: Added. 9 * fast/css/shadow-dom-scope.html: Added. 10 1 11 2011-04-21 Levi Weintraub <leviw@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r84516 r84517 1 2011-04-20 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Reviewed by Kent Tamura. 4 5 REGRESSION (r75543): Styles bleed into new shadow DOM (like slider and video) 6 https://bugs.webkit.org/show_bug.cgi?id=52917 7 8 In order to determine whether a rule should apply inside of a shadow DOM subtree, 9 we collect three pieces of information: 10 11 1) Are we parsing UA sheets? 12 2) Does the current tree scope allows applying author sheets? 13 3) Does the rule explicitly reach into shadow DOM (using pseudo-elements, for example)? 14 15 If the answer to all of these is no, we ignore the rule. 16 17 Test: fast/css/shadow-dom-scope.html 18 19 * css/CSSStyleSelector.cpp: 20 (WebCore::MatchingUARulesScope::MatchingUARulesScope): Added a scope helper to 21 track whether we are currently matching UA rules. 22 (WebCore::CSSStyleSelector::matchRulesForList): Added the check for three 23 conditions mentioned above. 24 (WebCore::CSSStyleSelector::SelectorChecker::SelectorChecker): Added 25 initializer for the flag, which helps us determine whether the rule 26 explicitly reaches into shadow DOM. 27 (WebCore::CSSStyleSelector::matchUARules): Started using the scope helper. 28 (WebCore::CSSStyleSelector::checkSelector): Added initializing of the 29 flag. 30 (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Added setting 31 of the flag when we encounter unknown pseudo-elements. 32 * css/CSSStyleSelector.h: Adjusted decls. 33 * dom/ShadowRoot.cpp: 34 (WebCore::ShadowRoot::applyAuthorSheets): Added. 35 * dom/ShadowRoot.h: Adjusted decls. 36 * dom/TreeScope.cpp: 37 (WebCore::TreeScope::applyAuthorSheets): Added. 38 * dom/TreeScope.h: Adjusted decls. 39 1 40 2011-04-21 Levi Weintraub <leviw@chromium.org> 2 41 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r84380 r84517 747 747 } 748 748 749 class MatchingUARulesScope { 750 public: 751 MatchingUARulesScope(); 752 ~MatchingUARulesScope(); 753 754 static bool isMatchingUARules(); 755 756 private: 757 static bool m_matchingUARules; 758 }; 759 760 MatchingUARulesScope::MatchingUARulesScope() 761 { 762 ASSERT(!m_matchingUARules); 763 m_matchingUARules = true; 764 } 765 766 MatchingUARulesScope::~MatchingUARulesScope() 767 { 768 m_matchingUARules = false; 769 } 770 771 inline bool MatchingUARulesScope::isMatchingUARules() 772 { 773 return m_matchingUARules; 774 } 775 776 bool MatchingUARulesScope::m_matchingUARules = false; 777 778 inline static bool matchesInTreeScope(TreeScope* treeScope, bool ruleReachesIntoShadowDOM) 779 { 780 return MatchingUARulesScope::isMatchingUARules() || treeScope->applyAuthorSheets() || ruleReachesIntoShadowDOM; 781 } 782 749 783 void CSSStyleSelector::matchRulesForList(const Vector<RuleData>* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules) 750 784 { … … 761 795 continue; 762 796 if (checkSelector(ruleData)) { 797 if (!matchesInTreeScope(m_element->treeScope(), m_checker.m_hasUnknownPseudoElements)) 798 continue; 763 799 // If the rule has no properties to apply, then ignore it in the non-debug mode. 764 800 CSSStyleRule* rule = ruleData.rule(); … … 882 918 , m_pseudoStyle(NOPSEUDO) 883 919 , m_documentIsHTML(document->isHTMLDocument()) 920 , m_hasUnknownPseudoElements(false) 884 921 , m_matchVisitedPseudoClass(false) 885 922 { … … 1169 1206 void CSSStyleSelector::matchUARules(int& firstUARule, int& lastUARule) 1170 1207 { 1208 MatchingUARulesScope scope; 1209 1171 1210 // First we match rules from the user agent sheet. 1172 1211 RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific("print") … … 2042 2081 { 2043 2082 m_dynamicPseudo = NOPSEUDO; 2083 m_checker.m_hasUnknownPseudoElements = false; 2044 2084 2045 2085 // Let the slow path handle SVG as it has some additional rules regarding shadow trees. … … 2939 2979 if (!elementStyle && !m_collectRulesOnly) 2940 2980 return false; 2981 2982 if (sel->isUnknownPseudoElement()) 2983 m_hasUnknownPseudoElements = true; 2941 2984 2942 2985 PseudoId pseudoId = CSSSelector::pseudoId(sel->pseudoType()); -
trunk/Source/WebCore/css/CSSStyleSelector.h
r83241 r84517 276 276 PseudoId m_pseudoStyle; 277 277 bool m_documentIsHTML; 278 mutable bool m_hasUnknownPseudoElements; 278 279 mutable bool m_matchVisitedPseudoClass; 279 280 mutable HashSet<LinkHash, LinkHashHash> m_linksCheckedForVisitedState; -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r84511 r84517 122 122 } 123 123 124 bool ShadowRoot::applyAuthorSheets() const 125 { 126 return false; 124 127 } 128 129 } -
trunk/Source/WebCore/dom/ShadowRoot.h
r84511 r84517 52 52 virtual PassRefPtr<Node> cloneNode(bool deep); 53 53 virtual bool childTypeAllowed(NodeType) const; 54 virtual bool applyAuthorSheets() const; 54 55 55 56 ContainerNode* firstContentElement() const; -
trunk/Source/WebCore/dom/TreeScope.cpp
r84394 r84517 159 159 } 160 160 161 bool TreeScope::applyAuthorSheets() const 162 { 163 return true; 164 } 165 161 166 } // namespace WebCore 162 167 -
trunk/Source/WebCore/dom/TreeScope.h
r84394 r84517 66 66 Element* findAnchor(const String& name); 67 67 68 virtual bool applyAuthorSheets() const; 69 68 70 protected: 69 71 TreeScope(Document*);
Note: See TracChangeset
for help on using the changeset viewer.