2006-04-09 Rob Buis <buis@kde.org>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Apr 2006 21:55:41 +0000 (21:55 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Apr 2006 21:55:41 +0000 (21:55 +0000)
        Reviewed by darin.  Landed by eseidel.

        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=6930:
        % width/height on nested <svg> tags do not work

        Set the context correctly for inner <svg>, so calculation of
        width/height for inner <svg> elements is done against the
        viewport element.

        Test: svg/custom/inner-percent.svg

        * ksvg2/svg/SVGSVGElement.cpp:
        (WebCore::SVGSVGElement::width):
        (WebCore::SVGSVGElement::height):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13746 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/svg/custom/inner-percent-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/inner-percent-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/inner-percent-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/inner-percent.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/ksvg2/svg/SVGSVGElement.cpp

index d8e6e8ae970edc013e20f7763b779c831907ec6b..f3f4279527c1c454fcdc11680dcfdebc87bd502b 100644 (file)
@@ -1,3 +1,13 @@
+2006-04-09  Rob Buis  <buis@kde.org>
+
+        Reviewed by eseidel.  Landed by eseidel.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6930
+        % width/height on nested <svg> tags do not work
+
+        * svg/custom/inner-percent-expected.txt: Added.
+        * svg/custom/inner-percent.svg: Added.
+
 2006-04-08  Darin Adler  <darin@apple.com>
 
         Reviewed by Beth.
diff --git a/LayoutTests/svg/custom/inner-percent-expected.checksum b/LayoutTests/svg/custom/inner-percent-expected.checksum
new file mode 100644 (file)
index 0000000..3a4f1f7
--- /dev/null
@@ -0,0 +1 @@
+16310588467cfc20d551635abc59b784
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/inner-percent-expected.png b/LayoutTests/svg/custom/inner-percent-expected.png
new file mode 100644 (file)
index 0000000..3db2634
Binary files /dev/null and b/LayoutTests/svg/custom/inner-percent-expected.png differ
diff --git a/LayoutTests/svg/custom/inner-percent-expected.txt b/LayoutTests/svg/custom/inner-percent-expected.txt
new file mode 100644 (file)
index 0000000..038fed6
--- /dev/null
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (0,0) size 100x100
+      KCanvasItem {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+      KCanvasContainer {svg} at (0,0) size 100x100
+        KCanvasItem {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
diff --git a/LayoutTests/svg/custom/inner-percent.svg b/LayoutTests/svg/custom/inner-percent.svg
new file mode 100644 (file)
index 0000000..451ff63
--- /dev/null
@@ -0,0 +1,6 @@
+<svg xmlns='http://www.w3.org/2000/svg' width="200" height="200">
+<rect x="0" y="0" width="100" height="100" fill="red"/>
+<svg x="0" y="0" width="100%" height="100%" viewBox="0 0 200 200">
+<rect x="0" y="0" width="100" height="100" fill="green"/>
+</svg>
+</svg>
index 47021e666a0dec626186ec0e2eaa07a935ec2862..6c5f998408e84ac389354e113d922a61862c38ae 100644 (file)
@@ -1,6 +1,23 @@
+2006-04-09  Rob Buis  <buis@kde.org>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=6930:
+        % width/height on nested <svg> tags do not work
+
+        Set the context correctly for inner <svg>, so calculation of
+        width/height for inner <svg> elements is done against the
+        viewport element.
+
+        Test: svg/custom/inner-percent.svg
+
+        * ksvg2/svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::width):
+        (WebCore::SVGSVGElement::height):
+
 2006-04-08  Rob Buis  <buis@kde.org>
 
-        Reviewed by eseidel.
+        Reviewed by eseidel.  Landed by eseidel.
 
         No automated test case possible.
 
index 1df9bd6e66ce69398acfff07f4052501f94af21e..dc50f500c057e21886c0fb48c8ddfbae53d8ba30 100644 (file)
@@ -93,7 +93,7 @@ SVGAnimatedLength *SVGSVGElement::width() const
     if (!m_width) {
         String temp("100%");
         const SVGElement *viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
-        lazy_create<SVGAnimatedLength>(m_width, (SVGStyledElement *)0, LM_WIDTH, viewport);
+        lazy_create<SVGAnimatedLength>(m_width, (SVGStyledElement *)ownerDocument()->documentElement() == this ? 0 : this, LM_WIDTH, viewport);
         m_width->baseVal()->setValueAsString(temp.impl());
     }
 
@@ -105,7 +105,7 @@ SVGAnimatedLength *SVGSVGElement::height() const
     if (!m_height) {
         String temp("100%");
         const SVGElement *viewport = ownerDocument()->documentElement() == this ? this : viewportElement();
-        lazy_create<SVGAnimatedLength>(m_height, (SVGStyledElement *)0, LM_HEIGHT, viewport);
+        lazy_create<SVGAnimatedLength>(m_height, (SVGStyledElement *)ownerDocument()->documentElement() == this ? 0 : this, LM_HEIGHT, viewport);
         m_height->baseVal()->setValueAsString(temp.impl());
     }