Title: [143848] trunk/Source/WebCore
Revision
143848
Author
[email protected]
Date
2013-02-23 12:41:26 -0800 (Sat, 23 Feb 2013)

Log Message

Scrollbar style resolution arguments should not passed via statics.
https://bugs.webkit.org/show_bug.cgi?id=110690

Use PseudoStyleRequest to pass scrollbar params for style resolve.

Reviewed by Eric Seidel.

No change in functionality, covered by existing tests.

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::match): Changed to use context params, rather than statics.
(WebCore::SelectorChecker::checkOne): Changed to pass context to checkScrollbarPseudoClass.
(WebCore::SelectorChecker::checkScrollbarPseudoClass): Changed to use context params, rather than statics.
* css/SelectorChecker.h:
(WebCore::SelectorChecker::SelectorCheckingContext::SelectorCheckingContext): Added scrollbar style args.
(SelectorCheckingContext): Ditto.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList): Changed to use PseudoStyleRequest.
(WebCore::StyleResolver::State::initForStyleResolve): Ditto.
(WebCore::StyleResolver::pseudoStyleForElement): Ditto.
(WebCore::StyleResolver::ruleMatches): Ditto and added stuffing scrollbar style resolve args into SelectorCheckingContext.
* css/StyleResolver.h:
(PseudoStyleRequest): Added.
(State): Changed to hold and use PseudoStyleRequest instead of just PseudoId
* dom/Element.cpp:
(WebCore::Element::pseudoStyleCacheIsInvalid): Changed to use PseudoStyleRequest.
* page/FrameView.cpp: Ditto.
(WebCore::FrameView::updateScrollCorner): Ditto.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateScrollCornerStyle): Ditto.
(WebCore::RenderLayer::updateResizerStyle): Ditto.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::selectionBackgroundColor): Ditto.
(WebCore::RenderObject::selectionColor): Ditto.
(WebCore::firstLineStyleForCachedUncachedType): Ditto.
(WebCore::RenderObject::getCachedPseudoStyle): Ditto.
(WebCore::RenderObject::getUncachedPseudoStyle): Ditto.
* rendering/RenderObject.h:
(RenderObject): Ditto.
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::getScrollbarPseudoStyle): Ditto.
* rendering/RenderScrollbar.h:
(RenderScrollbar): Removed static members that are now obsolete.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143847 => 143848)


--- trunk/Source/WebCore/ChangeLog	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/ChangeLog	2013-02-23 20:41:26 UTC (rev 143848)
@@ -1,3 +1,49 @@
+2013-02-23  Dimitri Glazkov  <[email protected]>
+
+        Scrollbar style resolution arguments should not passed via statics.
+        https://bugs.webkit.org/show_bug.cgi?id=110690
+
+        Use PseudoStyleRequest to pass scrollbar params for style resolve.
+
+        Reviewed by Eric Seidel.
+
+        No change in functionality, covered by existing tests.
+
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::match): Changed to use context params, rather than statics.
+        (WebCore::SelectorChecker::checkOne): Changed to pass context to checkScrollbarPseudoClass.
+        (WebCore::SelectorChecker::checkScrollbarPseudoClass): Changed to use context params, rather than statics.
+        * css/SelectorChecker.h:
+        (WebCore::SelectorChecker::SelectorCheckingContext::SelectorCheckingContext): Added scrollbar style args.
+        (SelectorCheckingContext): Ditto.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList): Changed to use PseudoStyleRequest.
+        (WebCore::StyleResolver::State::initForStyleResolve): Ditto.
+        (WebCore::StyleResolver::pseudoStyleForElement): Ditto.
+        (WebCore::StyleResolver::ruleMatches): Ditto and added stuffing scrollbar style resolve args into SelectorCheckingContext.
+        * css/StyleResolver.h:
+        (PseudoStyleRequest): Added.
+        (State): Changed to hold and use PseudoStyleRequest instead of just PseudoId
+        * dom/Element.cpp:
+        (WebCore::Element::pseudoStyleCacheIsInvalid): Changed to use PseudoStyleRequest.
+        * page/FrameView.cpp: Ditto.
+        (WebCore::FrameView::updateScrollCorner): Ditto.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollCornerStyle): Ditto.
+        (WebCore::RenderLayer::updateResizerStyle): Ditto.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::selectionBackgroundColor): Ditto.
+        (WebCore::RenderObject::selectionColor): Ditto.
+        (WebCore::firstLineStyleForCachedUncachedType): Ditto.
+        (WebCore::RenderObject::getCachedPseudoStyle): Ditto.
+        (WebCore::RenderObject::getUncachedPseudoStyle): Ditto.
+        * rendering/RenderObject.h:
+        (RenderObject): Ditto.
+        * rendering/RenderScrollbar.cpp:
+        (WebCore::RenderScrollbar::getScrollbarPseudoStyle): Ditto.
+        * rendering/RenderScrollbar.h:
+        (RenderScrollbar): Removed static members that are now obsolete.
+
 2013-02-23  Adam Barth  <[email protected]>
 
         Threaded HTML parser should pass fast/parser/parser-yield-timing.html

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (143847 => 143848)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -143,15 +143,15 @@
         if (context.element == context.scope)
             return SelectorFailsCompletely;
 
-        // Bail-out if this selector is irrelevant for the pseudoStyle
-        if (context.pseudoStyle != NOPSEUDO && context.pseudoStyle != dynamicPseudo)
+        // Bail-out if this selector is irrelevant for the pseudoId
+        if (context.pseudoId != NOPSEUDO && context.pseudoId != dynamicPseudo)
             return SelectorFailsCompletely;
 
         // Disable :visited matching when we see the first link or try to match anything else than an ancestors.
         if (!context.isSubSelector && (context.element->isLink() || (relation != CSSSelector::Descendant && relation != CSSSelector::Child)))
             nextContext.visitedMatchType = VisitedMatchDisabled;
 
-        nextContext.pseudoStyle = NOPSEUDO;
+        nextContext.pseudoId = NOPSEUDO;
     }
 
     switch (relation) {
@@ -207,7 +207,7 @@
         // a selector is invalid if something follows a pseudo-element
         // We make an exception for scrollbar pseudo elements and allow a set of pseudo classes (but nothing else)
         // to follow the pseudo elements.
-        nextContext.hasScrollbarPseudo = dynamicPseudo != NOPSEUDO && (RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER);
+        nextContext.hasScrollbarPseudo = dynamicPseudo != NOPSEUDO && (context.scrollbar || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER);
         nextContext.hasSelectionPseudo = dynamicPseudo == SELECTION;
         if ((context.elementStyle || m_mode == CollectingRules || m_mode == QueryingRules) && dynamicPseudo != NOPSEUDO
             && !nextContext.hasSelectionPseudo
@@ -386,7 +386,7 @@
         } else if (context.hasScrollbarPseudo) {
             // CSS scrollbars match a specific subset of pseudo classes, and they have specialized rules for each
             // (since there are no elements involved).
-            return checkScrollbarPseudoClass(element->document(), selector);
+            return checkScrollbarPseudoClass(context, element->document(), selector);
         } else if (context.hasSelectionPseudo) {
             if (selector->pseudoType() == CSSSelector::PseudoWindowInactive)
                 return !element->document()->page()->focusController()->isActive();
@@ -786,10 +786,10 @@
     return true;
 }
 
-bool SelectorChecker::checkScrollbarPseudoClass(Document* document, const CSSSelector* selector) const
+bool SelectorChecker::checkScrollbarPseudoClass(const SelectorCheckingContext& context, Document* document, const CSSSelector* selector) const
 {
-    RenderScrollbar* scrollbar = RenderScrollbar::scrollbarForStyleResolve();
-    ScrollbarPart part = RenderScrollbar::partForStyleResolve();
+    RenderScrollbar* scrollbar = context.scrollbar;
+    ScrollbarPart part = context.scrollbarPart;
 
     // FIXME: This is a temporary hack for resizers and scrollbar corners. Eventually :window-inactive should become a real
     // pseudo class and just apply to everything.

Modified: trunk/Source/WebCore/css/SelectorChecker.h (143847 => 143848)


--- trunk/Source/WebCore/css/SelectorChecker.h	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/css/SelectorChecker.h	2013-02-23 20:41:26 UTC (rev 143848)
@@ -39,6 +39,7 @@
 namespace WebCore {
 
 class CSSSelector;
+class RenderScrollbar;
 class RenderStyle;
 
 class SelectorChecker {
@@ -57,8 +58,10 @@
             , element(element)
             , scope(0)
             , visitedMatchType(visitedMatchType)
-            , pseudoStyle(NOPSEUDO)
+            , pseudoId(NOPSEUDO)
             , elementStyle(0)
+            , scrollbar(0)
+            , scrollbarPart(NoPart)
             , isSubSelector(false)
             , hasScrollbarPseudo(false)
             , hasSelectionPseudo(false)
@@ -69,8 +72,10 @@
         Element* element;
         const ContainerNode* scope;
         VisitedMatchType visitedMatchType;
-        PseudoId pseudoStyle;
+        PseudoId pseudoId;
         RenderStyle* elementStyle;
+        RenderScrollbar* scrollbar;
+        ScrollbarPart scrollbarPart;
         bool isSubSelector;
         bool hasScrollbarPseudo;
         bool hasSelectionPseudo;
@@ -96,7 +101,7 @@
     static unsigned determineLinkMatchType(const CSSSelector*);
 
 private:
-    bool checkScrollbarPseudoClass(Document*, const CSSSelector*) const;
+    bool checkScrollbarPseudoClass(const SelectorCheckingContext&, Document*, const CSSSelector*) const;
 
     static bool isFrameFocused(const Element*);
 

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (143847 => 143848)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -696,7 +696,7 @@
             }
             // If we're matching normal rules, set a pseudo bit if
             // we really just matched a pseudo-element.
-            if (dynamicPseudo != NOPSEUDO && state.pseudoStyle() == NOPSEUDO) {
+            if (dynamicPseudo != NOPSEUDO && state.pseudoStyleRequest().pseudoId == NOPSEUDO) {
                 if (state.mode() == SelectorChecker::CollectingRules) {
                     InspectorInstrumentation::didMatchRule(cookie, false);
                     continue;
@@ -803,9 +803,9 @@
     }
 }
 
-inline void StyleResolver::State::initForStyleResolve(Document* document, Element* e, RenderStyle* parentStyle, PseudoId pseudoId, RenderRegion* regionForStyling)
+inline void StyleResolver::State::initForStyleResolve(Document* document, Element* e, RenderStyle* parentStyle, const PseudoStyleRequest& pseudoStyleRequest, RenderRegion* regionForStyling)
 {
-    m_pseudoStyle = pseudoId;
+    m_pseudoStyleRequest = pseudoStyleRequest;
     m_regionForStyling = regionForStyling;
 
     if (e) {
@@ -1556,7 +1556,7 @@
     }
 }
 
-PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle)
+PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
 {
     ASSERT(parentStyle);
     if (!e)
@@ -1564,7 +1564,7 @@
 
     State state(document());
     initElement(state, e);
-    state.initForStyleResolve(document(), e, parentStyle, pseudo);
+    state.initForStyleResolve(document(), e, parentStyle, pseudoStyleRequest);
     state.setStyle(RenderStyle::create());
     state.style()->inheritFrom(state.parentStyle());
 
@@ -1583,7 +1583,7 @@
     if (matchResult.matchedProperties.isEmpty())
         return 0;
 
-    state.style()->setStyleType(pseudo);
+    state.style()->setStyleType(pseudoStyleRequest.pseudoId);
 
     applyMatchedProperties(state, matchResult, e);
 
@@ -2075,7 +2075,7 @@
 {
     if (ruleData.hasFastCheckableSelector()) {
         // We know this selector does not include any pseudo elements.
-        if (state.pseudoStyle() != NOPSEUDO)
+        if (state.pseudoStyleRequest().pseudoId != NOPSEUDO)
             return false;
         // We know a sufficiently simple single part selector matches simply because we found it from the rule hash.
         // This is limited to HTML only so we don't need to check the namespace.
@@ -2097,12 +2097,14 @@
     SelectorChecker::SelectorCheckingContext context(ruleData.selector(), state.element(), SelectorChecker::VisitedMatchEnabled);
     context.elementStyle = state.style();
     context.scope = scope;
-    context.pseudoStyle = state.pseudoStyle();
+    context.pseudoId = state.pseudoStyleRequest().pseudoId;
+    context.scrollbar = state.pseudoStyleRequest().scrollbar;
+    context.scrollbarPart = state.pseudoStyleRequest().scrollbarPart;
     context.behaviorAtBoundary = behaviorAtBoundary;
     SelectorChecker::Match match = selectorChecker.match(context, dynamicPseudo, DOMSiblingTraversalStrategy());
     if (match != SelectorChecker::SelectorMatches)
         return false;
-    if (state.pseudoStyle() != NOPSEUDO && state.pseudoStyle() != dynamicPseudo)
+    if (state.pseudoStyleRequest().pseudoId != NOPSEUDO && state.pseudoStyleRequest().pseudoId != dynamicPseudo)
         return false;
     return true;
 }

Modified: trunk/Source/WebCore/css/StyleResolver.h (143847 => 143848)


--- trunk/Source/WebCore/css/StyleResolver.h	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/css/StyleResolver.h	2013-02-23 20:41:26 UTC (rev 143848)
@@ -33,6 +33,7 @@
 #include "RuleFeature.h"
 #include "RuleSet.h"
 #include "RuntimeEnabledFeatures.h"
+#include "ScrollTypes.h"
 #include "SelectorChecker.h"
 #include "SelectorFilter.h"
 #include "StyleInheritedData.h"
@@ -80,6 +81,7 @@
 class MediaQueryEvaluator;
 class Node;
 class RenderRegion;
+class RenderScrollbar;
 class RuleData;
 class RuleSet;
 class Settings;
@@ -135,6 +137,20 @@
     MatchOnlyUserAgentRules,
 };
 
+class PseudoStyleRequest {
+public:
+    PseudoStyleRequest(PseudoId pseudoId, RenderScrollbar* scrollbar = 0, ScrollbarPart scrollbarPart = NoPart)
+        : pseudoId(pseudoId)
+        , scrollbarPart(scrollbarPart)
+        , scrollbar(scrollbar)
+    {
+    }
+
+    PseudoId pseudoId;
+    ScrollbarPart scrollbarPart;
+    RenderScrollbar* scrollbar;
+};
+
 class MatchRequest {
 public:
     MatchRequest(RuleSet* ruleSet, bool includeEmptyRules = false, const ContainerNode* scope = 0, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary)
@@ -169,7 +185,7 @@
 
     void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
 
-    PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle);
+    PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleRequest&, RenderStyle* parentStyle);
 
     PassRefPtr<RenderStyle> styleForPage(int pageIndex);
     PassRefPtr<RenderStyle> defaultStyleForElement();
@@ -423,7 +439,7 @@
         , m_rootElementStyle(0)
         , m_regionForStyling(0)
         , m_sameOriginOnly(false)
-        , m_pseudoStyle(NOPSEUDO)
+        , m_pseudoStyleRequest(NOPSEUDO)
         , m_elementLinkState(NotInsideLink)
         , m_distributedToInsertionPoint(false)
         , m_elementAffectedByClassRules(false)
@@ -440,7 +456,7 @@
 
     public:
         void initElement(Element*);
-        void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO, RenderRegion* regionForStyling = 0);
+        void initForStyleResolve(Document*, Element*, RenderStyle* parentStyle = 0, const PseudoStyleRequest& = PseudoStyleRequest(NOPSEUDO), RenderRegion* regionForStyling = 0);
         void clear();
 
         Document* document() const { return m_document; }
@@ -461,7 +477,7 @@
         const RenderRegion* regionForStyling() const { return m_regionForStyling; }
         void setSameOriginOnly(bool isSameOriginOnly) { m_sameOriginOnly = isSameOriginOnly; }
         bool isSameOriginOnly() const { return m_sameOriginOnly; }
-        PseudoId pseudoStyle() const { return m_pseudoStyle; }
+        const PseudoStyleRequest& pseudoStyleRequest() const { return m_pseudoStyleRequest; }
         EInsideLink elementLinkState() const { return m_elementLinkState; }
         bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; }
         void setElementAffectedByClassRules(bool isAffected) { m_elementAffectedByClassRules = isAffected; }
@@ -517,7 +533,7 @@
         
         RenderRegion* m_regionForStyling;
         bool m_sameOriginOnly;
-        PseudoId m_pseudoStyle;
+        PseudoStyleRequest m_pseudoStyleRequest;
 
         EInsideLink m_elementLinkState;
 

Modified: trunk/Source/WebCore/dom/Element.cpp (143847 => 143848)


--- trunk/Source/WebCore/dom/Element.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -1328,7 +1328,7 @@
         if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
             newPseudoStyle = renderer()->uncachedFirstLineStyle(newStyle);
         else
-            newPseudoStyle = renderer()->getUncachedPseudoStyle(pseudoId, newStyle, newStyle);
+            newPseudoStyle = renderer()->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId), newStyle, newStyle);
         if (!newPseudoStyle)
             return true;
         if (*newPseudoStyle != *pseudoStyleCache->at(i)) {

Modified: trunk/Source/WebCore/page/FrameView.cpp (143847 => 143848)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -3085,7 +3085,7 @@
         Element* body = doc ? doc->body() : 0;
         if (body && body->renderer()) {
             renderer = body->renderer();
-            cornerStyle = renderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, renderer->style());
+            cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
         }
         
         if (!cornerStyle) {
@@ -3093,14 +3093,14 @@
             Element* docElement = doc ? doc->documentElement() : 0;
             if (docElement && docElement->renderer()) {
                 renderer = docElement->renderer();
-                cornerStyle = renderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, renderer->style());
+                cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
             }
         }
         
         if (!cornerStyle) {
             // If we have an owning iframe/frame element, then it can set the custom scrollbar also.
             if (RenderPart* renderer = m_frame->ownerRenderer())
-                cornerStyle = renderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, renderer->style());
+                cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
         }
     }
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (143847 => 143848)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -5761,7 +5761,7 @@
 void RenderLayer::updateScrollCornerStyle()
 {
     RenderObject* actualRenderer = rendererForScrollbar(renderer());
-    RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(SCROLLBAR_CORNER, actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
+    RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
     if (corner) {
         if (!m_scrollCorner) {
             m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->document());
@@ -5777,7 +5777,7 @@
 void RenderLayer::updateResizerStyle()
 {
     RenderObject* actualRenderer = rendererForScrollbar(renderer());
-    RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(RESIZER, actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
+    RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
     if (resizer) {
         if (!m_resizer) {
             m_resizer = RenderScrollbarPart::createAnonymous(renderer()->document());

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (143847 => 143848)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -1631,7 +1631,7 @@
 {
     Color color;
     if (style()->userSelect() != SELECT_NONE) {
-        RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION);
+        RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
         if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
             color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite();
         else
@@ -1652,7 +1652,7 @@
         || (frame()->view()->paintBehavior() & PaintBehaviorSelectionOnly))
         return color;
 
-    if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION)) {
+    if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION))) {
         color = pseudoStyle->visitedDependentColor(colorProperty);
         if (!color.isValid())
             color = pseudoStyle->visitedDependentColor(CSSPropertyColor);
@@ -2686,7 +2686,7 @@
         if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBlock()) {
             if (type == Cached)
                 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);
-            return firstLineBlock->getUncachedPseudoStyle(FIRST_LINE, style, firstLineBlock == renderer ? style : 0);
+            return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIRST_LINE), style, firstLineBlock == renderer ? style : 0);
         }
     } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLineStyle->isRenderInline()) {
         RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLineStyle();
@@ -2696,7 +2696,7 @@
                 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE_INHERITED);
                 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle);
             }
