Changeset 51936 in webkit


Ignore:
Timestamp:
Dec 9, 2009 10:07:25 PM (14 years ago)
Author:
Beth Dakin
Message:

WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG property
-webkit-shadow should apply shadow on the result after compositing
-and corresponding-
<rdar://problem/7389404>

Reviewed by Oliver Hunt.

Set a transparency layer when setting a shadow to apply the shadow
to the composite.

  • rendering/SVGRenderSupport.cpp:

(WebCore::SVGRenderBase::prepareToRenderSVGContent):
(WebCore::SVGRenderBase::finishRenderSVGContent):

LayoutTests: Tests for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG
property -webkit-shadow should apply shadow on the result after
compositing
-and corresponding-
<rdar://problem/7389404>

Reviewed by Oliver Hunt.

New tests:

  • platform/mac/svg/css/composite-shadow-example-expected.checksum: Added.
  • platform/mac/svg/css/composite-shadow-example-expected.png: Added.
  • platform/mac/svg/css/composite-shadow-example-expected.txt: Added.
  • platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum: Added.
  • platform/mac/svg/css/composite-shadow-with-opacity-expected.png: Added.
  • platform/mac/svg/css/composite-shadow-with-opacity-expected.txt: Added.
  • svg/css/composite-shadow-example.html: Added.
  • svg/css/composite-shadow-with-opacity.html: Added.

New and improved results:

  • platform/mac/svg/css/group-with-shadow-expected.checksum:
  • platform/mac/svg/css/group-with-shadow-expected.png:
Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51935 r51936  
     12009-12-09  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Tests for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG
     6        property -webkit-shadow should apply shadow on the result after
     7        compositing
     8        -and corresponding-
     9        <rdar://problem/7389404>
     10
     11        New tests:
     12        * platform/mac/svg/css/composite-shadow-example-expected.checksum: Added.
     13        * platform/mac/svg/css/composite-shadow-example-expected.png: Added.
     14        * platform/mac/svg/css/composite-shadow-example-expected.txt: Added.
     15        * platform/mac/svg/css/composite-shadow-with-opacity-expected.checksum: Added.
     16        * platform/mac/svg/css/composite-shadow-with-opacity-expected.png: Added.
     17        * platform/mac/svg/css/composite-shadow-with-opacity-expected.txt: Added.
     18        * svg/css/composite-shadow-example.html: Added.
     19        * svg/css/composite-shadow-with-opacity.html: Added.
     20
     21        New and improved results:
     22        * platform/mac/svg/css/group-with-shadow-expected.checksum:
     23        * platform/mac/svg/css/group-with-shadow-expected.png:
     24
    1252009-12-09  Alexey Proskuryakov  <ap@apple.com>
    226
  • trunk/LayoutTests/platform/mac/svg/css/group-with-shadow-expected.checksum

    r51800 r51936  
    1 915c514b7855960a76c51e341db9fad5
     1e5d60085cfba0f14938ea6a9f8b5d989
  • trunk/WebCore/ChangeLog

    r51935 r51936  
     12009-12-09  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=32346 SVG property
     6        -webkit-shadow should apply shadow on the result after compositing
     7        -and corresponding-
     8        <rdar://problem/7389404>
     9
     10        Set a transparency layer when setting a shadow to apply the shadow
     11        to the composite.
     12        * rendering/SVGRenderSupport.cpp:
     13        (WebCore::SVGRenderBase::prepareToRenderSVGContent):
     14        (WebCore::SVGRenderBase::finishRenderSVGContent):
     15
    1162009-12-09  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/WebCore/rendering/SVGRenderSupport.cpp

    r50852 r51936  
    9595    }
    9696
    97     if (ShadowData* shadow = svgStyle->shadow())
    98         paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color, style->colorSpace());
     97    if (ShadowData* shadow = svgStyle->shadow()) {
     98        int xShift = shadow->x < 0 ? shadow->x : 0;
     99        int yShift = shadow->y < 0 ? shadow->y :0;
     100        int widthShift = shadow->x < 0 ? 0 : shadow->x;
     101        int heightShift = shadow->y < 0 ? 0 : shadow->y;
     102        FloatRect shadowRect = FloatRect(boundingBox.x() + xShift, boundingBox.y() + yShift,
     103            boundingBox.width() + widthShift, boundingBox.height() + heightShift);
     104        paintInfo.context->clip(enclosingIntRect(shadowRect));
     105        paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color, style->colorSpace());
     106        paintInfo.context->beginTransparencyLayer(1.0f);
     107    }
    99108
    100109#if ENABLE(FILTERS)
     
    164173    if (opacity < 1.0f)
    165174        paintInfo.context->endTransparencyLayer();
     175
     176    // This needs to be done separately from opacity, because if both properties are set,
     177    // then the transparency layers are nested.
     178    if (style->svgStyle()->shadow())
     179        paintInfo.context->endTransparencyLayer();
    166180}
    167181
Note: See TracChangeset for help on using the changeset viewer.