Changeset 53103 in webkit


Ignore:
Timestamp:
Jan 11, 2010 2:56:09 PM (14 years ago)
Author:
Beth Dakin
Message:

WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=33491 REGRESSION:
Many SVG -webkit-shadow tests are currently failing (in the pixel
tests)
-and-
<rdar://problem/7501200>

Reviewed by Oliver Hunt.

The real fix here is to call inflateForShadow() on the repaintRect
in prepareToRenderSVGContent(). But in order to do that, I had to
move inflateForShadow() to a different class since functions in
SVGRenderBase cannot call each other. inflateForShadow() now exists
in SVGRenderStyle which I think makes some sense because a similar
function that returns a box shadow's extent exists on RenderStyle.

Now call inflateForShadow() through the SVGRenderStyle.

  • rendering/RenderForeignObject.cpp:

(WebCore::RenderForeignObject::computeRectForRepaint):

  • rendering/RenderSVGImage.cpp:

(WebCore::RenderSVGImage::computeRectForRepaint):

  • rendering/RenderSVGModelObject.cpp:

(WebCore::RenderSVGModelObject::computeRectForRepaint):

  • rendering/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::computeRectForRepaint):

  • rendering/RenderSVGText.cpp:

(WebCore::RenderSVGText::computeRectForRepaint):

No longer implement inflateForShadow() here.

  • rendering/SVGRenderSupport.cpp:

(WebCore::SVGRenderBase::prepareToRenderSVGContent): Call new
inflateForShadow() through the SVGRenderStyle

  • rendering/SVGRenderSupport.h:

Implementation of inflateForShadow() now lives here.

  • rendering/style/SVGRenderStyle.cpp:

(WebCore::getSVGShadowExtent):
(WebCore::SVGRenderStyle::inflateForShadow):

  • rendering/style/SVGRenderStyle.h:

LayoutTests: New tests for https://bugs.webkit.org/show_bug.cgi?id=33491
REGRESSION: Many SVG -webkit-shadow tests are currently failing (in
the pixel tests)
-and-
<rdar://problem/7501200>

Reviewed by Oliver Hunt.

I would like to note that this change fixes some existing layout
tests as well.

  • platform/mac/svg/css/shadow-with-large-radius-expected.checksum: Added.
  • platform/mac/svg/css/shadow-with-large-radius-expected.png: Added.
  • platform/mac/svg/css/shadow-with-large-radius-expected.txt: Added.
  • platform/mac/svg/css/shadow-with-negative-offset-expected.checksum: Added.
  • platform/mac/svg/css/shadow-with-negative-offset-expected.png: Added.
  • platform/mac/svg/css/shadow-with-negative-offset-expected.txt: Added.
  • platform/mac/svg/css/stars-with-shadow-expected.checksum:
  • platform/mac/svg/css/stars-with-shadow-expected.png:
  • svg/css/shadow-with-large-radius.svg: Added.
  • svg/css/shadow-with-negative-offset.svg: Added.
