Title: [156325] trunk/Source/WebCore
Revision
156325
Author
an...@apple.com
Date
2013-09-24 05:22:10 -0700 (Tue, 24 Sep 2013)

Log Message

Move more style change code from RenderObject to RenderElement
https://bugs.webkit.org/show_bug.cgi?id=121822

Reviewed by Darin Adler.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::~RenderElement):
        
    RenderTexts are no longer registered as image clients. They don't need be unregistered either.

(WebCore::RenderElement::adjustStyleDifference):
(WebCore::RenderElement::hasImmediateNonWhitespaceTextChild):
(WebCore::RenderElement::shouldRepaintForStyleDifference):
(WebCore::RenderElement::updateFillImages):
(WebCore::RenderElement::updateImage):
(WebCore::RenderElement::updateShapeImage):
(WebCore::RenderElement::setStyle):
        
    Move from RenderObject and remove the text specific bits.

* rendering/RenderElement.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::setStyle):
(WebCore::RenderObject::arenaDelete):
* rendering/RenderObject.h:
        
    Remove styleWill/DidChange which move to subclasses.

* rendering/RenderText.cpp:
(WebCore::RenderText::setStyle):
        
    Add simple text specific setStyle.

* rendering/RenderText.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (156324 => 156325)


--- trunk/Source/WebCore/ChangeLog	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/ChangeLog	2013-09-24 12:22:10 UTC (rev 156325)
@@ -1,3 +1,40 @@
+2013-09-23  Antti Koivisto  <an...@apple.com>
+
+        Move more style change code from RenderObject to RenderElement
+        https://bugs.webkit.org/show_bug.cgi?id=121822
+
+        Reviewed by Darin Adler.
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::~RenderElement):
+        
+            RenderTexts are no longer registered as image clients. They don't need be unregistered either.
+
+        (WebCore::RenderElement::adjustStyleDifference):
+        (WebCore::RenderElement::hasImmediateNonWhitespaceTextChild):
+        (WebCore::RenderElement::shouldRepaintForStyleDifference):
+        (WebCore::RenderElement::updateFillImages):
+        (WebCore::RenderElement::updateImage):
+        (WebCore::RenderElement::updateShapeImage):
+        (WebCore::RenderElement::setStyle):
+        
+            Move from RenderObject and remove the text specific bits.
+
+        * rendering/RenderElement.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::setStyle):
+        (WebCore::RenderObject::arenaDelete):
+        * rendering/RenderObject.h:
+        
+            Remove styleWill/DidChange which move to subclasses.
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::setStyle):
+        
+            Add simple text specific setStyle.
+
+        * rendering/RenderText.h:
+
 2013-09-24  Andrei Parvu  <pa...@adobe.com>
 
         [CSS Background] repeat: round should round the number of tiles to the nearest natural number

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (156324 => 156325)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2013-09-24 12:22:10 UTC (rev 156325)
@@ -71,6 +71,27 @@
 
 RenderElement::~RenderElement()
 {
+    if (m_style) {
+        for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
+            if (StyleImage* backgroundImage = bgLayer->image())
+                backgroundImage->removeClient(this);
+        }
+
+        for (const FillLayer* maskLayer = m_style->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
+            if (StyleImage* maskImage = maskLayer->image())
+                maskImage->removeClient(this);
+        }
+
+        if (StyleImage* borderImage = m_style->borderImage().image())
+            borderImage->removeClient(this);
+
+        if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
+            maskBoxImage->removeClient(this);
+
+#if ENABLE(CSS_SHAPES)
+        removeShapeImageClient(m_style->shapeInside());
+#endif
+    }
 }
 
 RenderElement* RenderElement::createFor(Element& element, RenderStyle& style)
@@ -152,6 +173,186 @@
     return nullptr;
 }
 
+StyleDifference RenderElement::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const
+{
+#if USE(ACCELERATED_COMPOSITING)
+    // If transform changed, and we are not composited, need to do a layout.
+    if (contextSensitiveProperties & ContextSensitivePropertyTransform) {
+        // Text nodes share style with their parents but transforms don't apply to them,
+        // hence the !isText() check.
+        // FIXME: when transforms are taken into account for overflow, we will need to do a layout.
+        if (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited()) {
+            // We need to set at least SimplifiedLayout, but if PositionedMovementOnly is already set
+            // then we actually need SimplifiedLayoutAndPositionedMovement.
+            if (!hasLayer())
+                diff = StyleDifferenceLayout; // FIXME: Do this for now since SimplifiedLayout cannot handle updating floating objects lists.
+            else if (diff < StyleDifferenceLayoutPositionedMovementOnly)
+                diff = StyleDifferenceSimplifiedLayout;
+            else if (diff < StyleDifferenceSimplifiedLayout)
+                diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement;
+        } else if (diff < StyleDifferenceRecompositeLayer)
+            diff = StyleDifferenceRecompositeLayer;
+    }
+
+    // If opacity changed, and we are not composited, need to repaint (also
+    // ignoring text nodes)
+    if (contextSensitiveProperties & ContextSensitivePropertyOpacity) {
+        if (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited())
+            diff = StyleDifferenceRepaintLayer;
+        else if (diff < StyleDifferenceRecompositeLayer)
+            diff = StyleDifferenceRecompositeLayer;
+    }
+    
+#if ENABLE(CSS_FILTERS)
+    if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLayer()) {
+        RenderLayer* layer = toRenderLayerModelObject(this)->layer();
+        if (!layer->isComposited() || layer->paintsWithFilters())
+            diff = StyleDifferenceRepaintLayer;
+        else if (diff < StyleDifferenceRecompositeLayer)
+            diff = StyleDifferenceRecompositeLayer;
+    }
+#endif
+    
+    // The answer to requiresLayer() for plugins, iframes, and canvas can change without the actual
+    // style changing, since it depends on whether we decide to composite these elements. When the
+    // layer status of one of these elements changes, we need to force a layout.
+    if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) {
+        if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer())
+            diff = StyleDifferenceLayout;
+    }
+#else
+    UNUSED_PARAM(contextSensitiveProperties);
+#endif
+
+    // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
+    if (diff == StyleDifferenceRepaintLayer && !hasLayer())
+        diff = StyleDifferenceRepaint;
+
+    return diff;
+}
+
+inline bool RenderElement::hasImmediateNonWhitespaceTextChild() const
+{
+    for (const RenderObject* renderer = firstChild(); renderer; renderer = renderer->nextSibling()) {
+        if (renderer->isText() && !toRenderText(renderer)->isAllCollapsibleWhitespace())
+            return true;
+    }
+    return false;
+}
+
+inline bool RenderElement::shouldRepaintForStyleDifference(StyleDifference diff) const
+{
+    return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfText && hasImmediateNonWhitespaceTextChild());
+}
+
+void RenderElement::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
+{
+    // Optimize the common case
+    if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image()))
+        return;
+    
+    // Go through the new layers and addClients first, to avoid removing all clients of an image.
+    for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) {
+        if (currNew->image())
+            currNew->image()->addClient(this);
+    }
+
+    for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
+        if (currOld->image())
+            currOld->image()->removeClient(this);
+    }
+}
+
+void RenderElement::updateImage(StyleImage* oldImage, StyleImage* newImage)
+{
+    if (oldImage == newImage)
+        return;
+    if (oldImage)
+        oldImage->removeClient(this);
+    if (newImage)
+        newImage->addClient(this);
+}
+
+#if ENABLE(CSS_SHAPES)
+void RenderElement::updateShapeImage(const ShapeValue* oldShapeValue, const ShapeValue* newShapeValue)
+{
+    if (oldShapeValue || newShapeValue)
+        updateImage(oldShapeValue ? oldShapeValue->image() : 0, newShapeValue ? newShapeValue->image() : 0);
+}
+#endif
+
+void RenderElement::setStyle(PassRefPtr<RenderStyle> style)
+{
+    if (m_style == style) {
+#if USE(ACCELERATED_COMPOSITING)
+        // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
+        // style sharing is disabled for them. That should ensure that we never hit this code path.
+        ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas());
+#endif
+        return;
+    }
+
+    StyleDifference diff = StyleDifferenceEqual;
+    unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
+    if (m_style)
+        diff = m_style->diff(style.get(), contextSensitiveProperties);
+
+    diff = adjustStyleDifference(diff, contextSensitiveProperties);
+
+    styleWillChange(diff, style.get());
+    
+    RefPtr<RenderStyle> oldStyle = m_style.release();
+    setStyleInternal(style);
+
+    updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_style->backgroundLayers() : 0);
+    updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->maskLayers() : 0);
+
+    updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_style->borderImage().image() : 0);
+    updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0);
+
+#if ENABLE(CSS_SHAPES)
+    updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0);
+#endif
+
+    // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
+    // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
+    if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline))
+        view().setMaximalOutlineSize(m_style->outlineSize());
+
+    bool doesNotNeedLayout = !parent();
+
+    styleDidChange(diff, oldStyle.get());
+
+    // FIXME: |this| might be destroyed here. This can currently happen for a RenderTextFragment when
+    // its first-letter block gets an update in RenderTextFragment::styleDidChange. For RenderTextFragment(s),
+    // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition
+    // in the future as we move renderer changes out of layout and into style changes.
+    if (doesNotNeedLayout)
+        return;
+
+    // Now that the layer (if any) has been updated, we need to adjust the diff again,
+    // check whether we should layout now, and decide if we need to repaint.
+    StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitiveProperties);
+    
+    if (diff <= StyleDifferenceLayoutPositionedMovementOnly) {
+        if (updatedDiff == StyleDifferenceLayout)
+            setNeedsLayoutAndPrefWidthsRecalc();
+        else if (updatedDiff == StyleDifferenceLayoutPositionedMovementOnly)
+            setNeedsPositionedMovementLayout(oldStyle.get());
+        else if (updatedDiff == StyleDifferenceSimplifiedLayoutAndPositionedMovement) {
+            setNeedsPositionedMovementLayout(oldStyle.get());
+            setNeedsSimplifiedNormalFlowLayout();
+        } else if (updatedDiff == StyleDifferenceSimplifiedLayout)
+            setNeedsSimplifiedNormalFlowLayout();
+    }
+
+    if (updatedDiff == StyleDifferenceRepaintLayer || shouldRepaintForStyleDifference(updatedDiff)) {
+        // Do a repaint with the new style now, e.g., for example if we go from
+        // not having an outline to having an outline.
+        repaint();
+    }
+}
+
 void RenderElement::addChild(RenderObject* newChild, RenderObject* beforeChild)
 {
     bool needsTable = false;

Modified: trunk/Source/WebCore/rendering/RenderElement.h (156324 => 156325)


--- trunk/Source/WebCore/rendering/RenderElement.h	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/rendering/RenderElement.h	2013-09-24 12:22:10 UTC (rev 156325)
@@ -33,6 +33,8 @@
 
     static RenderElement* createFor(Element&, RenderStyle&);
 
+    virtual void setStyle(PassRefPtr<RenderStyle>) OVERRIDE;
+
     // This is null for anonymous renderers.
     Element* element() const { return toElement(RenderObject::node()); }
     Element* nonPseudoElement() const { return toElement(RenderObject::nonPseudoNode()); }
@@ -76,8 +78,9 @@
     void setLastChild(RenderObject* child) { m_lastChild = child; }
     void destroyLeftoverChildren();
 
-    virtual void styleWillChange(StyleDifference, const RenderStyle*) OVERRIDE;
-    virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE;
+    virtual void styleWillChange(StyleDifference, const RenderStyle*);
+    virtual void styleDidChange(StyleDifference, const RenderStyle*);
+
     virtual void insertedIntoTree() OVERRIDE;
     virtual void willBeRemovedFromTree() OVERRIDE;
     virtual void willBeDestroyed() OVERRIDE;
@@ -92,6 +95,17 @@
     virtual RenderObject* firstChildSlow() const OVERRIDE FINAL { return firstChild(); }
     virtual RenderObject* lastChildSlow() const OVERRIDE FINAL { return lastChild(); }
 
+    bool shouldRepaintForStyleDifference(StyleDifference) const;
+    bool hasImmediateNonWhitespaceTextChild() const;
+
+    void updateFillImages(const FillLayer*, const FillLayer*);
+    void updateImage(StyleImage*, StyleImage*);
+#if ENABLE(CSS_SHAPES)
+    void updateShapeImage(const ShapeValue*, const ShapeValue*);
+#endif
+
+    StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
+
     RenderObject* m_firstChild;
     RenderObject* m_lastChild;
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (156324 => 156325)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2013-09-24 12:22:10 UTC (rev 156325)
@@ -1672,64 +1672,6 @@
         setStyle(style);
 }
 
-StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const
-{
-#if USE(ACCELERATED_COMPOSITING)
-    // If transform changed, and we are not composited, need to do a layout.
-    if (contextSensitiveProperties & ContextSensitivePropertyTransform) {
-        // Text nodes share style with their parents but transforms don't apply to them,
-        // hence the !isText() check.
-        // FIXME: when transforms are taken into account for overflow, we will need to do a layout.
-        if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited())) {
-            // We need to set at least SimplifiedLayout, but if PositionedMovementOnly is already set
-            // then we actually need SimplifiedLayoutAndPositionedMovement.
-            if (!hasLayer())
-                diff = StyleDifferenceLayout; // FIXME: Do this for now since SimplifiedLayout cannot handle updating floating objects lists.
-            else if (diff < StyleDifferenceLayoutPositionedMovementOnly)
-                diff = StyleDifferenceSimplifiedLayout;
-            else if (diff < StyleDifferenceSimplifiedLayout)
-                diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement;
-        } else if (diff < StyleDifferenceRecompositeLayer)
-            diff = StyleDifferenceRecompositeLayer;
-    }
-
-    // If opacity changed, and we are not composited, need to repaint (also
-    // ignoring text nodes)
-    if (contextSensitiveProperties & ContextSensitivePropertyOpacity) {
-        if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited()))
-            diff = StyleDifferenceRepaintLayer;
-        else if (diff < StyleDifferenceRecompositeLayer)
-            diff = StyleDifferenceRecompositeLayer;
-    }
-    
-#if ENABLE(CSS_FILTERS)
-    if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLayer()) {
-        RenderLayer* layer = toRenderLayerModelObject(this)->layer();
-        if (!layer->isComposited() || layer->paintsWithFilters())
-            diff = StyleDifferenceRepaintLayer;
-        else if (diff < StyleDifferenceRecompositeLayer)
-            diff = StyleDifferenceRecompositeLayer;
-    }
-#endif
-    
-    // The answer to requiresLayer() for plugins, iframes, and canvas can change without the actual
-    // style changing, since it depends on whether we decide to composite these elements. When the
-    // layer status of one of these elements changes, we need to force a layout.
-    if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) {
-        if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer())
-            diff = StyleDifferenceLayout;
-    }
-#else
-    UNUSED_PARAM(contextSensitiveProperties);
-#endif
-
-    // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
-    if (diff == StyleDifferenceRepaintLayer && !hasLayer())
-        diff = StyleDifferenceRepaint;
-
-    return diff;
-}
-
 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
 {
     ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFTER);
@@ -1747,130 +1689,6 @@
     setStyle(pseudoStyle);
 }
 
-inline bool RenderObject::hasImmediateNonWhitespaceTextChild() const
-{
-    if (isText())
-        return false;
-    for (const RenderObject* r = toRenderElement(this)->firstChild(); r; r = r->nextSibling()) {
-        if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace())
-            return true;
-    }
-    return false;
-}
-
-bool RenderObject::shouldRepaintForStyleDifference(StyleDifference diff) const
-{
-    return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfText && hasImmediateNonWhitespaceTextChild());
-}
-
-void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
-{
-    if (m_style == style) {
-#if USE(ACCELERATED_COMPOSITING)
-        // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
-        // style sharing is disabled for them. That should ensure that we never hit this code path.
-        ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas());
-#endif
-        return;
-    }
-
-    StyleDifference diff = StyleDifferenceEqual;
-    unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
-    if (m_style)
-        diff = m_style->diff(style.get(), contextSensitiveProperties);
-
-    diff = adjustStyleDifference(diff, contextSensitiveProperties);
-
-    styleWillChange(diff, style.get());
-    
-    RefPtr<RenderStyle> oldStyle = m_style.release();
-    setStyleInternal(style);
-
-    updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_style->backgroundLayers() : 0);
-    updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->maskLayers() : 0);
-
-    updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_style->borderImage().image() : 0);
-    updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0);
-
-#if ENABLE(CSS_SHAPES)
-    updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0);
-#endif
-
-    // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
-    // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
-    if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline))
-        view().setMaximalOutlineSize(m_style->outlineSize());
-
-    bool doesNotNeedLayout = !m_parent || isText();
-
-    styleDidChange(diff, oldStyle.get());
-
-    // FIXME: |this| might be destroyed here. This can currently happen for a RenderTextFragment when
-    // its first-letter block gets an update in RenderTextFragment::styleDidChange. For RenderTextFragment(s),
-    // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition
-    // in the future as we move renderer changes out of layout and into style changes.
-    if (doesNotNeedLayout)
-        return;
-
-    // Now that the layer (if any) has been updated, we need to adjust the diff again,
-    // check whether we should layout now, and decide if we need to repaint.
-    StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitiveProperties);
-    
-    if (diff <= StyleDifferenceLayoutPositionedMovementOnly) {
-        if (updatedDiff == StyleDifferenceLayout)
-            setNeedsLayoutAndPrefWidthsRecalc();
-        else if (updatedDiff == StyleDifferenceLayoutPositionedMovementOnly)
-            setNeedsPositionedMovementLayout(oldStyle.get());
-        else if (updatedDiff == StyleDifferenceSimplifiedLayoutAndPositionedMovement) {
-            setNeedsPositionedMovementLayout(oldStyle.get());
-            setNeedsSimplifiedNormalFlowLayout();
-        } else if (updatedDiff == StyleDifferenceSimplifiedLayout)
-            setNeedsSimplifiedNormalFlowLayout();
-    }
-
-    if (updatedDiff == StyleDifferenceRepaintLayer || shouldRepaintForStyleDifference(updatedDiff)) {
-        // Do a repaint with the new style now, e.g., for example if we go from
-        // not having an outline to having an outline.
-        repaint();
-    }
-}
-
-void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
-{
-    // Optimize the common case
-    if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image()))
-        return;
-    
-    // Go through the new layers and addClients first, to avoid removing all clients of an image.
-    for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) {
-        if (currNew->image())
-            currNew->image()->addClient(this);
-    }
-
-    for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
-        if (currOld->image())
-            currOld->image()->removeClient(this);
-    }
-}
-
-void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage)
-{
-    if (oldImage != newImage) {
-        if (oldImage)
-            oldImage->removeClient(this);
-        if (newImage)
-            newImage->addClient(this);
-    }
-}
-
-#if ENABLE(CSS_SHAPES)
-void RenderObject::updateShapeImage(const ShapeValue* oldShapeValue, const ShapeValue* newShapeValue)
-{
-    if (oldShapeValue || newShapeValue)
-        updateImage(oldShapeValue ? oldShapeValue->image() : 0, newShapeValue ? newShapeValue->image() : 0);
-}
-#endif
-
 LayoutRect RenderObject::viewRect() const
 {
     return view().viewRect();
@@ -2333,28 +2151,6 @@
 
 void RenderObject::arenaDelete(RenderArena& arena, void* base)
 {
-    if (m_style) {
-        for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
-            if (StyleImage* backgroundImage = bgLayer->image())
-                backgroundImage->removeClient(this);
-        }
-
-        for (const FillLayer* maskLayer = m_style->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
-            if (StyleImage* maskImage = maskLayer->image())
-                maskImage->removeClient(this);
-        }
-
-        if (StyleImage* borderImage = m_style->borderImage().image())
-            borderImage->removeClient(this);
-
-        if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
-            maskBoxImage->removeClient(this);
-
-#if ENABLE(CSS_SHAPES)
-        removeShapeImageClient(m_style->shapeInside());
-#endif
-    }
-
 #ifndef NDEBUG
     void* savedBase = baseOfRenderObjectBeingDeleted;
     baseOfRenderObjectBeingDeleted = base;

Modified: trunk/Source/WebCore/rendering/RenderObject.h (156324 => 156325)


--- trunk/Source/WebCore/rendering/RenderObject.h	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2013-09-24 12:22:10 UTC (rev 156325)
@@ -677,12 +677,6 @@
 
     void scheduleRelayout();
 
-    void updateFillImages(const FillLayer*, const FillLayer*);
-    void updateImage(StyleImage*, StyleImage*);
-#if ENABLE(CSS_SHAPES)
-    void updateShapeImage(const ShapeValue*, const ShapeValue*);
-#endif
-
     virtual void paint(PaintInfo&, const LayoutPoint&);
 
     // Recursive function that computes the size and position of this object and all its descendants.
@@ -718,7 +712,7 @@
     void setAnimatableStyle(PassRefPtr<RenderStyle>);
 
     // Set the style of the object and update the state of the object accordingly.
-    virtual void setStyle(PassRefPtr<RenderStyle>);
+    virtual void setStyle(PassRefPtr<RenderStyle>) = 0;
 
     // Set the style of the object if it's generated content.
     void setPseudoStyle(PassRefPtr<RenderStyle>);
@@ -965,11 +959,6 @@
     RespectImageOrientationEnum shouldRespectImageOrientation() const;
 
 protected:
-    // Overrides should call the superclass at the end
-    virtual void styleWillChange(StyleDifference, const RenderStyle*) { }
-    // Overrides should call the superclass at the start
-    virtual void styleDidChange(StyleDifference, const RenderStyle*) { }
-
     void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
                             Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
 
@@ -999,11 +988,7 @@
     void removeFromRenderFlowThread();
     void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
 
-    bool shouldRepaintForStyleDifference(StyleDifference) const;
-    bool hasImmediateNonWhitespaceTextChild() const;
-
     RenderStyle* cachedFirstLineStyle() const;
-    StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
 
     Color selectionColor(int colorProperty) const;
 

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (156324 => 156325)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2013-09-24 12:22:10 UTC (rev 156325)
@@ -200,6 +200,22 @@
     return false;
 }
 
