Changeset 156619 in webkit


Ignore:
Timestamp:
Sep 29, 2013 3:16:06 PM (11 years ago)
Author:
pdr@google.com
Message:

Repaint borders and outlines on pseudo content changes
https://bugs.webkit.org/show_bug.cgi?id=122070

Reviewed by Andreas Kling.

Source/WebCore:

This patch fixes a regression from wkrev.com/150259 where pseudo content with
borders or outlines would fail to repaint if the color property changed.
The root bug is that border-color and outline-color properties use 'color' if
no explicit border-color or outline-color are given, and changing color should
repaint borders and outlines even if the text content is empty.

Relevant spec sections:
border: http://www.w3.org/TR/CSS1/#border-color
outline: http://www.w3.org/TR/CSS2/ui.html#propdef-outline-color

This patch also renames StyleDifferenceRepaintIfText to
StyleDifferenceRepaintIfTextOrBorderOrOutline and updates the relevant functions.

Test: fast/repaint/hover-pseudo-borders.html

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::hasImmediateNonWhitespaceTextChildOrBorderOrOutline):

This function has been renamed to reflect that it returns true for borders
or outlines as well.

(WebCore::RenderElement::shouldRepaintForStyleDifference):

  • rendering/RenderElement.h:
  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline):
(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:
  • rendering/style/RenderStyleConstants.h:
  • rendering/svg/SVGResourcesCache.cpp:

(WebCore::SVGResourcesCache::clientStyleChanged):

These have also been renamed to reflect the new borders and outlines check.

LayoutTests:

  • fast/repaint/hover-pseudo-borders.html: Added.
  • platform/mac/fast/repaint/hover-pseudo-borders-expected.png: Added.
  • platform/mac/fast/repaint/hover-pseudo-borders-expected.txt: Added.
Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r156616 r156619  
     12013-09-29  Philip Rogers  <pdr@google.com>
     2
     3        Repaint borders and outlines on pseudo content changes
     4        https://bugs.webkit.org/show_bug.cgi?id=122070
     5
     6        Reviewed by Andreas Kling.
     7
     8        * fast/repaint/hover-pseudo-borders.html: Added.
     9        * platform/mac/fast/repaint/hover-pseudo-borders-expected.png: Added.
     10        * platform/mac/fast/repaint/hover-pseudo-borders-expected.txt: Added.
     11
    1122013-09-29  Zan Dobersek  <zdobersek@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r156618 r156619  
     12013-09-29  Philip Rogers  <pdr@google.com>
     2
     3        Repaint borders and outlines on pseudo content changes
     4        https://bugs.webkit.org/show_bug.cgi?id=122070
     5
     6        Reviewed by Andreas Kling.
     7
     8        This patch fixes a regression from wkrev.com/150259 where pseudo content with
     9        borders or outlines would fail to repaint if the color property changed.
     10        The root bug is that border-color and outline-color properties use 'color' if
     11        no explicit border-color or outline-color are given, and changing color should
     12        repaint borders and outlines even if the text content is empty.
     13
     14        Relevant spec sections:
     15        border: http://www.w3.org/TR/CSS1/#border-color
     16        outline: http://www.w3.org/TR/CSS2/ui.html#propdef-outline-color
     17
     18        This patch also renames StyleDifferenceRepaintIfText to
     19        StyleDifferenceRepaintIfTextOrBorderOrOutline and updates the relevant functions.
     20
     21        Test: fast/repaint/hover-pseudo-borders.html
     22
     23        * rendering/RenderElement.cpp:
     24        (WebCore::RenderElement::hasImmediateNonWhitespaceTextChildOrBorderOrOutline):
     25
     26            This function has been renamed to reflect that it returns true for borders
     27            or outlines as well.
     28
     29        (WebCore::RenderElement::shouldRepaintForStyleDifference):
     30        * rendering/RenderElement.h:
     31        * rendering/style/RenderStyle.cpp:
     32        (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline):
     33        (WebCore::RenderStyle::diff):
     34        * rendering/style/RenderStyle.h:
     35        * rendering/style/RenderStyleConstants.h:
     36        * rendering/svg/SVGResourcesCache.cpp:
     37        (WebCore::SVGResourcesCache::clientStyleChanged):
     38            These have also been renamed to reflect the new borders and outlines check.
     39
    1402013-09-29  Antti Koivisto  <antti@apple.com>
    241
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r156608 r156619  
    285285}
    286286
    287 inline bool RenderElement::hasImmediateNonWhitespaceTextChild() const
     287inline bool RenderElement::hasImmediateNonWhitespaceTextChildOrBorderOrOutline() const
    288288{
    289289    for (const RenderObject* renderer = firstChild(); renderer; renderer = renderer->nextSibling()) {
    290290        if (renderer->isText() && !toRenderText(renderer)->isAllCollapsibleWhitespace())
    291291            return true;
     292        if (renderer->style()->hasOutline() || renderer->style()->hasBorder())
     293            return true;
    292294    }
    293295    return false;
     
    296298inline bool RenderElement::shouldRepaintForStyleDifference(StyleDifference diff) const
    297299{
    298     return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfText && hasImmediateNonWhitespaceTextChild());
     300    return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfTextOrBorderOrOutline && hasImmediateNonWhitespaceTextChildOrBorderOrOutline());
    299301}
    300302
  • trunk/Source/WebCore/rendering/RenderElement.h

    r156608 r156619  
    114114
    115115    bool shouldRepaintForStyleDifference(StyleDifference) const;
    116     bool hasImmediateNonWhitespaceTextChild() const;
     116    bool hasImmediateNonWhitespaceTextChildOrBorderOrOutline() const;
    117117
    118118    void updateFillImages(const FillLayer*, const FillLayer*);
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r156132 r156619  
    793793}
    794794
    795 bool RenderStyle::changeRequiresRepaintIfText(const RenderStyle* other, unsigned&) const
     795bool RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle* other, unsigned&) const
    796796{
    797797    if (inherited->color != other->inherited->color
     
    865865#endif
    866866
    867     if (changeRequiresRepaintIfText(other, changedContextSensitiveProperties))
    868         return StyleDifferenceRepaintIfText;
     867    if (changeRequiresRepaintIfTextOrBorderOrOutline(other, changedContextSensitiveProperties))
     868        return StyleDifferenceRepaintIfTextOrBorderOrOutline;
    869869
    870870    // Cursors are not checked, since they will be set appropriately in response to mouse events,
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r156613 r156619  
    18131813    bool changeRequiresLayerRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
    18141814    bool changeRequiresRepaint(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
    1815     bool changeRequiresRepaintIfText(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
     1815    bool changeRequiresRepaintIfTextOrBorderOrOutline(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
    18161816    bool changeRequiresRecompositeLayer(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
    18171817
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r154858 r156619  
    3939// - StyleDifferenceRecompositeLayer - The layer needs its position and transform updated, but no repaint
    4040// - StyleDifferenceRepaint - The object just needs to be repainted.
    41 // - StyleDifferenceRepaintIfText - The object needs to be repainted if it contains text.
     41// - StyleDifferenceRepaintIfTextOrBorderOrOutline - The object needs to be repainted if it contains text or a border or outline.
    4242// - StyleDifferenceRepaintLayer - The layer and its descendant layers needs to be repainted.
    4343// - StyleDifferenceLayoutPositionedMovementOnly - Only the position of this positioned object has been updated
     
    5151#endif
    5252    StyleDifferenceRepaint,
    53     StyleDifferenceRepaintIfText,
     53    StyleDifferenceRepaintIfTextOrBorderOrOutline,
    5454    StyleDifferenceRepaintLayer,
    5555    StyleDifferenceLayoutPositionedMovementOnly,
  • trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp

    r155755 r156619  
    127127
    128128    // In this case the proper SVGFE*Element will decide whether the modified CSS properties require a relayout or repaint.
    129     if (renderer->isSVGResourceFilterPrimitive() && (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfText))
     129    if (renderer->isSVGResourceFilterPrimitive() && (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfTextOrBorderOrOutline))
    130130        return;
    131131
Note: See TracChangeset for help on using the changeset viewer.