Changeset 156325 in webkit


Ignore:
Timestamp:
Sep 24, 2013 5:22:10 AM (11 years ago)
Author:
Antti Koivisto
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:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156322 r156325  
     12013-09-23  Antti Koivisto  <antti@apple.com>
     2
     3        Move more style change code from RenderObject to RenderElement
     4        https://bugs.webkit.org/show_bug.cgi?id=121822
     5
     6        Reviewed by Darin Adler.
     7
     8        * rendering/RenderElement.cpp:
     9        (WebCore::RenderElement::~RenderElement):
     10       
     11            RenderTexts are no longer registered as image clients. They don't need be unregistered either.
     12
     13        (WebCore::RenderElement::adjustStyleDifference):
     14        (WebCore::RenderElement::hasImmediateNonWhitespaceTextChild):
     15        (WebCore::RenderElement::shouldRepaintForStyleDifference):
     16        (WebCore::RenderElement::updateFillImages):
     17        (WebCore::RenderElement::updateImage):
     18        (WebCore::RenderElement::updateShapeImage):
     19        (WebCore::RenderElement::setStyle):
     20       
     21            Move from RenderObject and remove the text specific bits.
     22
     23        * rendering/RenderElement.h:
     24        * rendering/RenderObject.cpp:
     25        (WebCore::RenderObject::setStyle):
     26        (WebCore::RenderObject::arenaDelete):
     27        * rendering/RenderObject.h:
     28       
     29            Remove styleWill/DidChange which move to subclasses.
     30
     31        * rendering/RenderText.cpp:
     32        (WebCore::RenderText::setStyle):
     33       
     34            Add simple text specific setStyle.
     35
     36        * rendering/RenderText.h:
     37
    1382013-09-24  Andrei Parvu  <parvu@adobe.com>
    239
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r156312 r156325  
    7272RenderElement::~RenderElement()
    7373{
     74    if (m_style) {
     75        for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
     76            if (StyleImage* backgroundImage = bgLayer->image())
     77                backgroundImage->removeClient(this);
     78        }
     79
     80        for (const FillLayer* maskLayer = m_style->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
     81            if (StyleImage* maskImage = maskLayer->image())
     82                maskImage->removeClient(this);
     83        }
     84
     85        if (StyleImage* borderImage = m_style->borderImage().image())
     86            borderImage->removeClient(this);
     87
     88        if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
     89            maskBoxImage->removeClient(this);
     90
     91#if ENABLE(CSS_SHAPES)
     92        removeShapeImageClient(m_style->shapeInside());
     93#endif
     94    }
    7495}
    7596
     
    153174}
    154175
     176StyleDifference RenderElement::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const
     177{
     178#if USE(ACCELERATED_COMPOSITING)
     179    // If transform changed, and we are not composited, need to do a layout.
     180    if (contextSensitiveProperties & ContextSensitivePropertyTransform) {
     181        // Text nodes share style with their parents but transforms don't apply to them,
     182        // hence the !isText() check.
     183        // FIXME: when transforms are taken into account for overflow, we will need to do a layout.
     184        if (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited()) {
     185            // We need to set at least SimplifiedLayout, but if PositionedMovementOnly is already set
     186            // then we actually need SimplifiedLayoutAndPositionedMovement.
     187            if (!hasLayer())
     188                diff = StyleDifferenceLayout; // FIXME: Do this for now since SimplifiedLayout cannot handle updating floating objects lists.
     189            else if (diff < StyleDifferenceLayoutPositionedMovementOnly)
     190                diff = StyleDifferenceSimplifiedLayout;
     191            else if (diff < StyleDifferenceSimplifiedLayout)
     192                diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement;
     193        } else if (diff < StyleDifferenceRecompositeLayer)
     194            diff = StyleDifferenceRecompositeLayer;
     195    }
     196
     197    // If opacity changed, and we are not composited, need to repaint (also
     198    // ignoring text nodes)
     199    if (contextSensitiveProperties & ContextSensitivePropertyOpacity) {
     200        if (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited())
     201            diff = StyleDifferenceRepaintLayer;
     202        else if (diff < StyleDifferenceRecompositeLayer)
     203            diff = StyleDifferenceRecompositeLayer;
     204    }
     205   
     206#if ENABLE(CSS_FILTERS)
     207    if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLayer()) {
     208        RenderLayer* layer = toRenderLayerModelObject(this)->layer();
     209        if (!layer->isComposited() || layer->paintsWithFilters())
     210            diff = StyleDifferenceRepaintLayer;
     211        else if (diff < StyleDifferenceRecompositeLayer)
     212            diff = StyleDifferenceRecompositeLayer;
     213    }
     214#endif
     215   
     216    // The answer to requiresLayer() for plugins, iframes, and canvas can change without the actual
     217    // style changing, since it depends on whether we decide to composite these elements. When the
     218    // layer status of one of these elements changes, we need to force a layout.
     219    if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) {
     220        if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer())
     221            diff = StyleDifferenceLayout;
     222    }
     223#else
     224    UNUSED_PARAM(contextSensitiveProperties);
     225#endif
     226
     227    // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
     228    if (diff == StyleDifferenceRepaintLayer && !hasLayer())
     229        diff = StyleDifferenceRepaint;
     230
     231    return diff;
     232}
     233
     234inline bool RenderElement::hasImmediateNonWhitespaceTextChild() const
     235{
     236    for (const RenderObject* renderer = firstChild(); renderer; renderer = renderer->nextSibling()) {
     237        if (renderer->isText() && !toRenderText(renderer)->isAllCollapsibleWhitespace())
     238            return true;
     239    }
     240    return false;
     241}
     242
     243inline bool RenderElement::shouldRepaintForStyleDifference(StyleDifference diff) const
     244{
     245    return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfText && hasImmediateNonWhitespaceTextChild());
     246}
     247
     248void RenderElement::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
     249{
     250    // Optimize the common case
     251    if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image()))
     252        return;
     253   
     254    // Go through the new layers and addClients first, to avoid removing all clients of an image.
     255    for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) {
     256        if (currNew->image())
     257            currNew->image()->addClient(this);
     258    }
     259
     260    for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
     261        if (currOld->image())
     262            currOld->image()->removeClient(this);
     263    }
     264}
     265
     266void RenderElement::updateImage(StyleImage* oldImage, StyleImage* newImage)
     267{
     268    if (oldImage == newImage)
     269        return;
     270    if (oldImage)
     271        oldImage->removeClient(this);
     272    if (newImage)
     273        newImage->addClient(this);
     274}
     275
     276#if ENABLE(CSS_SHAPES)
     277void RenderElement::updateShapeImage(const ShapeValue* oldShapeValue, const ShapeValue* newShapeValue)
     278{
     279    if (oldShapeValue || newShapeValue)
     280        updateImage(oldShapeValue ? oldShapeValue->image() : 0, newShapeValue ? newShapeValue->image() : 0);
     281}
     282#endif
     283
     284void RenderElement::setStyle(PassRefPtr<RenderStyle> style)
     285{
     286    if (m_style == style) {
     287#if USE(ACCELERATED_COMPOSITING)
     288        // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
     289        // style sharing is disabled for them. That should ensure that we never hit this code path.
     290        ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas());
     291#endif
     292        return;
     293    }
     294
     295    StyleDifference diff = StyleDifferenceEqual;
     296    unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
     297    if (m_style)
     298        diff = m_style->diff(style.get(), contextSensitiveProperties);
     299
     300    diff = adjustStyleDifference(diff, contextSensitiveProperties);
     301
     302    styleWillChange(diff, style.get());
     303   
     304    RefPtr<RenderStyle> oldStyle = m_style.release();
     305    setStyleInternal(style);
     306
     307    updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_style->backgroundLayers() : 0);
     308    updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->maskLayers() : 0);
     309
     310    updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_style->borderImage().image() : 0);
     311    updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0);
     312
     313#if ENABLE(CSS_SHAPES)
     314    updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0);
     315#endif
     316
     317    // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
     318    // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
     319    if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline))
     320        view().setMaximalOutlineSize(m_style->outlineSize());
     321
     322    bool doesNotNeedLayout = !parent();
     323
     324    styleDidChange(diff, oldStyle.get());
     325
     326    // FIXME: |this| might be destroyed here. This can currently happen for a RenderTextFragment when
     327    // its first-letter block gets an update in RenderTextFragment::styleDidChange. For RenderTextFragment(s),
     328    // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition
     329    // in the future as we move renderer changes out of layout and into style changes.
     330    if (doesNotNeedLayout)
     331        return;
     332
     333    // Now that the layer (if any) has been updated, we need to adjust the diff again,
     334    // check whether we should layout now, and decide if we need to repaint.
     335    StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitiveProperties);
     336   
     337    if (diff <= StyleDifferenceLayoutPositionedMovementOnly) {
     338        if (updatedDiff == StyleDifferenceLayout)
     339            setNeedsLayoutAndPrefWidthsRecalc();
     340        else if (updatedDiff == StyleDifferenceLayoutPositionedMovementOnly)
     341            setNeedsPositionedMovementLayout(oldStyle.get());
     342        else if (updatedDiff == StyleDifferenceSimplifiedLayoutAndPositionedMovement) {
     343            setNeedsPositionedMovementLayout(oldStyle.get());
     344            setNeedsSimplifiedNormalFlowLayout();
     345        } else if (updatedDiff == StyleDifferenceSimplifiedLayout)
     346            setNeedsSimplifiedNormalFlowLayout();
     347    }
     348
     349    if (updatedDiff == StyleDifferenceRepaintLayer || shouldRepaintForStyleDifference(updatedDiff)) {
     350        // Do a repaint with the new style now, e.g., for example if we go from
     351        // not having an outline to having an outline.
     352        repaint();
     353    }
     354}
     355
    155356void RenderElement::addChild(RenderObject* newChild, RenderObject* beforeChild)
    156357{
  • trunk/Source/WebCore/rendering/RenderElement.h

    r156312 r156325  
    3333
    3434    static RenderElement* createFor(Element&, RenderStyle&);
     35
     36    virtual void setStyle(PassRefPtr<RenderStyle>) OVERRIDE;
    3537
    3638    // This is null for anonymous renderers.
     
    7779    void destroyLeftoverChildren();
    7880
    79     virtual void styleWillChange(StyleDifference, const RenderStyle*) OVERRIDE;
    80     virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE;
     81    virtual void styleWillChange(StyleDifference, const RenderStyle*);
     82    virtual void styleDidChange(StyleDifference, const RenderStyle*);
     83
    8184    virtual void insertedIntoTree() OVERRIDE;
    8285    virtual void willBeRemovedFromTree() OVERRIDE;
     
    9295    virtual RenderObject* firstChildSlow() const OVERRIDE FINAL { return firstChild(); }
    9396    virtual RenderObject* lastChildSlow() const OVERRIDE FINAL { return lastChild(); }
     97
     98    bool shouldRepaintForStyleDifference(StyleDifference) const;
     99    bool hasImmediateNonWhitespaceTextChild() const;
     100
     101    void updateFillImages(const FillLayer*, const FillLayer*);
     102    void updateImage(StyleImage*, StyleImage*);
     103#if ENABLE(CSS_SHAPES)
     104    void updateShapeImage(const ShapeValue*, const ShapeValue*);
     105#endif
     106
     107    StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
    94108
    95109    RenderObject* m_firstChild;
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r156312 r156325  
    16731673}
    16741674
    1675 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const
    1676 {
    1677 #if USE(ACCELERATED_COMPOSITING)
    1678     // If transform changed, and we are not composited, need to do a layout.
    1679     if (contextSensitiveProperties & ContextSensitivePropertyTransform) {
    1680         // Text nodes share style with their parents but transforms don't apply to them,
    1681         // hence the !isText() check.
    1682         // FIXME: when transforms are taken into account for overflow, we will need to do a layout.
    1683         if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited())) {
    1684             // We need to set at least SimplifiedLayout, but if PositionedMovementOnly is already set
    1685             // then we actually need SimplifiedLayoutAndPositionedMovement.
    1686             if (!hasLayer())
    1687                 diff = StyleDifferenceLayout; // FIXME: Do this for now since SimplifiedLayout cannot handle updating floating objects lists.
    1688             else if (diff < StyleDifferenceLayoutPositionedMovementOnly)
    1689                 diff = StyleDifferenceSimplifiedLayout;
    1690             else if (diff < StyleDifferenceSimplifiedLayout)
    1691                 diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement;
    1692         } else if (diff < StyleDifferenceRecompositeLayer)
    1693             diff = StyleDifferenceRecompositeLayer;
    1694     }
    1695 
    1696     // If opacity changed, and we are not composited, need to repaint (also
    1697     // ignoring text nodes)
    1698     if (contextSensitiveProperties & ContextSensitivePropertyOpacity) {
    1699         if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->isComposited()))
    1700             diff = StyleDifferenceRepaintLayer;
    1701         else if (diff < StyleDifferenceRecompositeLayer)
    1702             diff = StyleDifferenceRecompositeLayer;
    1703     }
    1704    
    1705 #if ENABLE(CSS_FILTERS)
    1706     if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLayer()) {
    1707         RenderLayer* layer = toRenderLayerModelObject(this)->layer();
    1708         if (!layer->isComposited() || layer->paintsWithFilters())
    1709             diff = StyleDifferenceRepaintLayer;
    1710         else if (diff < StyleDifferenceRecompositeLayer)
    1711             diff = StyleDifferenceRecompositeLayer;
    1712     }
    1713 #endif
    1714    
    1715     // The answer to requiresLayer() for plugins, iframes, and canvas can change without the actual
    1716     // style changing, since it depends on whether we decide to composite these elements. When the
    1717     // layer status of one of these elements changes, we need to force a layout.
    1718     if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) {
    1719         if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer())
    1720             diff = StyleDifferenceLayout;
    1721     }
    1722 #else
    1723     UNUSED_PARAM(contextSensitiveProperties);
    1724 #endif
    1725 
    1726     // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
    1727     if (diff == StyleDifferenceRepaintLayer && !hasLayer())
    1728         diff = StyleDifferenceRepaint;
    1729 
    1730     return diff;
    1731 }
    1732 
    17331675void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)
    17341676{
     
    17471689    setStyle(pseudoStyle);
    17481690}
    1749 
    1750 inline bool RenderObject::hasImmediateNonWhitespaceTextChild() const
    1751 {
    1752     if (isText())
    1753         return false;
    1754     for (const RenderObject* r = toRenderElement(this)->firstChild(); r; r = r->nextSibling()) {
    1755         if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace())
    1756             return true;
    1757     }
    1758     return false;
    1759 }
    1760 
    1761 bool RenderObject::shouldRepaintForStyleDifference(StyleDifference diff) const
    1762 {
    1763     return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfText && hasImmediateNonWhitespaceTextChild());
    1764 }
    1765 
    1766 void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
    1767 {
    1768     if (m_style == style) {
    1769 #if USE(ACCELERATED_COMPOSITING)
    1770         // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
    1771         // style sharing is disabled for them. That should ensure that we never hit this code path.
    1772         ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas());
    1773 #endif
    1774         return;
    1775     }
    1776 
    1777     StyleDifference diff = StyleDifferenceEqual;
    1778     unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
    1779     if (m_style)
    1780         diff = m_style->diff(style.get(), contextSensitiveProperties);
    1781 
    1782     diff = adjustStyleDifference(diff, contextSensitiveProperties);
    1783 
    1784     styleWillChange(diff, style.get());
    1785    
    1786     RefPtr<RenderStyle> oldStyle = m_style.release();
    1787     setStyleInternal(style);
    1788 
    1789     updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_style->backgroundLayers() : 0);
    1790     updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->maskLayers() : 0);
    1791 
    1792     updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_style->borderImage().image() : 0);
    1793     updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0);
    1794 
    1795 #if ENABLE(CSS_SHAPES)
    1796     updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0);
    1797 #endif
    1798 
    1799     // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
    1800     // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
    1801     if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline))
    1802         view().setMaximalOutlineSize(m_style->outlineSize());
    1803 
    1804     bool doesNotNeedLayout = !m_parent || isText();
    1805 
    1806     styleDidChange(diff, oldStyle.get());
    1807 
    1808     // FIXME: |this| might be destroyed here. This can currently happen for a RenderTextFragment when
    1809     // its first-letter block gets an update in RenderTextFragment::styleDidChange. For RenderTextFragment(s),
    1810     // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition
    1811     // in the future as we move renderer changes out of layout and into style changes.
    1812     if (doesNotNeedLayout)
    1813         return;
    1814 
    1815     // Now that the layer (if any) has been updated, we need to adjust the diff again,
    1816     // check whether we should layout now, and decide if we need to repaint.
    1817     StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitiveProperties);
    1818    
    1819     if (diff <= StyleDifferenceLayoutPositionedMovementOnly) {
    1820         if (updatedDiff == StyleDifferenceLayout)
    1821             setNeedsLayoutAndPrefWidthsRecalc();
    1822         else if (updatedDiff == StyleDifferenceLayoutPositionedMovementOnly)
    1823             setNeedsPositionedMovementLayout(oldStyle.get());
    1824         else if (updatedDiff == StyleDifferenceSimplifiedLayoutAndPositionedMovement) {
    1825             setNeedsPositionedMovementLayout(oldStyle.get());
    1826             setNeedsSimplifiedNormalFlowLayout();
    1827         } else if (updatedDiff == StyleDifferenceSimplifiedLayout)
    1828             setNeedsSimplifiedNormalFlowLayout();
    1829     }
    1830 
    1831     if (updatedDiff == StyleDifferenceRepaintLayer || shouldRepaintForStyleDifference(updatedDiff)) {
    1832         // Do a repaint with the new style now, e.g., for example if we go from
    1833         // not having an outline to having an outline.
    1834         repaint();
    1835     }
    1836 }
    1837 
    1838 void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
    1839 {
    1840     // Optimize the common case
    1841     if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image()))
    1842         return;
    1843    
    1844     // Go through the new layers and addClients first, to avoid removing all clients of an image.
    1845     for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) {
    1846         if (currNew->image())
    1847             currNew->image()->addClient(this);
    1848     }
    1849 
    1850     for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
    1851         if (currOld->image())
    1852             currOld->image()->removeClient(this);
    1853     }
    1854 }
    1855 
    1856 void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage)
    1857 {
    1858     if (oldImage != newImage) {
    1859         if (oldImage)
    1860             oldImage->removeClient(this);
    1861         if (newImage)
    1862             newImage->addClient(this);
    1863     }
    1864 }
    1865 
    1866 #if ENABLE(CSS_SHAPES)
    1867 void RenderObject::updateShapeImage(const ShapeValue* oldShapeValue, const ShapeValue* newShapeValue)
    1868 {
    1869     if (oldShapeValue || newShapeValue)
    1870         updateImage(oldShapeValue ? oldShapeValue->image() : 0, newShapeValue ? newShapeValue->image() : 0);
    1871 }
    1872 #endif
    18731691
    18741692LayoutRect RenderObject::viewRect() const
     
    23342152void RenderObject::arenaDelete(RenderArena& arena, void* base)
    23352153{
    2336     if (m_style) {
    2337         for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
    2338             if (StyleImage* backgroundImage = bgLayer->image())
    2339                 backgroundImage->removeClient(this);
    2340         }
    2341 
    2342         for (const FillLayer* maskLayer = m_style->maskLayers(); maskLayer; maskLayer = maskLayer->next()) {
    2343             if (StyleImage* maskImage = maskLayer->image())
    2344                 maskImage->removeClient(this);
    2345         }
    2346 
    2347         if (StyleImage* borderImage = m_style->borderImage().image())
    2348             borderImage->removeClient(this);
    2349 
    2350         if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
    2351             maskBoxImage->removeClient(this);
    2352 
    2353 #if ENABLE(CSS_SHAPES)
    2354         removeShapeImageClient(m_style->shapeInside());
    2355 #endif
    2356     }
    2357 
    23582154#ifndef NDEBUG
    23592155    void* savedBase = baseOfRenderObjectBeingDeleted;
  • trunk/Source/WebCore/rendering/RenderObject.h

    r156312 r156325  
    678678    void scheduleRelayout();
    679679
    680     void updateFillImages(const FillLayer*, const FillLayer*);
    681     void updateImage(StyleImage*, StyleImage*);
    682 #if ENABLE(CSS_SHAPES)
    683     void updateShapeImage(const ShapeValue*, const ShapeValue*);
    684 #endif
    685 
    686680    virtual void paint(PaintInfo&, const LayoutPoint&);
    687681
     
    719713
    720714    // Set the style of the object and update the state of the object accordingly.
    721     virtual void setStyle(PassRefPtr<RenderStyle>);
     715    virtual void setStyle(PassRefPtr<RenderStyle>) = 0;
    722716
    723717    // Set the style of the object if it's generated content.
     
    966960
    967961protected:
    968     // Overrides should call the superclass at the end
    969     virtual void styleWillChange(StyleDifference, const RenderStyle*) { }
    970     // Overrides should call the superclass at the start
    971     virtual void styleDidChange(StyleDifference, const RenderStyle*) { }
    972 
    973962    void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
    974963                            Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
     
    1000989    void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
    1001990
    1002     bool shouldRepaintForStyleDifference(StyleDifference) const;
    1003     bool hasImmediateNonWhitespaceTextChild() const;
    1004 
    1005991    RenderStyle* cachedFirstLineStyle() const;
    1006     StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
    1007992
    1008993    Color selectionColor(int colorProperty) const;
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r156090 r156325  
    199199{
    200200    return false;
     201}
     202
     203void RenderText::setStyle(PassRefPtr<RenderStyle> style)
     204{
     205    if (style == this->style())
     206        return;
     207
     208    StyleDifference diff = StyleDifferenceEqual;
     209    unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
     210    RefPtr<RenderStyle> oldStyle = this->style();
     211    if (oldStyle.get())
     212        diff = oldStyle->diff(style.get(), contextSensitiveProperties);
     213
     214    setStyleInternal(style);
     215
     216    styleDidChange(diff, oldStyle.get());
    201217}
    202218
  • trunk/Source/WebCore/rendering/RenderText.h

    r156278 r156325  
    4646
    4747    virtual bool isTextFragment() const;
     48
     49    virtual void setStyle(PassRefPtr<RenderStyle>) OVERRIDE FINAL;
    4850
    4951    virtual String originalText() const;
     
    150152    virtual void willBeDestroyed() OVERRIDE;
    151153
    152     virtual void styleWillChange(StyleDifference, const RenderStyle*) OVERRIDE FINAL { }
    153     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
     154    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
    154155
    155156    virtual void setTextInternal(const String&);
Note: See TracChangeset for help on using the changeset viewer.