+void RenderText::setStyle(PassRefPtr<RenderStyle> style)
+{
+    if (style == this->style())
+        return;
+
+    StyleDifference diff = StyleDifferenceEqual;
+    unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
+    RefPtr<RenderStyle> oldStyle = this->style();
+    if (oldStyle.get())
+        diff = oldStyle->diff(style.get(), contextSensitiveProperties);
+
+    setStyleInternal(style);
+
+    styleDidChange(diff, oldStyle.get());
+}
+
 void RenderText::updateNeedsTranscoding()
 {
     const TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0;

Modified: trunk/Source/WebCore/rendering/RenderText.h (156324 => 156325)


--- trunk/Source/WebCore/rendering/RenderText.h	2013-09-24 10:36:46 UTC (rev 156324)
+++ trunk/Source/WebCore/rendering/RenderText.h	2013-09-24 12:22:10 UTC (rev 156325)
@@ -46,6 +46,8 @@
 
     virtual bool isTextFragment() const;
 
+    virtual void setStyle(PassRefPtr<RenderStyle>) OVERRIDE FINAL;
+
     virtual String originalText() const;
 
     void extractTextBox(InlineTextBox*);
@@ -149,8 +151,7 @@
     virtual void computePreferredLogicalWidths(float leadWidth);
     virtual void willBeDestroyed() OVERRIDE;
 
-    virtual void styleWillChange(StyleDifference, const RenderStyle*) OVERRIDE FINAL { }
-    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
+    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
     virtual void setTextInternal(const String&);
     virtual UChar previousCharacter() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to