[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

krit at webkit.org krit at webkit.org
Thu Apr 8 01:59:35 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 35058be7f6d3fe21bc3fcbd25237896860d0f0c3
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 25 23:04:12 2010 +0000

    2010-02-25  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG's tspan is no member of SVGRenderBase, this can cause crashes on filters
            https://bugs.webkit.org/show_bug.cgi?id=35354
    
            This makes the base class RenderSVGInline of RenderSVGTSpan and RenderSVGInlineText
            dependent on SVGBaseRenderer.
            The SVG spec want as to use the object bounding box of the text root as the bounding box
            for text-childs. So we search for the text root and use it's bounding box, stroke rect and
            repaint rect for further calculations.
    
            Test: svg/filters/filter-on-tspan.svg
    
            * rendering/RenderSVGInline.cpp:
            (WebCore::RenderSVGInline::objectBoundingBox): Find the text root and give back it's bounding box.
            (WebCore::RenderSVGInline::strokeBoundingBox): same for stroke rect
            (WebCore::RenderSVGInline::repaintRectInLocalCoordinates): same for repaint rect
            * rendering/RenderSVGInline.h:
            (WebCore::RenderSVGInline::toSVGRenderBase): RenderSVGInline is part of SVGRenderBase now.
            * rendering/RenderSVGTSpan.h:
            (WebCore::RenderSVGTSpan::renderName): Removed bounding box code. Was just a hack for filters and maskers.
            * rendering/SVGRenderSupport.cpp:
            (WebCore::findTextRootObject): Search for the text root.
            * rendering/SVGRenderSupport.h:
            * svg/graphics/SVGPaintServerGradient.cpp: moved findTextRootObject to SVGRenderSupport
    2010-02-25  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG's tspan is no member of SVGRenderBase, this can cause crashes on filters
            https://bugs.webkit.org/show_bug.cgi?id=35354
    
            Check if filters work for tspan according to the SVG Spec. The test shouldn't
            throw an assert now and a green rect should be visible.
    
            * platform/mac/svg/filters/filter-on-tspan-expected.checksum: Added.
            * platform/mac/svg/filters/filter-on-tspan-expected.png: Added.
            * platform/mac/svg/filters/filter-on-tspan-expected.txt: Added.
            * svg/filters/filter-on-tspan.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55260 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0f69d4a..ca55aee 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -2,6 +2,21 @@
 
         Reviewed by Nikolas Zimmermann.
 
+        SVG's tspan is no member of SVGRenderBase, this can cause crashes on filters
+        https://bugs.webkit.org/show_bug.cgi?id=35354
+
+        Check if filters work for tspan according to the SVG Spec. The test shouldn't
+        throw an assert now and a green rect should be visible.
+
+        * platform/mac/svg/filters/filter-on-tspan-expected.checksum: Added.
+        * platform/mac/svg/filters/filter-on-tspan-expected.png: Added.
+        * platform/mac/svg/filters/filter-on-tspan-expected.txt: Added.
+        * svg/filters/filter-on-tspan.svg: Added.
+
+2010-02-25  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
         Use-element doesn't transform clipPath
         https://bugs.webkit.org/show_bug.cgi?id=35375
 
diff --git a/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.checksum b/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.checksum
new file mode 100644
index 0000000..a0948de
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.checksum
@@ -0,0 +1 @@
+28a24d8e221787e8f0c84f258ba4a318
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.png b/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.png
new file mode 100644
index 0000000..706e7db
Binary files /dev/null and b/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.txt b/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.txt
new file mode 100644
index 0000000..70518a9
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/filters/filter-on-tspan-expected.txt
@@ -0,0 +1,14 @@
+KCanvasResource {id="filter" [type=FILTER]  [bounding box=at (-10.00%,-10.00%) size 120.00%x120.00%]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 800x600
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGText {text} at (100,100) size 99x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 68x18
+        chunk 1 text run 1 at (100.00,100.00) startOffset 0 endOffset 12 width 68.00: "Die ist ein "
+      RenderSVGTSpan {tspan} at (0,0) size 27x18
+        RenderSVGInlineText {#text} at (68,-14) size 27x18
+          chunk 1 text run 2 at (168.00,100.00) startOffset 0 endOffset 4 width 27.00: "Test"
+      RenderSVGInlineText {#text} at (95,-14) size 4x18
+        chunk 1 text run 3 at (195.00,100.00) startOffset 0 endOffset 1 width 4.00: "."
diff --git a/LayoutTests/svg/filters/filter-on-tspan.svg b/LayoutTests/svg/filters/filter-on-tspan.svg
new file mode 100644
index 0000000..c7d59d7
--- /dev/null
+++ b/LayoutTests/svg/filters/filter-on-tspan.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg"	xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+<filter id="filter">
+    <feFlood flood-color="green"/>
+</filter>
+</defs>
+<text x="100" y="100">Die ist ein <tspan filter="url(#filter)">Test</tspan>.</text>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f1f21ae..2f6a51d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,34 @@
 
         Reviewed by Nikolas Zimmermann.
 
+        SVG's tspan is no member of SVGRenderBase, this can cause crashes on filters
+        https://bugs.webkit.org/show_bug.cgi?id=35354
+
+        This makes the base class RenderSVGInline of RenderSVGTSpan and RenderSVGInlineText
+        dependent on SVGBaseRenderer.
+        The SVG spec want as to use the object bounding box of the text root as the bounding box
+        for text-childs. So we search for the text root and use it's bounding box, stroke rect and
+        repaint rect for further calculations.
+
+        Test: svg/filters/filter-on-tspan.svg
+
+        * rendering/RenderSVGInline.cpp:
+        (WebCore::RenderSVGInline::objectBoundingBox): Find the text root and give back it's bounding box.
+        (WebCore::RenderSVGInline::strokeBoundingBox): same for stroke rect
+        (WebCore::RenderSVGInline::repaintRectInLocalCoordinates): same for repaint rect
+        * rendering/RenderSVGInline.h:
+        (WebCore::RenderSVGInline::toSVGRenderBase): RenderSVGInline is part of SVGRenderBase now.
+        * rendering/RenderSVGTSpan.h:
+        (WebCore::RenderSVGTSpan::renderName): Removed bounding box code. Was just a hack for filters and maskers.
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::findTextRootObject): Search for the text root.
+        * rendering/SVGRenderSupport.h:
+        * svg/graphics/SVGPaintServerGradient.cpp: moved findTextRootObject to SVGRenderSupport
+
+2010-02-25  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
         Use-element doesn't transform clipPath
         https://bugs.webkit.org/show_bug.cgi?id=35375
 
diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp
index cf97b52..cc2029c 100644
--- a/WebCore/rendering/RenderSVGInline.cpp
+++ b/WebCore/rendering/RenderSVGInline.cpp
@@ -65,6 +65,34 @@ void RenderSVGInline::absoluteRects(Vector<IntRect>& rects, int, int)
     }
 }
 
+FloatRect RenderSVGInline::objectBoundingBox() const
+{
+    if (const RenderObject* object = findTextRootObject(this))
+        return object->objectBoundingBox();
+
+    return FloatRect();
+}
+
+FloatRect RenderSVGInline::strokeBoundingBox() const
+{
+    const RenderObject* object = findTextRootObject(this);
+    ASSERT(object);
+
+    const SVGRenderBase* renderer = object->toSVGRenderBase();
+    if (!renderer)
+        return FloatRect();
+
+    return renderer->strokeBoundingBox();
+}
+
+FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const
+{
+    if (const RenderObject* object = findTextRootObject(this))
+        return object->repaintRectInLocalCoordinates();
+
+    return FloatRect();
+}
+
 void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads)
 {
     InlineRunBox* firstBox = firstLineBox();
diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h
index 53fd4b7..e57b936 100644
--- a/WebCore/rendering/RenderSVGInline.h
+++ b/WebCore/rendering/RenderSVGInline.h
@@ -31,9 +31,12 @@
 
 namespace WebCore {
 
-class RenderSVGInline : public RenderInline {
+class RenderSVGInline : public RenderInline, protected SVGRenderBase {
 public:
     RenderSVGInline(Node*);
+
+    virtual const SVGRenderBase* toSVGRenderBase() const { return this; }
+
     virtual const char* renderName() const { return "RenderSVGInline"; }
     virtual bool requiresLayer() const { return false; }
 
@@ -41,8 +44,14 @@ public:
     virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
     virtual void absoluteQuads(Vector<FloatQuad>&);
 
-    virtual FloatRect objectBoundingBox() const { return FloatRect(); }
-    virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); }
+    // Chapter 10.4 of the SVG Specification say that we should use the
+    // object bounding box of the parent text element.
+    // We search for the root text element and take it's bounding box.
+    // It is also necessary to take the stroke and repaint rect of
+    // this element, since we need it for filters.
+    virtual FloatRect objectBoundingBox() const;
+    virtual FloatRect strokeBoundingBox() const;
+    virtual FloatRect repaintRectInLocalCoordinates() const;
     
 private:
     virtual InlineFlowBox* createInlineFlowBox();
diff --git a/WebCore/rendering/RenderSVGTSpan.h b/WebCore/rendering/RenderSVGTSpan.h
index 652c5e3..931bd8c 100644
--- a/WebCore/rendering/RenderSVGTSpan.h
+++ b/WebCore/rendering/RenderSVGTSpan.h
@@ -31,12 +31,6 @@ class RenderSVGTSpan : public RenderSVGInline {
 public:
     RenderSVGTSpan(Node*);
     virtual const char* renderName() const { return "RenderSVGTSpan"; }
-
-    // FIXME: These are incorrect, but have always behaved this way.
-    // These empty implementations prevent us from hitting RenderObject ASSERTS.
-    // tspan.getBBox() will be wrong, and repainting for tspans may not work correctly!
-    virtual FloatRect objectBoundingBox() const { return FloatRect(); }
-    virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); }
 };
 }
 
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index dc1b3c1..dc54586 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -318,6 +318,16 @@ void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const AffineT
     paintInfo.rect = localToAncestorTransform.inverse().mapRect(paintInfo.rect);
 }
 
