[CSSRegions] Make RenderNamedFlowFragment::computeStyleInRegion const
authormihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Oct 2014 14:33:45 +0000 (14:33 +0000)
committermihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Oct 2014 14:33:45 +0000 (14:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137604

Reviewed by Andrei Bucur.

The method computeStyleInRegion should be const as it does not modify
the state of the RenderNamedFlowFragment instance. Make pointers to
the region used for styling const along the way. No new tests as no
change in functionality.

* css/ElementRuleCollector.h:
(WebCore::ElementRuleCollector::ElementRuleCollector):
(WebCore::ElementRuleCollector::setRegionForStyling):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::initForStyleResolve):
(WebCore::StyleResolver::styleForElement):
* css/StyleResolver.h:
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::computeStyleInRegion):
* rendering/RenderNamedFlowFragment.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174648 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/ElementRuleCollector.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/rendering/RenderNamedFlowFragment.cpp
Source/WebCore/rendering/RenderNamedFlowFragment.h

index 8b9446d..cdeb63b 100644 (file)
@@ -1,3 +1,26 @@
+2014-10-13  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        [CSSRegions] Make RenderNamedFlowFragment::computeStyleInRegion const
+        https://bugs.webkit.org/show_bug.cgi?id=137604
+
+        Reviewed by Andrei Bucur.
+
+        The method computeStyleInRegion should be const as it does not modify
+        the state of the RenderNamedFlowFragment instance. Make pointers to
+        the region used for styling const along the way. No new tests as no
+        change in functionality.
+
+        * css/ElementRuleCollector.h:
+        (WebCore::ElementRuleCollector::ElementRuleCollector):
+        (WebCore::ElementRuleCollector::setRegionForStyling):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::initForStyleResolve):
+        (WebCore::StyleResolver::styleForElement):
+        * css/StyleResolver.h:
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::computeStyleInRegion):
+        * rendering/RenderNamedFlowFragment.h:
+
 2014-09-30  Sergio Villar Senin  <svillar@igalia.com>
 
         [CSS Grid Layout] Pass the valid set of tracks to grow beyond growth limits
index d10cb0d..b6511d5 100644 (file)
@@ -46,7 +46,7 @@ public:
         , m_ruleSets(ruleSets)
         , m_selectorFilter(selectorFilter)
         , m_isPrintStyle(false)
-        , m_regionForStyling(0)
+        , m_regionForStyling(nullptr)
         , m_pseudoStyleRequest(NOPSEUDO)
         , m_sameOriginOnly(false)
         , m_mode(SelectorChecker::Mode::ResolvingStyle)
@@ -62,7 +62,7 @@ public:
     void setMode(SelectorChecker::Mode mode) { m_mode = mode; }
     void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyleRequest = request; }
     void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } 
-    void setRegionForStyling(RenderRegion* regionForStyling) { m_regionForStyling = regionForStyling; }
+    void setRegionForStyling(const RenderRegion* regionForStyling) { m_regionForStyling = regionForStyling; }
     void setMedium(const MediaQueryEvaluator* medium) { m_isPrintStyle = medium->mediaTypeMatchSpecific("print"); }
 
     bool hasAnyMatchingRules(RuleSet*);
@@ -94,7 +94,7 @@ private:
     const SelectorFilter& m_selectorFilter;
 
     bool m_isPrintStyle;
-    RenderRegion* m_regionForStyling;
+    const RenderRegion* m_regionForStyling;
     PseudoStyleRequest m_pseudoStyleRequest;
     bool m_sameOriginOnly;
     SelectorChecker::Mode m_mode;
index 696c43c..ff4e288 100644 (file)
@@ -404,7 +404,7 @@ inline void StyleResolver::initElement(Element* e)
     }
 }
 
-inline void StyleResolver::State::initForStyleResolve(Document& document, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling)
+inline void StyleResolver::State::initForStyleResolve(Document& document, Element* e, RenderStyle* parentStyle, const RenderRegion* regionForStyling)
 {
     m_regionForStyling = regionForStyling;
 
@@ -736,7 +736,7 @@ static inline bool isAtShadowBoundary(const Element* element)
 }
 
 PassRef<RenderStyle> StyleResolver::styleForElement(Element* element, RenderStyle* defaultParent,
-    StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling)
+    StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling)
 {
     // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer
     // will vanish if a style recalc happens during loading.
index 8e88565..266d0b0 100644 (file)
@@ -147,7 +147,7 @@ public:
     void popParentElement(Element*);
 
     PassRef<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing,
-        RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = nullptr);
+        RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr);
 
     void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
 
@@ -356,7 +356,7 @@ public:
 
     public:
         void initElement(Element*);
-        void initForStyleResolve(Document&, Element*, RenderStyle* parentStyle, RenderRegion* regionForStyling = nullptr);
+        void initForStyleResolve(Document&, Element*, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr);
         void clear();
 
         Document& document() const { return m_element->document(); }
@@ -418,7 +418,7 @@ public:
         RenderStyle* m_rootElementStyle;
 
         // Required to ASSERT in applyProperties.
-        RenderRegion* m_regionForStyling;
+        const RenderRegion* m_regionForStyling;
         
         EInsideLink m_elementLinkState;
 
index a02b6d4..769951e 100644 (file)
@@ -348,7 +348,7 @@ void RenderNamedFlowFragment::checkRegionStyle()
     toRenderNamedFlowThread(m_flowThread)->checkRegionsWithStyling();
 }
 
-PassRefPtr<RenderStyle> RenderNamedFlowFragment::computeStyleInRegion(RenderElement& renderer, RenderStyle& parentStyle)
+PassRefPtr<RenderStyle> RenderNamedFlowFragment::computeStyleInRegion(RenderElement& renderer, RenderStyle& parentStyle) const
 {
     ASSERT(!renderer.isAnonymous());
 
index f6ce2fa..4f16e60 100644 (file)
@@ -123,7 +123,7 @@ public:
 private:
     virtual const char* renderName() const override { return "RenderNamedFlowFragment"; }
 
-    PassRefPtr<RenderStyle> computeStyleInRegion(RenderElement&, RenderStyle& parentStyle);
+    PassRefPtr<RenderStyle> computeStyleInRegion(RenderElement&, RenderStyle& parentStyle) const;
     void computeChildrenStyleInRegion(RenderElement&);
     void setObjectStyleInRegion(RenderObject*, PassRefPtr<RenderStyle>, bool objectRegionStyleCached);