Changeset 53017 in webkit


Ignore:
Timestamp:
Jan 8, 2010 3:35:19 PM (14 years ago)
Author:
Beth Dakin
Message:

WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=32757 Repaint bug
with -webkit-shadow on svg shapes
-and-
<rdar://problem/7389149>

Reviewed by Oliver Hunt.

Inflate the repaintRect for the shadow using its extent.

  • rendering/RenderForeignObject.cpp:

(WebCore::RenderForeignObject::computeRectForRepaint):

  • rendering/RenderSVGImage.cpp:

(WebCore::RenderSVGImage::computeRectForRepaint):

  • rendering/RenderSVGModelObject.cpp:

(WebCore::RenderSVGModelObject::computeRectForRepaint):

  • rendering/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::repaintRectInLocalCoordinates):
(WebCore::RenderSVGRoot::computeRectForRepaint):

  • rendering/RenderSVGText.cpp:

(WebCore::RenderSVGText::computeRectForRepaint):

  • rendering/SVGRenderSupport.cpp:

(WebCore::getSVGShadowExtent):
(WebCore::SVGRenderBase::inflateForShadow):

  • rendering/SVGRenderSupport.h:

LayoutTests: Tests for https://bugs.webkit.org/show_bug.cgi?id=32757 Repaint bug
with -webkit-shadow on svg shapes
-and-
<rdar://problem/7389149>

Reviewed by Oliver Hunt.

  • fast/repaint/moving-shadow-on-container.html: Added.
  • fast/repaint/moving-shadow-on-path.html: Added.
  • platform/mac/fast/repaint/moving-shadow-on-container-expected.checksum: Added.
  • platform/mac/fast/repaint/moving-shadow-on-container-expected.png: Added.
  • platform/mac/fast/repaint/moving-shadow-on-container-expected.txt: Added.
  • platform/mac/fast/repaint/moving-shadow-on-path-expected.checksum: Added.
  • platform/mac/fast/repaint/moving-shadow-on-path-expected.png: Added.
  • platform/mac/fast/repaint/moving-shadow-on-path-expected.txt: Added.