+const RenderObject* findTextRootObject(const RenderObject* start)
+{
+    while (start && !start->isSVGText())
+        start = start->parent();
+    ASSERT(start);
+    ASSERT(start->isSVGText());
+
+    return start;
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h
index 427ff1f..7170855 100644
--- a/WebCore/rendering/SVGRenderSupport.h
+++ b/WebCore/rendering/SVGRenderSupport.h
@@ -85,6 +85,8 @@ void applyTransformToPaintInfo(RenderObject::PaintInfo&, const AffineTransform&
 void renderSubtreeToImage(ImageBuffer*, RenderObject*);
 
 void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize);
+
+const RenderObject* findTextRootObject(const RenderObject* start);
 } // namespace WebCore
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/svg/graphics/SVGPaintServerGradient.cpp b/WebCore/svg/graphics/SVGPaintServerGradient.cpp
index c4ed95b..2a582b0 100644
--- a/WebCore/svg/graphics/SVGPaintServerGradient.cpp
+++ b/WebCore/svg/graphics/SVGPaintServerGradient.cpp
@@ -117,16 +117,6 @@ void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transfo
 }
 
 #if PLATFORM(CG)
-static inline const RenderObject* findTextRootObject(const RenderObject* start)
-{
-    while (start && !start->isSVGText())
-        start = start->parent();
-    ASSERT(start);
-    ASSERT(start->isSVGText());
-
-    return start;
-}
-
 static inline AffineTransform absoluteTransformForRenderer(const RenderObject* object)
 {
     AffineTransform absoluteTransform;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list