Location:
trunk
Files:
8 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53102 r53103  
     12010-01-11  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4       
     5        New tests for https://bugs.webkit.org/show_bug.cgi?id=33491
     6        REGRESSION: Many SVG -webkit-shadow tests are currently failing (in
     7        the pixel tests)
     8        -and-
     9        <rdar://problem/7501200>
     10
     11        I would like to note that this change fixes some existing layout
     12        tests as well.
     13
     14        * platform/mac/svg/css/shadow-with-large-radius-expected.checksum: Added.
     15        * platform/mac/svg/css/shadow-with-large-radius-expected.png: Added.
     16        * platform/mac/svg/css/shadow-with-large-radius-expected.txt: Added.
     17        * platform/mac/svg/css/shadow-with-negative-offset-expected.checksum: Added.
     18        * platform/mac/svg/css/shadow-with-negative-offset-expected.png: Added.
     19        * platform/mac/svg/css/shadow-with-negative-offset-expected.txt: Added.
     20        * platform/mac/svg/css/stars-with-shadow-expected.checksum:
     21        * platform/mac/svg/css/stars-with-shadow-expected.png:
     22        * svg/css/shadow-with-large-radius.svg: Added.
     23        * svg/css/shadow-with-negative-offset.svg: Added.
     24
     25
    1262010-01-11  Eric Seidel  <eric@webkit.org>
    227
  • trunk/LayoutTests/platform/mac/svg/css/stars-with-shadow-expected.checksum

    r51800 r53103  
    1 201684955d552b1a57f8bced9aaa6e4e
     1de73673c1e37edf6d9f7f141bdf10bd0
  • trunk/WebCore/ChangeLog

    r53100 r53103  
     12010-01-11  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=33491 REGRESSION:
     6        Many SVG -webkit-shadow tests are currently failing (in the pixel
     7        tests)
     8        -and-
     9        <rdar://problem/7501200>
     10
     11        The real fix here is to call inflateForShadow() on the repaintRect
     12        in prepareToRenderSVGContent(). But in order to do that, I had to
     13        move inflateForShadow() to a different class since functions in
     14        SVGRenderBase cannot call each other. inflateForShadow() now exists
     15        in SVGRenderStyle which I think makes some sense because a similar
     16        function that returns a box shadow's extent exists on RenderStyle.
     17
     18        Now call inflateForShadow() through the SVGRenderStyle.
     19        * rendering/RenderForeignObject.cpp:
     20        (WebCore::RenderForeignObject::computeRectForRepaint):
     21        * rendering/RenderSVGImage.cpp:
     22        (WebCore::RenderSVGImage::computeRectForRepaint):
     23        * rendering/RenderSVGModelObject.cpp:
     24        (WebCore::RenderSVGModelObject::computeRectForRepaint):
     25        * rendering/RenderSVGRoot.cpp:
     26        (WebCore::RenderSVGRoot::computeRectForRepaint):
     27        * rendering/RenderSVGText.cpp:
     28        (WebCore::RenderSVGText::computeRectForRepaint):
     29
     30        No longer implement inflateForShadow() here.
     31        * rendering/SVGRenderSupport.cpp:
     32        (WebCore::SVGRenderBase::prepareToRenderSVGContent): Call new
     33        inflateForShadow() through the SVGRenderStyle
     34        * rendering/SVGRenderSupport.h:
     35
     36        Implementation of inflateForShadow() now lives here.
     37        * rendering/style/SVGRenderStyle.cpp:
     38        (WebCore::getSVGShadowExtent):
     39        (WebCore::SVGRenderStyle::inflateForShadow):
     40        * rendering/style/SVGRenderStyle.h:
     41
    1422010-01-11  Alexander Pavlov  <apavlov@chromium.org>
    243
  • trunk/WebCore/rendering/RenderForeignObject.cpp

    r53017 r53103  
    8585{
    8686    rect = localToParentTransform().mapRect(rect);
    87     inflateForShadow(style(), rect);
     87    style()->svgStyle()->inflateForShadow(rect);
    8888    RenderBlock::computeRectForRepaint(repaintContainer, rect, fixed);
    8989}
  • trunk/WebCore/rendering/RenderSVGImage.cpp

    r53017 r53103  
    176176void RenderSVGImage::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    177177{
    178     inflateForShadow(style(), repaintRect);
     178    style()->svgStyle()->inflateForShadow(repaintRect);
    179179    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
    180180}
  • trunk/WebCore/rendering/RenderSVGModelObject.cpp

    r53017 r53103  
    5757void RenderSVGModelObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    5858{
    59     inflateForShadow(style(), repaintRect);
     59    style()->svgStyle()->inflateForShadow(repaintRect);
    6060    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
    6161}
  • trunk/WebCore/rendering/RenderSVGRoot.cpp

    r53017 r53103  
    266266    // and then call RenderBox's method to handle all the normal CSS Box model bits
    267267    repaintRect = localToBorderBoxTransform().mapRect(repaintRect);
    268     inflateForShadow(style(), repaintRect);
     268    style()->svgStyle()->inflateForShadow(repaintRect);
    269269    RenderBox::computeRectForRepaint(repaintContainer, repaintRect, fixed);
    270270}
  • trunk/WebCore/rendering/RenderSVGText.cpp

    r53017 r53103  
    6060void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    6161{
    62     inflateForShadow(style(), repaintRect);
     62    style()->svgStyle()->inflateForShadow(repaintRect);
    6363    SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed);
    6464}
  • trunk/WebCore/rendering/SVGRenderSupport.cpp

    r53017 r53103  
    4141#include <wtf/UnusedParam.h>
    4242
    43 using namespace std;
    44 
    4543namespace WebCore {
    4644
     
    6260}
    6361
    64 static 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 
    79 void 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);
    104 }
    105 
    10662void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
    10763{
     
    145101
    146102    if (ShadowData* shadow = svgStyle->shadow()) {
    147         int xShift = shadow->x < 0 ? shadow->x : 0;
    148         int yShift = shadow->y < 0 ? shadow->y :0;
    149         int widthShift = shadow->x < 0 ? 0 : shadow->x;
    150         int heightShift = shadow->y < 0 ? 0 : shadow->y;
    151         FloatRect shadowRect = FloatRect(repaintRect.x() + xShift, repaintRect.y() + yShift,
    152             repaintRect.width() + widthShift, repaintRect.height() + heightShift);
    153         paintInfo.context->clip(enclosingIntRect(shadowRect));
     103        IntRect shadowRect = enclosingIntRect(repaintRect);
     104        svgStyle->inflateForShadow(shadowRect);
     105        paintInfo.context->clip(shadowRect);
    154106        paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color, style->colorSpace());
    155107        paintInfo.context->beginTransparencyLayer(1.0f);
  • trunk/WebCore/rendering/SVGRenderSupport.h

    r53017 r53103  
    5757        FloatRect maskerBoundingBoxForRenderer(const RenderObject*) const;
    5858
    59         virtual void inflateForShadow(RenderStyle*, IntRect&) const;
    60 
    6159    protected:
    6260        static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer);
  • trunk/WebCore/rendering/style/SVGRenderStyle.cpp

    r50583 r53103  
    3131#include "CSSPrimitiveValue.h"
    3232#include "CSSValueList.h"
     33#include "IntRect.h"
    3334#include "NodeRenderStyle.h"
    3435#include "RenderObject.h"
    3536#include "RenderStyle.h"
    3637#include "SVGStyledElement.h"
     38
     39using namespace std;
    3740
    3841namespace WebCore {
     
    142145}
    143146
     147
     148static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bottom, int& left)
     149{
     150    top = 0;
     151    right = 0;
     152    bottom = 0;
     153    left = 0;
     154
     155    int blurAndSpread = shadow->blur + shadow->spread;
     156
     157    top = min(top, shadow->y - blurAndSpread);
     158    right = max(right, shadow->x + blurAndSpread);
     159    bottom = max(bottom, shadow->y + blurAndSpread);
     160    left = min(left, shadow->x - blurAndSpread);
     161}
     162
     163void SVGRenderStyle::inflateForShadow(IntRect& repaintRect) const
     164{
     165    ShadowData* svgShadow = shadow();
     166    if (!svgShadow)
     167        return;
     168
     169    int shadowTop;
     170    int shadowRight;
     171    int shadowBottom;
     172    int shadowLeft;
     173    getSVGShadowExtent(svgShadow, shadowTop, shadowRight, shadowBottom, shadowLeft);
     174
     175    int overflowLeft = repaintRect.x() + shadowLeft;
     176    int overflowRight = repaintRect.right() + shadowRight;
     177    int overflowTop = repaintRect.y() + shadowTop;
     178    int overflowBottom = repaintRect.bottom() + shadowBottom;
     179
     180    repaintRect.setX(overflowLeft);
     181    repaintRect.setY(overflowTop);
     182    repaintRect.setWidth(overflowRight - overflowLeft);
     183    repaintRect.setHeight(overflowBottom - overflowTop);
     184}
     185
    144186}
    145187
  • trunk/WebCore/rendering/style/SVGRenderStyle.h

    r50583 r53103  
    3737    class RenderObject;
    3838    class RenderStyle;
     39    class IntRect;
    3940
    4041    class SVGRenderStyle : public RefCounted<SVGRenderStyle> {   
     
    4647        bool inheritedNotEqual(const SVGRenderStyle*) const;
    4748        void inheritFrom(const SVGRenderStyle*);
     49
     50        void inflateForShadow(IntRect&) const;
    4851       
    4952        bool operator==(const SVGRenderStyle&) const;
Note: See TracChangeset for help on using the changeset viewer.