Changeset 96558 in webkit


Ignore:
Timestamp:
Oct 3, 2011 5:10:38 PM (13 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/9973489> REGRESSION (r66599): -[DOMNode boundingBox] returns the zero rect for SVG elements
https://bugs.webkit.org/show_bug.cgi?id=69305

Reviewed by Simon Fraser.

Source/WebCore:

Test: svg/custom/boundingBox.html

Rather than asserting and returning the zero rect, take the transform-aware code path for computing SVG
bounding rects.

  • rendering/svg/RenderSVGForeignObject.cpp:

(WebCore::RenderSVGForeignObject::mapLocalToContainer): Updated for change to SVGRenderSupport::mapLocalToContainer().

  • rendering/svg/RenderSVGInline.cpp:

(WebCore::RenderSVGInline::mapLocalToContainer): Ditto.

  • rendering/svg/RenderSVGModelObject.cpp:

(WebCore::RenderSVGModelObject::mapLocalToContainer): Ditto.
(WebCore::RenderSVGModelObject::absoluteRects): Replaced an incorrect assertion with code to approximate the bounding
box.

  • rendering/svg/RenderSVGText.cpp:

(WebCore::RenderSVGText::mapLocalToContainer): Updated for change to SVGRenderSupport::mapLocalToContainer().

  • rendering/svg/SVGRenderSupport.cpp:

(WebCore::SVGRenderSupport::mapLocalToContainer): Removed the fixed and useTransform boolean parameters.

  • rendering/svg/SVGRenderSupport.h:

LayoutTests:

  • svg/custom/boundingBox-expected.txt: Added.
  • svg/custom/boundingBox.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r96552 r96558  
     12011-10-03  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/9973489> REGRESSION (r66599): -[DOMNode boundingBox] returns the zero rect for SVG elements
     4        https://bugs.webkit.org/show_bug.cgi?id=69305
     5
     6        Reviewed by Simon Fraser.
     7
     8        * svg/custom/boundingBox-expected.txt: Added.
     9        * svg/custom/boundingBox.html: Added.
     10
    1112011-10-03  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r96554 r96558  
     12011-10-03  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/9973489> REGRESSION (r66599): -[DOMNode boundingBox] returns the zero rect for SVG elements
     4        https://bugs.webkit.org/show_bug.cgi?id=69305
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test: svg/custom/boundingBox.html
     9
     10        Rather than asserting and returning the zero rect, take the transform-aware code path for computing SVG
     11        bounding rects.
     12
     13        * rendering/svg/RenderSVGForeignObject.cpp:
     14        (WebCore::RenderSVGForeignObject::mapLocalToContainer): Updated for change to SVGRenderSupport::mapLocalToContainer().
     15        * rendering/svg/RenderSVGInline.cpp:
     16        (WebCore::RenderSVGInline::mapLocalToContainer): Ditto.
     17        * rendering/svg/RenderSVGModelObject.cpp:
     18        (WebCore::RenderSVGModelObject::mapLocalToContainer): Ditto.
     19        (WebCore::RenderSVGModelObject::absoluteRects): Replaced an incorrect assertion with code to approximate the bounding
     20        box.
     21        * rendering/svg/RenderSVGText.cpp:
     22        (WebCore::RenderSVGText::mapLocalToContainer): Updated for change to SVGRenderSupport::mapLocalToContainer().
     23        * rendering/svg/SVGRenderSupport.cpp:
     24        (WebCore::SVGRenderSupport::mapLocalToContainer): Removed the fixed and useTransform boolean parameters.
     25        * rendering/svg/SVGRenderSupport.h:
     26
    1272011-10-03  Michael Nordman  <michaeln@google.com>
    228
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp

    r95040 r96558  
    161161}
    162162
    163 void RenderSVGForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     163void RenderSVGForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, bool* wasFixed) const
    164164{
    165     // When crawling up the hierachy starting from foreignObject child content, useTransforms may not be set to true.
    166     if (!useTransforms)
    167         useTransforms = true;
    168     SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState, wasFixed);
     165    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
    169166}
    170167
  • trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp

    r93440 r96558  
    7878}
    7979
    80 void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState& transformState, bool* wasFixed) const
     80void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* useTransforms */, bool /* fixed */, TransformState& transformState, bool* wasFixed) const
    8181{
    82     SVGRenderSupport::mapLocalToContainer(this, repaintContainer, useTransforms, fixed, transformState, wasFixed);
     82    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
    8383}
    8484
  • trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp

    r95901 r96558  
    5454}
    5555
    56 void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     56void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, bool* wasFixed) const
    5757{
    58     SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState, wasFixed);
     58    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
    5959}
    6060
     
    7171}
    7272
    73 void RenderSVGModelObject::absoluteRects(Vector<LayoutRect>&, const LayoutPoint&)
     73void RenderSVGModelObject::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
    7474{
    75     // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used.
    76     ASSERT_NOT_REACHED();
     75    LayoutRect rect = enclosingLayoutRect(strokeBoundingBox());
     76    rect.moveBy(accumulatedOffset);
     77    rects.append(rect);
    7778}
    7879
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r94372 r96558  
    9494}
    9595
    96 void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
    97 {
    98     SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState, wasFixed);
     96void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, bool* wasFixed) const
     97{
     98    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
    9999}
    100100
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp

    r93050 r96558  
    7171}
    7272
    73 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed)
    74 {
    75     ASSERT(!fixed); // We should have no fixed content in the SVG rendering tree.
    76     ASSERT(useTransforms); // Mapping a point through SVG w/o respecting transforms is useless.
     73void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, TransformState& transformState, bool* wasFixed)
     74{
    7775    transformState.applyTransform(object->localToParentTransform());
    78     object->parent()->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
     76    object->parent()->mapLocalToContainer(repaintContainer, false, true, transformState, wasFixed);
    7977}
    8078
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.h

    r93050 r96558  
    6464    static LayoutRect clippedOverflowRectForRepaint(const RenderObject*, RenderBoxModelObject* repaintContainer);
    6565    static void computeRectForRepaint(const RenderObject*, RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed);
    66     static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0);
     66    static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, TransformState&, bool* wasFixed = 0);
    6767
    6868    // Shared between SVG renderers and resources.
Note: See TracChangeset for help on using the changeset viewer.