-            return rendererForFirstLineStyle->getUncachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle, style);
+            return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyleRequest(FIRST_LINE_INHERITED), parentStyle, style);
         }
     }
     return 0;
@@ -2731,15 +2731,15 @@
     if (cachedStyle)
         return cachedStyle;
     
-    RefPtr<RenderStyle> result = getUncachedPseudoStyle(pseudo, parentStyle);
+    RefPtr<RenderStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pseudo), parentStyle);
     if (result)
         return style()->addCachedPseudoStyle(result.release());
     return 0;
 }
 
-PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(PseudoId pseudo, RenderStyle* parentStyle, RenderStyle* ownStyle) const
+PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) const
 {
-    if (pseudo < FIRST_INTERNAL_PSEUDOID && !ownStyle && !style()->hasPseudoStyle(pseudo))
+    if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !style()->hasPseudoStyle(pseudoStyleRequest.pseudoId))
         return 0;
     
     if (!parentStyle) {
@@ -2755,12 +2755,13 @@
         return 0;
     Element* element = toElement(n);
 
-    if (pseudo == FIRST_LINE_INHERITED) {
+    if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) {
         RefPtr<RenderStyle> result = document()->styleResolver()->styleForElement(element, parentStyle, DisallowStyleSharing);
         result->setStyleType(FIRST_LINE_INHERITED);
         return result.release();
     }
-    return document()->styleResolver()->pseudoStyleForElement(pseudo, element, parentStyle);
+
+    return document()->styleResolver()->pseudoStyleForElement(element, pseudoStyleRequest, parentStyle);
 }
 
 static Color decorationColor(RenderStyle* style)

