Changeset 105280 in webkit
- Timestamp:
- Jan 18, 2012 8:57:16 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r105278 r105280 1 2012-01-18 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSSRegions]Fix region style code in CSSStyleSelector 4 https://bugs.webkit.org/show_bug.cgi?id=76453 5 6 Reviewed by Antti Koivisto. 7 8 Fix the test as it was not taking into account the selector specificity. 9 * fast/regions/region-style-block-background-color.html: 10 1 11 2012-01-18 Csaba Osztrogonác <ossy@webkit.org> 2 12 -
trunk/LayoutTests/fast/regions/region-style-block-background-color.html
r102234 r105280 45 45 #region72 { -webkit-flow-from: flow7; } 46 46 #p7 { background-color: green; } 47 @-webkit-region #region71 { p{ background-color: transparent; } }47 @-webkit-region #region71 { #p7 { background-color: transparent; } } 48 48 </style> 49 49 </head> -
trunk/Source/WebCore/ChangeLog
r105279 r105280 1 2012-01-18 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSSRegions]Fix region style code in CSSStyleSelector 4 https://bugs.webkit.org/show_bug.cgi?id=76453 5 6 Reviewed by Antti Koivisto. 7 8 Follow up after comments in https://bugs.webkit.org/show_bug.cgi?id=76064. 9 With the new approach, the css rule specificity is correctly taken into account 10 when applying the region style rule. 11 No new tests, the region style tests are still disabled. 12 13 * css/CSSStyleSelector.cpp: 14 (WebCore::RuleSet::RuleSetSelectorPair::RuleSetSelectorPair): 15 (WebCore::CSSStyleSelector::CSSStyleSelector): 16 (WebCore::CSSStyleSelector::addMatchedDeclaration): 17 (WebCore::CSSStyleSelector::collectMatchingRules): 18 (WebCore::CSSStyleSelector::collectMatchingRulesForRegion): 19 (WebCore::CSSStyleSelector::matchRules): 20 (WebCore::CSSStyleSelector::collectMatchingRulesForList): 21 (WebCore::CSSStyleSelector::matchAllRules): 22 (WebCore::CSSStyleSelector::styleForElement): 23 (WebCore::CSSStyleSelector::pseudoStyleForElement): 24 (WebCore::CSSStyleSelector::checkRegionStyle): 25 (WebCore::CSSStyleSelector::checkRegionSelector): 26 (WebCore::RuleData::RuleData): 27 (WebCore::RuleSet::RuleSet): 28 (WebCore::RuleSet::addRule): 29 (WebCore::RuleSet::addRegionRule): 30 (WebCore::RuleSet::addRulesFromSheet): 31 (WebCore::isInsideRegionRule): 32 (WebCore::CSSStyleSelector::applyDeclaration): 33 (WebCore::CSSStyleSelector::applyDeclarations): 34 (WebCore::CSSStyleSelector::isValidRegionStyleProperty): 35 (WebCore::CSSStyleSelector::applyProperty): 36 * css/CSSStyleSelector.h: 37 1 38 2012-01-17 Jer Noble <jer.noble@apple.com> 2 39 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r105276 r105280 173 173 class RuleData { 174 174 public: 175 RuleData(CSSStyleRule*, CSSSelector*, unsigned position , ERegionStyleEnabled useInRegionStyle = DoNotUseInRegionStyle);175 RuleData(CSSStyleRule*, CSSSelector*, unsigned position); 176 176 177 177 unsigned position() const { return m_position; } … … 185 185 unsigned specificity() const { return m_specificity; } 186 186 unsigned linkMatchType() const { return m_linkMatchType; } 187 ERegionStyleEnabled useInRegionStyle() const { return static_cast<ERegionStyleEnabled>(m_useInRegionStyle); }188 187 189 188 // Try to balance between memory usage (there can be lots of RuleData objects) and good filtering performance. … … 197 196 // This number was picked fairly arbitrarily. We can probably lower it if we need to. 198 197 // Some simple testing showed <100,000 RuleData's on large sites. 199 unsigned m_position : 2 5;198 unsigned m_position : 26; 200 199 unsigned m_hasFastCheckableSelector : 1; 201 200 unsigned m_hasMultipartSelector : 1; … … 203 202 unsigned m_containsUncommonAttributeSelector : 1; 204 203 unsigned m_linkMatchType : 2; // SelectorChecker::LinkMatchMask 205 unsigned m_useInRegionStyle : 1; // ERegionStyleEnabled206 204 // Use plain array instead of a Vector to minimize memory overhead. 207 205 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; … … 221 219 WTF_MAKE_NONCOPYABLE(RuleSet); 222 220 public: 223 RuleSet( ERegionStyleEnabled useInRegionStyle = DoNotUseInRegionStyle);221 RuleSet(); 224 222 225 223 typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<RuleData> > > AtomRuleMap; … … 231 229 void addPageRule(CSSPageRule*); 232 230 void addToRuleSet(AtomicStringImpl* key, AtomRuleMap&, const RuleData&); 231 void addRegionRule(WebKitCSSRegionRule*); 233 232 void shrinkToFit(); 234 233 void disableAutoShrinkToFit() { m_autoShrinkToFitEnabled = false; } … … 256 255 unsigned m_ruleCount; 257 256 bool m_autoShrinkToFitEnabled; 258 ERegionStyleEnabled m_useInRegionStyle;259 260 257 CSSStyleSelector::Features m_features; 258 259 struct RuleSetSelectorPair { 260 RuleSetSelectorPair(CSSSelector* selector, RuleSet* ruleSet) : selector(selector), ruleSet(adoptPtr(ruleSet)) { } 261 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selector), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } 262 CSSSelector* selector; 263 OwnPtr<RuleSet> ruleSet; 264 }; 265 266 Vector<RuleSetSelectorPair> m_regionSelectorsAndRuleSets; 261 267 }; 262 268 … … 328 334 , m_applyPropertyToRegularStyle(true) 329 335 , m_applyPropertyToVisitedLinkStyle(false) 330 , m_applyPropertyToRegionStyle(false)331 336 , m_applyProperty(CSSStyleApplyProperty::sharedCSSStyleApplyProperty()) 332 337 #if ENABLE(CSS_SHADERS) … … 441 446 if (document()->renderer() && document()->renderer()->style()) 442 447 document()->renderer()->style()->font().update(fontSelector()); 443 }444 445 void CSSStyleSelector::addRegionRule(PassRefPtr<WebKitCSSRegionRule> regionStyleRule)446 {447 m_regionStyleRules.append(regionStyleRule);448 448 } 449 449 … … 635 635 } 636 636 637 void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType , ERegionStyleEnabled useInRegionStyle)637 void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType) 638 638 { 639 639 m_matchedDecls.grow(m_matchedDecls.size() + 1); … … 641 641 newDeclaration.styleDeclaration = styleDeclaration; 642 642 newDeclaration.linkMatchType = linkMatchType; 643 newDeclaration.useInRegionStyle = useInRegionStyle; 644 } 645 646 void CSSStyleSelector::matchRules(RuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules) 647 { 648 m_matchedRules.clear(); 649 650 if (!rules || !m_element) 651 return; 643 } 644 645 void CSSStyleSelector::collectMatchingRules(RuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules) 646 { 647 ASSERT(rules); 648 ASSERT(m_element); 652 649 653 650 // We need to collect the rules for id, class, tag, and everything else into a buffer and 654 651 // then sort the buffer. 655 652 if (m_element->hasID()) 656 matchRulesForList(rules->idRules(m_element->idForStyleResolution().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);653 collectMatchingRulesForList(rules->idRules(m_element->idForStyleResolution().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 657 654 if (m_element->hasClass()) { 658 655 ASSERT(m_styledElement); … … 660 657 size_t size = classNames.size(); 661 658 for (size_t i = 0; i < size; ++i) 662 matchRulesForList(rules->classRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);659 collectMatchingRulesForList(rules->classRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 663 660 } 664 661 const AtomicString& pseudoId = m_element->shadowPseudoId(); 665 662 if (!pseudoId.isEmpty()) { 666 663 ASSERT(m_styledElement); 667 matchRulesForList(rules->shadowPseudoElementRules(pseudoId.impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);664 collectMatchingRulesForList(rules->shadowPseudoElementRules(pseudoId.impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 668 665 } 669 666 if (m_element->isLink()) 670 matchRulesForList(rules->linkPseudoClassRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules);667 collectMatchingRulesForList(rules->linkPseudoClassRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules); 671 668 if (m_checker.matchesFocusPseudoClass(m_element)) 672 matchRulesForList(rules->focusPseudoClassRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules); 673 matchRulesForList(rules->tagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 674 matchRulesForList(rules->universalRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules); 669 collectMatchingRulesForList(rules->focusPseudoClassRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules); 670 collectMatchingRulesForList(rules->tagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules); 671 collectMatchingRulesForList(rules->universalRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules); 672 } 673 674 void CSSStyleSelector::collectMatchingRulesForRegion(RuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules) 675 { 676 if (!m_regionForStyling) 677 return; 678 679 unsigned size = rules->m_regionSelectorsAndRuleSets.size(); 680 for (unsigned i = 0; i < size; ++i) { 681 CSSSelector* regionSelector = rules->m_regionSelectorsAndRuleSets.at(i).selector; 682 if (checkRegionSelector(regionSelector, static_cast<Element*>(m_regionForStyling->node()))) { 683 RuleSet* regionRules = rules->m_regionSelectorsAndRuleSets.at(i).ruleSet.get(); 684 ASSERT(regionRules); 685 collectMatchingRules(regionRules, firstRuleIndex, lastRuleIndex, includeEmptyRules); 686 } 687 } 688 } 689 690 void CSSStyleSelector::matchRules(RuleSet* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules) 691 { 692 m_matchedRules.clear(); 693 694 if (!rules || !m_element) 695 return; 696 697 collectMatchingRules(rules, firstRuleIndex, lastRuleIndex, includeEmptyRules); 698 collectMatchingRulesForRegion(rules, firstRuleIndex, lastRuleIndex, includeEmptyRules); 675 699 676 700 if (m_matchedRules.isEmpty()) … … 696 720 if (swapVisitedUnvisited && linkMatchType && linkMatchType != SelectorChecker::MatchAll) 697 721 linkMatchType = (linkMatchType == SelectorChecker::MatchVisited) ? SelectorChecker::MatchLink : SelectorChecker::MatchVisited; 698 addMatchedDeclaration(m_matchedRules[i]->rule()->declaration(), linkMatchType , m_matchedRules[i]->useInRegionStyle());722 addMatchedDeclaration(m_matchedRules[i]->rule()->declaration(), linkMatchType); 699 723 } 700 724 } … … 734 758 } 735 759 736 void CSSStyleSelector:: matchRulesForList(const Vector<RuleData>* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules)760 void CSSStyleSelector::collectMatchingRulesForList(const Vector<RuleData>* rules, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules) 737 761 { 738 762 if (!rules) … … 854 878 matchRules(m_authorStyle.get(), result.firstAuthorRule, result.lastAuthorRule, false); 855 879 856 if (m_regionForStyling)857 matchRules(m_regionRules.get(), result.firstAuthorRule, result.lastAuthorRule, false);858 859 880 // Now check our inline style attribute. 860 881 if (m_matchAuthorAndUserStyles && m_styledElement) { … … 907 928 908 929 m_fontDirty = false; 909 }910 911 inline void CSSStyleSelector::initForRegionStyling(RenderRegion* region)912 {913 setRegionForStyling(region);914 915 if (region)916 initRegionRules(region);917 }918 919 void CSSStyleSelector::initRegionRules(RenderRegion* region)920 {921 ASSERT(region);922 // Mark that the set of rules comes from region styling since we need to filter923 // the properties that can be applied.924 m_regionRules = adoptPtr(new RuleSet(UseInRegionStyle));925 926 // From all the region style rules, select those that apply to the specified region.927 for (Vector<RefPtr<WebKitCSSRegionRule> >::iterator it = m_regionStyleRules.begin(); it != m_regionStyleRules.end(); ++it) {928 const CSSSelectorList& regionSelectorList = (*it)->selectorList();929 for (CSSSelector* s = regionSelectorList.first(); s; s = regionSelectorList.next(s)) {930 if (!m_checker.checkSelector(s, static_cast<Element*>(region->node())))931 continue;932 CSSRuleList* regionStylingRules = (*it)->cssRules();933 for (unsigned index = 0; index < regionStylingRules->length(); ++index) {934 CSSRule* regionStylingRule = regionStylingRules->item(index);935 if (regionStylingRule->isStyleRule())936 m_regionRules->addStyleRule(static_cast<CSSStyleRule*>(regionStylingRule));937 }938 }939 }940 930 } 941 931 … … 1323 1313 initElement(element); 1324 1314 initForStyleResolve(element, defaultParent); 1325 initForRegionStyling(regionForStyling);1315 m_regionForStyling = regionForStyling; 1326 1316 if (allowSharing) { 1327 1317 RenderStyle* sharedStyle = locateSharedStyle(); … … 1480 1470 } 1481 1471 1482 PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle , RenderRegion* regionForStyling)1472 PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle) 1483 1473 { 1484 1474 if (!e) … … 1488 1478 1489 1479 initForStyleResolve(e, parentStyle, pseudo); 1490 initForRegionStyling(regionForStyling);1491 1480 m_style = RenderStyle::create(); 1492 1481 … … 1781 1770 } 1782 1771 1783 bool CSSStyleSelector::checkRegionStyle(Element* e) 1784 { 1785 m_checker.clearHasUnknownPseudoElements(); 1786 m_checker.setPseudoStyle(NOPSEUDO); 1787 1788 for (Vector<RefPtr<WebKitCSSRegionRule> >::iterator it = m_regionStyleRules.begin(); it != m_regionStyleRules.end(); ++it) { 1789 const CSSSelectorList& regionSelectorList = (*it)->selectorList(); 1790 for (CSSSelector* s = regionSelectorList.first(); s; s = regionSelectorList.next(s)) { 1791 if (m_checker.checkSelector(s, e)) 1772 bool CSSStyleSelector::checkRegionStyle(Element* regionElement) 1773 { 1774 unsigned rulesSize = m_authorStyle->m_regionSelectorsAndRuleSets.size(); 1775 for (unsigned i = 0; i < rulesSize; ++i) { 1776 ASSERT(m_authorStyle->m_regionSelectorsAndRuleSets.at(i).ruleSet.get()); 1777 if (checkRegionSelector(m_authorStyle->m_regionSelectorsAndRuleSets.at(i).selector, regionElement)) 1778 return true; 1779 } 1780 1781 if (m_userStyle) { 1782 rulesSize = m_userStyle->m_regionSelectorsAndRuleSets.size(); 1783 for (unsigned i = 0; i < rulesSize; ++i) { 1784 ASSERT(m_userStyle->m_regionSelectorsAndRuleSets.at(i).ruleSet.get()); 1785 if (checkRegionSelector(m_userStyle->m_regionSelectorsAndRuleSets.at(i).selector, regionElement)) 1792 1786 return true; 1793 1787 } … … 1887 1881 return false; 1888 1882 return true; 1883 } 1884 1885 bool CSSStyleSelector::checkRegionSelector(CSSSelector* regionSelector, Element* regionElement) 1886 { 1887 if (!regionSelector || !regionElement) 1888 return false; 1889 1890 m_checker.clearHasUnknownPseudoElements(); 1891 m_checker.setPseudoStyle(NOPSEUDO); 1892 1893 for (CSSSelector* s = regionSelector; s; s = CSSSelectorList::next(s)) 1894 if (m_checker.checkSelector(s, regionElement)) 1895 return true; 1896 1897 return false; 1889 1898 } 1890 1899 … … 1972 1981 } 1973 1982 1974 RuleData::RuleData(CSSStyleRule* rule, CSSSelector* selector, unsigned position , ERegionStyleEnabled useInRegionStyle)1983 RuleData::RuleData(CSSStyleRule* rule, CSSSelector* selector, unsigned position) 1975 1984 : m_rule(rule) 1976 1985 , m_selector(selector) … … 1982 1991 , m_containsUncommonAttributeSelector(WebCore::containsUncommonAttributeSelector(selector)) 1983 1992 , m_linkMatchType(SelectorChecker::determineLinkMatchType(selector)) 1984 , m_useInRegionStyle(useInRegionStyle)1985 1993 { 1986 1994 SelectorChecker::collectIdentifierHashes(m_selector, m_descendantSelectorIdentifierHashes, maximumIdentifierCount); 1987 1995 } 1988 1996 1989 RuleSet::RuleSet( ERegionStyleEnabled useInRegionStyle)1997 RuleSet::RuleSet() 1990 1998 : m_ruleCount(0) 1991 1999 , m_autoShrinkToFitEnabled(true) 1992 , m_useInRegionStyle(useInRegionStyle)1993 2000 { 1994 2001 } … … 2050 2057 void RuleSet::addRule(CSSStyleRule* rule, CSSSelector* selector) 2051 2058 { 2052 RuleData ruleData(rule, selector, m_ruleCount++ , m_useInRegionStyle);2059 RuleData ruleData(rule, selector, m_ruleCount++); 2053 2060 collectFeaturesFromRuleData(m_features, ruleData); 2054 2061 … … 2091 2098 { 2092 2099 m_pageRules.append(RuleData(rule, rule->selectorList().first(), m_pageRules.size())); 2100 } 2101 2102 void RuleSet::addRegionRule(WebKitCSSRegionRule* rule) 2103 { 2104 RuleSet* regionRuleSet = new RuleSet; 2105 // The region rule set should take into account the position inside the parent rule set. 2106 // Otherwise, the rules inside region block might be incorrectly positioned before other similar rules from 2107 // the stylesheet that contains the region block. 2108 regionRuleSet->m_ruleCount = m_ruleCount; 2109 2110 // Collect the region rules into a rule set 2111 CSSRuleList* regionStylingRules = rule->cssRules(); 2112 unsigned rulesSize = regionStylingRules->length(); 2113 for (unsigned i = 0; i < rulesSize; ++i) { 2114 CSSRule* regionStylingRule = regionStylingRules->item(i); 2115 if (regionStylingRule->isStyleRule()) 2116 regionRuleSet->addStyleRule(static_cast<CSSStyleRule*>(regionStylingRule)); 2117 } 2118 2119 m_regionSelectorsAndRuleSets.append(RuleSetSelectorPair(rule->selectorList().first(), regionRuleSet)); 2093 2120 } 2094 2121 … … 2146 2173 styleSelector->addKeyframeStyle(static_cast<WebKitCSSKeyframesRule*>(rule)); 2147 2174 else if (rule->isRegionRule() && styleSelector) 2148 styleSelector->addRegionRule(static_cast<WebKitCSSRegionRule*>(rule));2175 addRegionRule(static_cast<WebKitCSSRegionRule*>(rule)); 2149 2176 } 2150 2177 if (m_autoShrinkToFitEnabled) … … 2218 2245 } 2219 2246 2247 static inline bool isInsideRegionRule(CSSMutableStyleDeclaration* styleDeclaration) 2248 { 2249 ASSERT(styleDeclaration); 2250 2251 CSSRule* parentRule = styleDeclaration->parentRule(); 2252 while (parentRule) { 2253 if (parentRule->isRegionRule()) 2254 return true; 2255 parentRule = parentRule->parentRule(); 2256 } 2257 return false; 2258 } 2259 2220 2260 template <bool applyFirst> 2221 2261 void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclaration, bool isImportant, bool inheritedOnly) … … 2223 2263 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), styleDeclaration->parentRule()); 2224 2264 CSSMutableStyleDeclaration::const_iterator end = styleDeclaration->end(); 2265 2266 bool styleDeclarationInsideRegionRule = m_regionForStyling ? isInsideRegionRule(styleDeclaration) : false; 2267 2225 2268 for (CSSMutableStyleDeclaration::const_iterator it = styleDeclaration->begin(); it != end; ++it) { 2226 2269 const CSSProperty& current = *it; … … 2235 2278 } 2236 2279 int property = current.id(); 2280 2281 // Filter the properties that can be applied using region styling. 2282 if (styleDeclarationInsideRegionRule && !CSSStyleSelector::isValidRegionStyleProperty(property)) 2283 continue; 2284 2237 2285 if (applyFirst) { 2238 2286 COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property); … … 2276 2324 return; 2277 2325 } 2278 for (int i = startIndex; i <= endIndex; ++i) { 2279 m_applyPropertyToRegionStyle = m_matchedDecls[i].useInRegionStyle; 2326 for (int i = startIndex; i <= endIndex; ++i) 2280 2327 applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration.get(), isImportant, inheritedOnly); 2281 m_applyPropertyToRegionStyle = false;2282 }2283 2328 } 2284 2329 … … 2568 2613 // http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule 2569 2614 // FIXME: add incremental support for other region styling properties. 2570 inline bool isValidRegionStyleProperty(int id)2615 inline bool CSSStyleSelector::isValidRegionStyleProperty(int id) 2571 2616 { 2572 2617 switch (static_cast<CSSPropertyID>(id)) { … … 2658 2703 return; 2659 2704 } 2660 2661 // Filter region style property2662 if (applyPropertyToRegionStyle() && !isValidRegionStyleProperty(id))2663 return;2664 2705 2665 2706 CSSPropertyID property = static_cast<CSSPropertyID>(id); -
trunk/Source/WebCore/css/CSSStyleSelector.h
r105276 r105280 37 37 38 38 enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimumForFontFize }; 39 enum ERegionStyleEnabled { DoNotUseInRegionStyle, UseInRegionStyle };40 39 41 40 class CSSFontSelector; … … 116 115 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&); 117 116 118 PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0 , RenderRegion* regionForStyling = 0);117 PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0); 119 118 120 119 PassRefPtr<RenderStyle> styleForPage(int pageIndex); … … 143 142 void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); 144 143 void initElement(Element*); 145 void initForRegionStyling(RenderRegion*);146 void initRegionRules(RenderRegion*);147 144 void collectFeatures(); 148 145 RenderStyle* locateSharedStyle(); … … 153 150 154 151 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const WebKitCSSKeyframeRule*, KeyframeValue&); 155 void setRegionForStyling(RenderRegion* region) { m_regionForStyling = region; }156 RenderRegion* regionForStyling() const { return m_regionForStyling; }157 152 158 153 public: … … 210 205 void addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule>); 211 206 void addPageStyle(PassRefPtr<CSSPageRule>); 212 void addRegionRule(PassRefPtr<WebKitCSSRegionRule>); 213 214 bool checkRegionStyle(Element*); 207 208 bool checkRegionStyle(Element* regionElement); 215 209 216 210 bool usesSiblingRules() const { return !m_features.siblingRules.isEmpty(); } … … 263 257 264 258 void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); } 265 void addMatchedDeclaration(CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll , ERegionStyleEnabled useInRegionStyle = DoNotUseInRegionStyle);259 void addMatchedDeclaration(CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll); 266 260 267 261 struct MatchResult { … … 278 272 void matchUARules(MatchResult&); 279 273 void matchRules(RuleSet*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules); 280 void matchRulesForList(const Vector<RuleData>*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules); 274 void collectMatchingRules(RuleSet*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules); 275 void collectMatchingRulesForRegion(RuleSet*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules); 276 void collectMatchingRulesForList(const Vector<RuleData>*, int& firstRuleIndex, int& lastRuleIndex, bool includeEmptyRules); 281 277 bool fastRejectSelector(const RuleData&) const; 282 278 void sortMatchedRules(); 283 279 284 280 bool checkSelector(const RuleData&); 285 281 bool checkRegionSelector(CSSSelector* regionSelector, Element* regionElement); 286 282 void applyMatchedDeclarations(const MatchResult&); 287 283 template <bool firstPass> … … 289 285 template <bool firstPass> 290 286 void applyDeclaration(CSSMutableStyleDeclaration*, bool isImportant, bool inheritedOnly); 287 288 static bool isValidRegionStyleProperty(int id); 291 289 292 290 void matchPageRules(RuleSet*, bool isLeftPage, bool isFirstPage, const String& pageName); … … 299 297 OwnPtr<RuleSet> m_authorStyle; 300 298 OwnPtr<RuleSet> m_userStyle; 301 OwnPtr<RuleSet> m_regionRules;302 299 303 300 Features m_features; … … 313 310 KeyframesRuleMap m_keyframesRuleMap; 314 311 315 typedef Vector<RefPtr<WebKitCSSRegionRule> > RegionStyleRules;316 RegionStyleRules m_regionStyleRules;317 318 312 public: 319 313 static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; } … … 325 319 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; } 326 320 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; } 327 bool applyPropertyToRegionStyle() const { return m_applyPropertyToRegionStyle; }328 321 329 322 private: … … 374 367 RefPtr<CSSMutableStyleDeclaration> styleDeclaration; 375 368 union { 376 struct { 377 unsigned linkMatchType : 31; 378 unsigned useInRegionStyle : 1; // ERegionStyleEnabled 379 }; 369 unsigned linkMatchType; 380 370 // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object. 381 371 void* possiblyPaddedMember; … … 439 429 bool m_applyPropertyToRegularStyle; 440 430 bool m_applyPropertyToVisitedLinkStyle; 441 bool m_applyPropertyToRegionStyle;442 431 const CSSStyleApplyProperty& m_applyProperty; 443 432
Note: See TracChangeset
for help on using the changeset viewer.