Location:
trunk
Files:
8 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53012 r53017  
     12010-01-08  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Tests for https://bugs.webkit.org/show_bug.cgi?id=32757 Repaint bug
     6        with -webkit-shadow on svg shapes
     7        -and-
     8        <rdar://problem/7389149>
     9
     10        * fast/repaint/moving-shadow-on-container.html: Added.
     11        * fast/repaint/moving-shadow-on-path.html: Added.
     12        * platform/mac/fast/repaint/moving-shadow-on-container-expected.checksum: Added.
     13        * platform/mac/fast/repaint/moving-shadow-on-container-expected.png: Added.
     14        * platform/mac/fast/repaint/moving-shadow-on-container-expected.txt: Added.
     15        * platform/mac/fast/repaint/moving-shadow-on-path-expected.checksum: Added.
     16        * platform/mac/fast/repaint/moving-shadow-on-path-expected.png: Added.
     17        * platform/mac/fast/repaint/moving-shadow-on-path-expected.txt: Added.
     18
    1192010-01-08  Alexey Proskuryakov  <ap@apple.com>
    220
  • trunk/WebCore/ChangeLog

    r53009 r53017  
     12010-01-08  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=32757 Repaint bug
     6        with -webkit-shadow on svg shapes
     7        -and-
     8        <rdar://problem/7389149>
     9
     10        Inflate the repaintRect for the shadow using its extent.
     11        * rendering/RenderForeignObject.cpp:
     12        (WebCore::RenderForeignObject::computeRectForRepaint):
     13        * rendering/RenderSVGImage.cpp:
     14        (WebCore::RenderSVGImage::computeRectForRepaint):
     15        * rendering/RenderSVGModelObject.cpp:
     16        (WebCore::RenderSVGModelObject::computeRectForRepaint):
     17        * rendering/RenderSVGRoot.cpp:
     18        (WebCore::RenderSVGRoot::repaintRectInLocalCoordinates):
     19        (WebCore::RenderSVGRoot::computeRectForRepaint):
     20        * rendering/RenderSVGText.cpp:
     21        (WebCore::RenderSVGText::computeRectForRepaint):
     22        * rendering/SVGRenderSupport.cpp:
     23        (WebCore::getSVGShadowExtent):
     24        (WebCore::SVGRenderBase::inflateForShadow):
     25        * rendering/SVGRenderSupport.h:
     26
    1272010-01-08  Kenneth Russell  <kbr@google.com>
    228
  • trunk/WebCore/rendering/RenderForeignObject.cpp

    r43211 r53017  
    8585{
    8686    rect = localToParentTransform().mapRect(rect);
     87    inflateForShadow(style(), rect);
    8788    RenderBlock::computeRectForRepaint(repaintContainer, rect, fixed);
    8889}
  • trunk/WebCore/rendering/RenderSVGImage.cpp

    r52865 r53017  
    176176void RenderSVGImage::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    177177{
     178    inflateForShadow(style(), repaintRect);
    178179    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
    179180}
  • trunk/WebCore/rendering/RenderSVGModelObject.cpp

    r44253 r53017  
    5757void RenderSVGModelObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    5858{
     59    inflateForShadow(style(), repaintRect);
    5960    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
    6061}
  • trunk/WebCore/rendering/RenderSVGRoot.cpp

    r52584 r53017  
    252252FloatRect RenderSVGRoot::repaintRectInLocalCoordinates() const
    253253{
    254     // FIXME: This does not include the border but it should!
     254    // FIXME: This does not include the border or shadow but it should!
    255255    return computeContainerBoundingBox(this, true);
    256256}
     
    263263void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    264264{
    265     // Apply our local transforms (except for x/y translation) and call RenderBox's method to handle all the normal CSS Box model bits
     265    // Apply our local transforms (except for x/y translation), then our shadow,
     266    // and then call RenderBox's method to handle all the normal CSS Box model bits
    266267    repaintRect = localToBorderBoxTransform().mapRect(repaintRect);
     268    inflateForShadow(style(), repaintRect);
    267269    RenderBox::computeRectForRepaint(repaintContainer, repaintRect, fixed);
    268270}
  • trunk/WebCore/rendering/RenderSVGText.cpp

    r52647 r53017  
    6060void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    6161{
     62    inflateForShadow(style(), repaintRect);
    6263    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
    6364}
  • trunk/WebCore/rendering/SVGRenderSupport.cpp

    r52647 r53017  
    4141#include <wtf/UnusedParam.h>
    4242
     43using namespace std;
     44
    4345namespace WebCore {
    4446
     
    5860    object->computeRectForRepaint(repaintContainer, repaintRect);
    5961    return repaintRect;
     62}
     63
     64static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bottom, int& left)
     65{
     66    top = 0;
     67    right = 0;
     68    bottom = 0;
     69    left = 0;
     70
     71    int blurAndSpread = shadow->blur + shadow->spread;
     72
     73    top = min(top, shadow->y - blurAndSpread);
     74    right = max(right, shadow->x + blurAndSpread);
     75    bottom = max(bottom, shadow->y + blurAndSpread);
     76    left = min(left, shadow->x - blurAndSpread);
     77}
     78
     79void SVGRenderBase::inflateForShadow(RenderStyle* style, IntRect& repaintRect) const
     80{
     81    ASSERT(style);
     82    if (!style)
     83        return;
     84
     85    ShadowData* shadow = style->svgStyle()->shadow();
     86    if (!shadow)
     87        return;
     88
     89    int shadowTop;
     90    int shadowRight;
     91    int shadowBottom;
     92    int shadowLeft;
     93    getSVGShadowExtent(shadow, shadowTop, shadowRight, shadowBottom, shadowLeft);
     94
     95    int overflowLeft = repaintRect.x() + shadowLeft;
     96    int overflowRight = repaintRect.right() + shadowRight;
     97    int overflowTop = repaintRect.y() + shadowTop;
     98    int overflowBottom = repaintRect.bottom() + shadowBottom;
     99
     100    repaintRect.setX(overflowLeft);
     101    repaintRect.setY(overflowTop);
     102    repaintRect.setWidth(overflowRight - overflowLeft);
     103    repaintRect.setHeight(overflowBottom - overflowTop);
    60104}
    61105
  • trunk/WebCore/rendering/SVGRenderSupport.h

    r52647 r53017  
    5656        FloatRect clipperBoundingBoxForRenderer(const RenderObject*) const;
    5757        FloatRect maskerBoundingBoxForRenderer(const RenderObject*) const;
     58
     59        virtual void inflateForShadow(RenderStyle*, IntRect&) const;
     60
    5861    protected:
    5962        static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer);
Note: See TracChangeset for help on using the changeset viewer.