Modified: trunk/Source/WebCore/rendering/RenderObject.h (143847 => 143848)


--- trunk/Source/WebCore/rendering/RenderObject.h	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2013-02-23 20:41:26 UTC (rev 143848)
@@ -55,6 +55,7 @@
 class OverlapTestRequestClient;
 class Path;
 class Position;
+class PseudoStyleRequest;
 class RenderBoxModelObject;
 class RenderInline;
 class RenderBlock;
@@ -604,7 +605,7 @@
     // The pseudo element style can be cached or uncached.  Use the cached method if the pseudo element doesn't respect
     // any pseudo classes (and therefore has no concept of changing state).
     RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
-    PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
+    PassRefPtr<RenderStyle> getUncachedPseudoStyle(const PseudoStyleRequest&, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
     
     virtual void updateDragState(bool dragOn);
 

Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (143847 => 143848)


--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp	2013-02-23 20:41:26 UTC (rev 143848)
@@ -32,6 +32,7 @@
 #include "RenderScrollbarPart.h"
 #include "RenderScrollbarTheme.h"
 #include "StyleInheritedData.h"
+#include "StyleResolver.h"
 
 namespace WebCore {
 
@@ -145,30 +146,12 @@
     updateScrollbarPart(TrackBGPart);
 }
 
-static ScrollbarPart s_styleResolvePart;
-static RenderScrollbar* s_styleResolveScrollbar;
-
-RenderScrollbar* RenderScrollbar::scrollbarForStyleResolve()
-{
-    return s_styleResolveScrollbar;
-}
-
-ScrollbarPart RenderScrollbar::partForStyleResolve()
-{
-    return s_styleResolvePart;
-}
-
 PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart partType, PseudoId pseudoId)
 {
     if (!owningRenderer())
         return 0;
 
-    s_styleResolvePart = partType;
-    s_styleResolveScrollbar = this;
-    RefPtr<RenderStyle> result = owningRenderer()->getUncachedPseudoStyle(pseudoId, owningRenderer()->style());
-    s_styleResolvePart = NoPart;
-    s_styleResolveScrollbar = 0;
-
+    RefPtr<RenderStyle> result = owningRenderer()->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId, this, partType), owningRenderer()->style());
     // Scrollbars for root frames should always have background color 
     // unless explicitly specified as transparent. So we force it.
     // This is because WebKit assumes scrollbar to be always painted and missing background

Modified: trunk/Source/WebCore/rendering/RenderScrollbar.h (143847 => 143848)


--- trunk/Source/WebCore/rendering/RenderScrollbar.h	2013-02-23 20:00:18 UTC (rev 143847)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.h	2013-02-23 20:41:26 UTC (rev 143848)
@@ -47,9 +47,6 @@
     static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollableArea*, ScrollbarOrientation, Node*, Frame* owningFrame = 0);
     virtual ~RenderScrollbar();
 
-    static ScrollbarPart partForStyleResolve();
-    static RenderScrollbar* scrollbarForStyleResolve();
-
     RenderBox* owningRenderer() const;
 
     void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to