Commit e88d803f authored by eric@webkit.org's avatar eric@webkit.org

Reviewed by Simon Fraser.

        Fix computeContainerBoundingBox to respect viewport translations
        https://bugs.webkit.org/show_bug.cgi?id=25254

        Previously computeContainerBoundingBox was just adding the viewportTranslation.
        Which, although it has a confusing name, only contains the scale and translation
        for the viewBox/preserveAspectRatio adjustment.  It does not contain the
        translation for the x/y offset of the viewport.
        localToParentTransform() does contain this offset, so we use that instead
        of the previous hacky code.

        * rendering/RenderSVGContainer.h:
        * rendering/RenderSVGViewportContainer.h:
        * rendering/SVGRenderSupport.cpp:
        (WebCore::computeContainerBoundingBox):

git-svn-id: svn://svn.chromium.org/blink/trunk@42599 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 038b364a
2009-04-16 Eric Seidel <eric@webkit.org>
Reviewed by Simon Fraser.
Fix computeContainerBoundingBox to respect RenderSVGViewportContainer
viewport translations (x/y on nested <svg> elements)
https://bugs.webkit.org/show_bug.cgi?id=25254
All of these results are progressions.
* platform/mac/svg/W3C-SVG-1.1/coords-viewattr-03-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-color-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-example-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/struct-group-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/struct-image-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
* platform/mac/svg/carto.net/textbox-expected.txt:
* platform/mac/svg/custom/feComponentTransfer-Discrete-expected.txt:
* platform/mac/svg/custom/feComponentTransfer-Gamma-expected.txt:
* platform/mac/svg/custom/feComponentTransfer-Linear-expected.txt:
* platform/mac/svg/custom/feComponentTransfer-Table-expected.txt:
* platform/mac/svg/custom/image-clipped-hit-expected.txt:
2009-04-16 Beth Dakin <bdakin@apple.com>
Reviewed by Dave Hyatt.
......
......@@ -5,7 +5,7 @@ layer at (0,0) size 480x360
RenderSVGText {text} at (135,28) size 210x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 210x23
chunk 1 (middle anchor) text run 1 at (135.50,28.00) startOffset 0 endOffset 25 width 209.00: "<svg> 'viewBox' attribute"
RenderSVGContainer {g} at (9.75,9.75) size 458.25x294.25
RenderSVGContainer {g} at (16,59.75) size 452x244.25
RenderSVGViewportContainer {svg} at (44.75,59.75) size 80.50x80.50
RenderPath {path} at (44.75,59.75) size 80.50x80.50 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#ADD8E6] [fill rule=EVEN-ODD]}] [data="M20.00,20.00 C126.67,20.00,180.00,73.33,180.00,180.00 C73.33,180.00,20.00,126.67,20.00,20.00 Z M20.00,180.00 C20.00,73.33,73.33,20.00,180.00,20.00 C180.00,126.67,126.67,180.00,20.00,180.00 Z M100.00,40.00 L160.00,100.00 L100.00,160.00 L40.00,100.00 Z"]
RenderSVGText {text} at (16,155) size 138x17 contains 1 chunk(s)
......
......@@ -2,8 +2,8 @@ KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#DD0
layer at (0,0) size 480x360
RenderView at (0,0) size 480x360
layer at (0,0) size 480x360
RenderSVGRoot {svg} at (0.50,0.29) size 481.21x359.21
RenderSVGContainer {g} at (18.29,0.29) size 463.42x291.45
RenderSVGRoot {svg} at (0.50,0.50) size 479x359
RenderSVGContainer {g} at (8.29,5.29) size 463.42x291.45
RenderSVGViewportContainer {svg} at (8.29,5.29) size 463.42x291.45
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
......
......@@ -2,8 +2,8 @@ KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#FF0
layer at (0,0) size 480x360
RenderView at (0,0) size 480x360
layer at (0,0) size 480x360
RenderSVGRoot {svg} at (0.36,0.36) size 479.14x359.14
RenderSVGContainer {g} at (0.36,0.36) size 449.29x299.29
RenderSVGRoot {svg} at (0.50,0.50) size 479x359
RenderSVGContainer {g} at (15.36,5.36) size 449.29x299.29
RenderSVGViewportContainer {svg} at (15.36,5.36) size 449.29x299.29
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
......
layer at (0,0) size 480x360
RenderView at (0,0) size 480x360
layer at (0,0) size 480x360
RenderSVGRoot {svg} at (-10,0.50) size 489.50x359
RenderSVGContainer {g} at (-10,0.75) size 320x178.50
RenderSVGRoot {svg} at (0.50,0.50) size 479x359
RenderSVGContainer {g} at (70,110.75) size 320x178.50
RenderSVGViewportContainer {svg} at (70,110.75) size 320x178.50
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderPath {rect} at (80.75,110.75) size 298.50x178.50 [stroke={[type=SOLID] [color=#0000FF]}] [fill={[type=SOLID] [color=#888888]}] [data="M1.00,1.00 L199.00,1.00 L199.00,119.00 L1.00,119.00 Z"]
......
layer at (0,0) size 480x360
RenderView at (0,0) size 480x360
layer at (0,0) size 480x360
RenderSVGRoot {svg} at (0,0) size 479.50x359.50
RenderSVGContainer {g} at (0,0) size 240x180
RenderSVGRoot {svg} at (0,0) size 480x360
RenderSVGContainer {g} at (0,0) size 480x360
RenderSVGViewportContainer {svg} at (240,180) size 240x180
RenderPath {rect} at (240,180) size 240x180 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L240.00,0.00 L240.00,180.00 L0.00,180.00 Z"]
RenderSVGViewportContainer {svg} at (0,0) size 240x180
......
layer at (0,0) size 480x360
RenderView at (0,0) size 480x360
layer at (0,0) size 480x360
RenderSVGRoot {svg} at (0,0) size 479.50x359.50
RenderSVGContainer {g} at (0,0) size 240x225
RenderSVGRoot {svg} at (0,0) size 480x359.50
RenderSVGContainer {g} at (0,0) size 480x300
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderImage {image} at (0,0) size 240x150
RenderSVGViewportContainer {svg} at (240,0) size 240x225
......@@ -11,9 +11,9 @@ layer at (0,0) size 480x360
RenderSVGContainer {use} at (0,0) size 240x150
RenderSVGContainer {g} at (0,0) size 240x150
RenderImage {image} at (0,0) size 240x150
RenderSVGContainer {g} at (0,0) size 240x225
RenderSVGContainer {use} at (0,0) size 240x225
RenderSVGContainer {g} at (0,0) size 240x225
RenderSVGContainer {g} at (240,0) size 240x225
RenderSVGContainer {use} at (240,0) size 240x225
RenderSVGContainer {g} at (240,0) size 240x225
RenderSVGViewportContainer {svg} at (240,0) size 240x225
RenderPath {rect} at (240,0) size 240x225 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L240.00,0.00 L240.00,225.00 L0.00,225.00 Z"]
RenderSVGViewportContainer {svg} at (0,150) size 240x150
......
layer at (0,0) size 480x360
RenderView at (0,0) size 480x360
layer at (0,0) size 480x360
RenderSVGRoot {svg} at (0.50,-55) size 479x414.50
RenderSVGContainer {g} at (10,-55) size 342.80x358
RenderSVGContainer {g} at (10,-55) size 342.80x358
RenderSVGContainer {g} at (16.97,-55) size 335.83x219.44 [transform={m=((1.00,0.00)(0.00,1.00)) t=(70.00,-60.00)}]
RenderSVGRoot {svg} at (0.50,0.50) size 479x359
RenderSVGContainer {g} at (10,8.73) size 365x294.27
RenderSVGContainer {g} at (10,8.73) size 365x294.27
RenderSVGContainer {g} at (16.97,8.73) size 358.03x155.70 [transform={m=((1.00,0.00)(0.00,1.00)) t=(70.00,-60.00)}]
RenderSVGText {text} at (30,150) size 344x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 344x23
chunk 1 text run 1 at (30.00,150.00) startOffset 0 endOffset 37 width 344.00: "Rotated Text for testing SVGLocatable"
......
......@@ -3,15 +3,15 @@ layer at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (-781.25,-781.25) size 2343.75x2343.75
RenderPath {rect} at (-781.25,-781.25) size 2343.75x2343.75 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M-1000.00,-1000.00 L2000.00,-1000.00 L2000.00,2000.00 L-1000.00,2000.00 Z"]
RenderSVGContainer {g} at (-3.52,6.17) size 238.48x95.98
RenderSVGContainer {g} at (-3.52,6.17) size 238.48x95.98
RenderSVGContainer {g} at (77.54,77.54) size 157.42x24.61
RenderSVGContainer {g} at (77.54,77.54) size 157.42x24.61
RenderPath {rect} at (77.54,77.54) size 157.42x24.61 [stroke={[type=SOLID] [color=#696969] [stroke width=1.50]}] [fill={[type=SOLID] [color=#FFFFFF]}] [data="M100.00,100.00 L300.00,100.00 L300.00,130.00 L100.00,130.00 Z"]
RenderSVGViewportContainer {svg} at (77.54,84.77) size 1.17x12.89
RenderSVGContainer {g} at (77.54,84.77) size 1.17x12.89
RenderSVGText {text}
RenderPath {line} at (77.54,84.77) size 1.17x12.89 [stroke={[type=SOLID] [color=#FF0000] [stroke width=1.50]}] [fill={[type=SOLID] [color=#000000]}] [data="M100.00,125.00 L100.00,108.50"]
RenderSVGContainer {g} at (-3.52,5.78) size 129.10x41.68
RenderSVGContainer {g} at (-3.52,5.78) size 129.10x41.68
RenderSVGContainer {g} at (77.54,22.85) size 48.05x24.61
RenderSVGContainer {g} at (77.54,22.85) size 48.05x24.61
RenderPath {rect} at (77.54,22.85) size 48.05x24.61 [stroke={[type=SOLID] [color=#696969] [stroke width=1.50]}] [fill={[type=SOLID] [color=#FFFFFF]}] [data="M100.00,30.00 L160.00,30.00 L160.00,60.00 L100.00,60.00 Z"]
RenderSVGViewportContainer {svg} at (77.54,29.69) size 16.99x13.28
RenderSVGContainer {g} at (77.54,29.69) size 16.99x13.28
......@@ -19,8 +19,8 @@ layer at (0,0) size 800x600
RenderSVGInlineText {#text} at (0,-14) size 16x17
chunk 1 text run 1 at (105.00,52.00) startOffset 0 endOffset 2 width 16.00: "50"
RenderPath {line} at (77.54,30.08) size 1.17x12.89 [stroke={[type=SOLID] [color=#FF0000] [stroke width=1.50]}] [fill={[type=SOLID] [color=#000000]}] [data="M100.00,55.00 L100.00,38.50"]
RenderSVGContainer {g} at (74.61,233.79) size 333.40x24.61 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,300.00)}]
RenderSVGContainer {g} at (74.61,233.79) size 333.40x24.61
RenderSVGContainer {g} at (77.54,233.79) size 333.40x24.61 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,300.00)}]
RenderSVGContainer {g} at (77.54,233.79) size 333.40x24.61
RenderPath {rect} at (77.54,233.79) size 180.86x24.61 [stroke={[type=SOLID] [color=#696969] [stroke width=1.50]}] [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00 L230.00,0.00 L230.00,30.00 L0.00,30.00 Z"]
RenderSVGViewportContainer {svg} at (77.54,240.62) size 333.40x13.28
RenderSVGContainer {g} at (77.54,240.62) size 333.40x13.28
......
......@@ -2,8 +2,8 @@ KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00F
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (0.58,8.27) size 748.85x483.46
RenderSVGContainer {g} at (0.58,8.27) size 748.85x483.46
RenderSVGRoot {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGContainer {g} at (25.58,16.60) size 748.85x483.46
RenderSVGViewportContainer {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
......
......@@ -2,8 +2,8 @@ KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00F
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (0.58,8.27) size 748.85x483.46
RenderSVGContainer {g} at (0.58,8.27) size 748.85x483.46
RenderSVGRoot {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGContainer {g} at (25.58,16.60) size 748.85x483.46
RenderSVGViewportContainer {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
......
......@@ -2,8 +2,8 @@ KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00F
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (0.58,8.27) size 748.85x483.46
RenderSVGContainer {g} at (0.58,8.27) size 748.85x483.46
RenderSVGRoot {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGContainer {g} at (25.58,16.60) size 748.85x483.46
RenderSVGViewportContainer {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
......
......@@ -2,8 +2,8 @@ KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00F
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (0.58,8.27) size 748.85x483.46
RenderSVGContainer {g} at (0.58,8.27) size 748.85x483.46
RenderSVGRoot {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGContainer {g} at (25.58,16.60) size 748.85x483.46
RenderSVGViewportContainer {svg} at (25.58,16.60) size 748.85x483.46
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
......
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (-75,0) size 282.85x249.90
RenderSVGContainer {g} at (-75,0) size 282.85x249.90 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(0.00,0.00)}]
RenderSVGRoot {svg} at (90,116) size 334.35x258.90
RenderSVGContainer {g} at (141.51,125) size 282.85x249.90 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(0.00,0.00)}]
RenderSVGViewportContainer {svg} at (141.51,125) size 282.85x249.90
RenderImage {image} at (0,0) size 240x150
RenderSVGText {text} at (90,130) size 43x18 contains 1 chunk(s)
......
2009-04-16 Eric Seidel <eric@webkit.org>
Reviewed by Simon Fraser.
Fix computeContainerBoundingBox to respect viewport translations
https://bugs.webkit.org/show_bug.cgi?id=25254
Previously computeContainerBoundingBox was just adding the viewportTranslation.
Which, although it has a confusing name, only contains the scale and translation
for the viewBox/preserveAspectRatio adjustment. It does not contain the
translation for the x/y offset of the viewport.
localToParentTransform() does contain this offset, so we use that instead
of the previous hacky code.
* rendering/RenderSVGContainer.h:
* rendering/RenderSVGViewportContainer.h:
* rendering/SVGRenderSupport.cpp:
(WebCore::computeContainerBoundingBox):
2009-04-16 Eric Seidel <eric@webkit.org>
Reviewed by Simon Fraser.
......@@ -60,10 +60,6 @@ public:
virtual FloatRect objectBoundingBox() const;
virtual FloatRect repaintRectInLocalCoordinates() const;
// FIXME: This only exists to allow computeContainerBoundingBox's broken transformation
// Once localToParentTransform() is landed, this will be removed, and layout test results updated.
virtual TransformationMatrix viewportTransform() const { return TransformationMatrix(); }
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
protected:
......
......@@ -51,7 +51,7 @@ public:
FloatRect viewport() const;
// FIXME: This is only public for SVGResourceMarker::draw, likely the callsite should be changed.
virtual TransformationMatrix viewportTransform() const;
TransformationMatrix viewportTransform() const;
private:
void calcViewport();
......
......@@ -182,18 +182,7 @@ FloatRect computeContainerBoundingBox(const RenderObject* container, bool includ
RenderObject* current = container->firstChild();
for (; current != 0; current = current->nextSibling()) {
FloatRect childBBox = includeAllPaintedContent ? current->repaintRectInLocalCoordinates() : current->objectBoundingBox();
// FIXME: We should just call localToParentTransform()
// however, localToParentTransform() respects the viewport translation, and this method hast not historically done so
// I'll fix this, and update the LayoutTests in a separate patch.
// Note: A renderer will have either a localTransform or a viewportTransform, no renders have both.
FloatRect childBBoxInLocalCoords = current->localTransform().mapRect(childBBox);
if (current->isSVGContainer())
childBBoxInLocalCoords = static_cast<RenderSVGContainer*>(current)->viewportTransform().mapRect(childBBoxInLocalCoords);
// FIXME: We're not including the viewport translation (e.g. the x, y offset of a nested <svg>), the result of this function is wrong.
FloatRect childBBoxInLocalCoords = current->localToParentTransform().mapRect(childBBox);
boundingBox.unite(childBBoxInLocalCoords);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment