Changeset 100045 in webkit


Ignore:
Timestamp:
Nov 11, 2011 4:30:05 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

clipPath does not work on foreignObject
https://bugs.webkit.org/show_bug.cgi?id=68251

Patch by Florin Malita <fmalita@google.com> on 2011-11-11
Reviewed by Dirk Schulze.

Source/WebCore:

Add ForeignObject clipping, filtering and masking support using the SVGRenderSupport helpers
(prepareToRenderSVGContent, finishRenderSVGContent) on RenderSVGForeignObject's paint path.
This also allows us to remove explicit transparency handling, since the helpers already cover it.

Tests: svg/foreignObject/clip.html

svg/foreignObject/filter.html
svg/foreignObject/mask.html

  • rendering/svg/RenderSVGForeignObject.cpp:

(WebCore::RenderSVGForeignObject::paint):

  • rendering/svg/SVGResources.cpp:

(WebCore::clipperFilterMaskerTags):

LayoutTests:

  • svg/foreignObject/clip-expected.png: Added.
  • svg/foreignObject/clip-expected.txt: Added.
  • svg/foreignObject/clip.html: Added.
  • svg/foreignObject/filter-expected.png: Added.
  • svg/foreignObject/filter-expected.txt: Added.
  • svg/foreignObject/filter.html: Added.
  • svg/foreignObject/mask-expected.png: Added.
  • svg/foreignObject/mask-expected.txt: Added.
  • svg/foreignObject/mask.html: Added.
Location:
trunk
Files:
9 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r100044 r100045  
     12011-11-11  Florin Malita  <fmalita@google.com>
     2
     3        clipPath does not work on foreignObject
     4        https://bugs.webkit.org/show_bug.cgi?id=68251
     5
     6        Reviewed by Dirk Schulze.
     7
     8        * svg/foreignObject/clip-expected.png: Added.
     9        * svg/foreignObject/clip-expected.txt: Added.
     10        * svg/foreignObject/clip.html: Added.
     11        * svg/foreignObject/filter-expected.png: Added.
     12        * svg/foreignObject/filter-expected.txt: Added.
     13        * svg/foreignObject/filter.html: Added.
     14        * svg/foreignObject/mask-expected.png: Added.
     15        * svg/foreignObject/mask-expected.txt: Added.
     16        * svg/foreignObject/mask.html: Added.
     17
    1182011-11-11  Ojan Vafai  <ojan@chromium.org>
    219
  • trunk/Source/WebCore/ChangeLog

    r100041 r100045  
     12011-11-11  Florin Malita  <fmalita@google.com>
     2
     3        clipPath does not work on foreignObject
     4        https://bugs.webkit.org/show_bug.cgi?id=68251
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Add ForeignObject clipping, filtering and masking support using the SVGRenderSupport helpers
     9        (prepareToRenderSVGContent, finishRenderSVGContent) on RenderSVGForeignObject's paint path.
     10        This also allows us to remove explicit transparency handling, since the helpers already cover it.
     11
     12        Tests: svg/foreignObject/clip.html
     13               svg/foreignObject/filter.html
     14               svg/foreignObject/mask.html
     15
     16        * rendering/svg/RenderSVGForeignObject.cpp:
     17        (WebCore::RenderSVGForeignObject::paint):
     18        * rendering/svg/SVGResources.cpp:
     19        (WebCore::clipperFilterMaskerTags):
     20
    1212011-11-11  Adam Klein  <adamk@chromium.org>
    222
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp

    r99862 r100045  
    5959        childPaintInfo.context->clip(m_viewport);
    6060
    61     float opacity = style()->opacity();
    62     if (opacity < 1.0f)
    63         childPaintInfo.context->beginTransparencyLayer(opacity);
     61    bool continueRendering = true;
     62    if (paintInfo.phase == PaintPhaseForeground)
     63        continueRendering = SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo);
    6464
    65     // Paint all phases of FO elements atomically, as though the FO element established its
    66     // own stacking context.
    67     bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
    68     LayoutPoint childPoint = IntPoint();
    69     childPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
    70     RenderBlock::paint(childPaintInfo, IntPoint());
    71     if (!preservePhase) {
    72         childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
    73         RenderBlock::paint(childPaintInfo, childPoint);
    74         childPaintInfo.phase = PaintPhaseFloat;
    75         RenderBlock::paint(childPaintInfo, childPoint);
    76         childPaintInfo.phase = PaintPhaseForeground;
    77         RenderBlock::paint(childPaintInfo, childPoint);
    78         childPaintInfo.phase = PaintPhaseOutline;
    79         RenderBlock::paint(childPaintInfo, childPoint);
     65    if (continueRendering) {
     66        // Paint all phases of FO elements atomically, as though the FO element established its
     67        // own stacking context.
     68        bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
     69        LayoutPoint childPoint = IntPoint();
     70        childPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
     71        RenderBlock::paint(childPaintInfo, IntPoint());
     72        if (!preservePhase) {
     73            childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
     74            RenderBlock::paint(childPaintInfo, childPoint);
     75            childPaintInfo.phase = PaintPhaseFloat;
     76            RenderBlock::paint(childPaintInfo, childPoint);
     77            childPaintInfo.phase = PaintPhaseForeground;
     78            RenderBlock::paint(childPaintInfo, childPoint);
     79            childPaintInfo.phase = PaintPhaseOutline;
     80            RenderBlock::paint(childPaintInfo, childPoint);
     81        }
    8082    }
    8183
    82     if (opacity < 1.0f)
    83         childPaintInfo.context->endTransparencyLayer();
     84    if (paintInfo.phase == PaintPhaseForeground)
     85        SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, paintInfo.context);
    8486}
    8587
  • trunk/Source/WebCore/rendering/svg/SVGResources.cpp

    r95901 r100045  
    8282        s_tagList.add(SVGNames::tspanTag.localName().impl());
    8383
     84        // Not listed in the definitions is the foreignObject element, but clip-path
     85        // is a supported attribute.
     86        s_tagList.add(SVGNames::foreignObjectTag.localName().impl());
     87
    8488        // Elements that we ignore, as it doesn't make any sense.
    8589        // defs, pattern, switch (FIXME: Mail SVG WG about these)
Note: See TracChangeset for help on using the changeset viewer.