Changeset 175847 in webkit


Ignore:
Timestamp:
Nov 10, 2014 7:25:36 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore:
SVG foreign objects do not inherit the container coordinates system if they are repainted.
https://bugs.webkit.org/show_bug.cgi?id=138481.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2014-11-10
Reviewed by Simon Fraser.

If a foreign object is included in an SVG, it should inherit the coordinates system
of the container if it is repainted. The foreign object is actually redrawn in the
CSS coordinates system regardless of the transformation that may be applied to the
container.

The bug is RenderSVG* classes use computeFloatRectForRepaint(), but the rest of the
render classes use computeRectForRepaint(). RenderSVGForeignObject::computeRectForRepaint()
was not defined, so we end up hitting RenderObject::computeRectForRepaint() for
a RenderSVGTransformableContainer and completely miss the transform.

Tests: svg/transforms/svg-transform-foreign-object-repaint.html

Implement RenderSVGForeignObject::computeRectForRepaint() so we can apply the
container transformation on the SVG foreign object repaint rectangle.

  • rendering/svg/RenderSVGForeignObject.cpp:

(WebCore::RenderSVGForeignObject::computeRectForRepaint):

  • rendering/svg/RenderSVGForeignObject.h:

LayoutTests:
SVG foreign objects do not inherit the container coordinates system if they are repainted..
https://bugs.webkit.org/show_bug.cgi?id=138481.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2014-11-10
Reviewed by Simon Fraser.

Ensure the repaint rectangle of the SVG foreign object is calculated correctly
when the container element has transformation.

  • svg/transforms/svg-transform-foreign-object-repaint-expected.png: Added.
  • svg/transforms/svg-transform-foreign-object-repaint-expected.txt: Added.
  • svg/transforms/svg-transform-foreign-object-repaint.html: Added.

Re-baseline these tests since the render tree dumping uses renderer.absoluteClippedOverflowRect()
in writePositionAndStyle() to get the object rectangle so this issue only affects test output.

  • svg/zoom/page/zoom-foreign-content-expected.txt:
  • platform/mac/svg/zoom/page/zoom-foreignObject-expected.txt:
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r175846 r175847  
     12014-11-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        SVG foreign objects do not inherit the container coordinates system if they are repainted..
     4        https://bugs.webkit.org/show_bug.cgi?id=138481.
     5
     6        Reviewed by Simon Fraser.
     7
     8        Ensure the repaint rectangle of the SVG foreign object is calculated correctly
     9        when the container element has transformation.
     10       
     11        * svg/transforms/svg-transform-foreign-object-repaint-expected.png: Added.
     12        * svg/transforms/svg-transform-foreign-object-repaint-expected.txt: Added.
     13        * svg/transforms/svg-transform-foreign-object-repaint.html: Added.
     14       
     15        Re-baseline these tests since the render tree dumping uses renderer.absoluteClippedOverflowRect()
     16        in writePositionAndStyle() to get the object rectangle so this issue only affects test output.
     17
     18        * svg/zoom/page/zoom-foreign-content-expected.txt:
     19        * platform/mac/svg/zoom/page/zoom-foreignObject-expected.txt:
     20
    1212014-11-10  Andreas Kling  <akling@apple.com>
    222
  • trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-foreignObject-expected.txt

    r171341 r175847  
    1717    RenderSVGRect {rect} at (0,0) size 361x289 [stroke={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=250.00] [height=200.00]
    1818    RenderSVGForeignObject {foreignObject} at (260,0) size 250x200
    19       RenderSVGRoot {svg} at (260,5) size 250x195
    20         RenderSVGContainer {g} at (260,5) size 250x195 [transform={m=((3.00,0.26)(0.26,3.02)) t=(0.00,0.00)}]
     19      RenderSVGRoot {svg} at (374,7) size 361x281
     20        RenderSVGContainer {g} at (374,7) size 361x281 [transform={m=((3.00,0.26)(0.26,3.02)) t=(0.00,0.00)}]
    2121          RenderSVGText {text} at (0,1) size 82x19 contains 1 chunk(s)
    2222            RenderSVGInlineText {#text} at (0,0) size 82x19
    2323              chunk 1 text run 1 at (0.00,16.00) startOffset 0 endOffset 14 width 81.05: "This is a text"
    24           RenderSVGContainer {a} at (265,62) size 204x74
     24          RenderSVGContainer {a} at (381,89) size 295x107
    2525            RenderSVGText {text} at (0,20) size 67x19 contains 1 chunk(s)
    2626              RenderSVGInlineText {#text} at (0,0) size 67x19
  • trunk/LayoutTests/svg/zoom/page/zoom-foreign-content-expected.txt

    r112022 r175847  
    44  RenderSVGRoot {svg} at (0,0) size 800x600
    55    RenderSVGForeignObject {foreignObject} at (0,0) size 800x600
    6       RenderSVGRoot {svg} at (0,0) size 99x99
    7         RenderSVGRect {rect} at (0,0) size 99x99 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=99.00] [height=99.00]
     6      RenderSVGRoot {svg} at (0,0) size 206x206
     7        RenderSVGRect {rect} at (0,0) size 206x206 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=99.00] [height=99.00]
    88      RenderText {#text} at (0,0) size 0x0
    99    RenderSVGForeignObject {foreignObject} at (0,0) size 800x600
  • trunk/Source/WebCore/ChangeLog

    r175844 r175847  
     12014-11-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        SVG foreign objects do not inherit the container coordinates system if they are repainted.
     4        https://bugs.webkit.org/show_bug.cgi?id=138481.
     5
     6        Reviewed by Simon Fraser.
     7
     8        If a foreign object is included in an SVG, it should inherit the coordinates system
     9        of the container if it is repainted. The foreign object is actually redrawn in the
     10        CSS coordinates system regardless of the transformation that may be applied to the
     11        container.
     12
     13        The bug is RenderSVG* classes use computeFloatRectForRepaint(), but the rest of the
     14        render classes use computeRectForRepaint(). RenderSVGForeignObject::computeRectForRepaint()
     15        was not defined, so we end up hitting RenderObject::computeRectForRepaint() for
     16        a RenderSVGTransformableContainer and completely miss the transform.
     17
     18        Tests: svg/transforms/svg-transform-foreign-object-repaint.html
     19
     20        Implement RenderSVGForeignObject::computeRectForRepaint() so we can apply the
     21        container transformation on the SVG foreign object repaint rectangle.
     22        * rendering/svg/RenderSVGForeignObject.cpp:
     23        (WebCore::RenderSVGForeignObject::computeRectForRepaint):
     24        * rendering/svg/RenderSVGForeignObject.h:
     25
    1262014-11-10  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    227
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp

    r173859 r175847  
    103103}
    104104
     105void RenderSVGForeignObject::computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect& repaintRect, bool fixed) const
     106{
     107    FloatRect floatRect(repaintRect);
     108    computeFloatRectForRepaint(repaintContainer, floatRect, fixed);
     109    repaintRect = enclosingLayoutRect(floatRect);
     110}
     111
    105112const AffineTransform& RenderSVGForeignObject::localToParentTransform() const
    106113{
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.h

    r175084 r175847  
    4242    virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
    4343    virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const override;
     44    virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const override;
    4445
    4546    virtual bool requiresLayer() const override { return false; }
Note: See TracChangeset for help on using the changeset viewer.