2007-01-13 Eric Seidel <eric@eseidel.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jan 2007 09:49:14 +0000 (09:49 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jan 2007 09:49:14 +0000 (09:49 +0000)
        Reviewed by hyatt.

        RichDraw demo does not live-update in Safari
        (SVG elements should ignore CSS position)
        http://bugs.webkit.org/show_bug.cgi?id=10364

        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::adjustRenderStyle): ignore position for everything but <svg>
        * ksvg2/svg/SVGStyledElement.cpp:
        (WebCore::SVGStyledElement::rebuildRenderer): move path generation into layout()
        * rendering/RenderContainer.cpp:
        (WebCore::RenderContainer::layout): ASSERT kids marked as having completed layout
        * rendering/RenderPath.cpp:
        (WebCore::RenderPath::layout): move path generation into layout()
        * rendering/RenderSVGContainer.cpp:
        (WebCore::RenderSVGContainer::layout): ASSERT kids marked as having completed layout

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/svg-absolute-children-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/svg-absolute-children-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/svg-absolute-children-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/svg-absolute-children.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/cssstyleselector.cpp
WebCore/ksvg2/svg/SVGStyledElement.cpp
WebCore/rendering/RenderContainer.cpp
WebCore/rendering/RenderPath.cpp
WebCore/rendering/RenderSVGContainer.cpp

index 9dd0935e0a723beb0426f8686e2d0bf5a886c135..e66cfb50c2cb907a2d3ebd1a610b16d6fb49677d 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-13  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by hyatt.
+        
+        Test case for:
+        http://bugs.webkit.org/show_bug.cgi?id=10364
+
+        * svg/custom/svg-absolute-children-expected.checksum: Added.
+        * svg/custom/svg-absolute-children-expected.png: Added.
+        * svg/custom/svg-absolute-children-expected.txt: Added.
+        * svg/custom/svg-absolute-children.svg: Added.
+
 2007-01-12  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by Maciej.
         * fast/css-generated-content/reset-content-to-initial-expected.txt: Added.
         * fast/css-generated-content/reset-content-to-initial.html: Added.
 
-2006-12-31  Eric Seidel  <eric@eseidel.com>
+2006-12-31  Eric Seidel  <eric@webkit.org>
 
         Reviewed by mitz.
         
         * svg/custom/path-getTotalLength-expected.txt:
         * svg/custom/path-getTotalLength.svg:
 
-2006-12-31  Eric Seidel  <eric@eseidel.com>
+2006-12-31  Eric Seidel  <eric@webkit.org>
 
         Reviewed by weinig.
         
         * svg/custom/viewbox-syntax-expected.txt: Added.
         * svg/custom/viewbox-syntax.svg: Added.
 
-2006-12-29  Eric Seidel  <eric@eseidel.com>
+2006-12-29  Eric Seidel  <eric@webkit.org>
 
         Reviewed by olliej.
         
diff --git a/LayoutTests/svg/custom/svg-absolute-children-expected.checksum b/LayoutTests/svg/custom/svg-absolute-children-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/svg-absolute-children-expected.png b/LayoutTests/svg/custom/svg-absolute-children-expected.png
new file mode 100644 (file)
index 0000000..3db2634
Binary files /dev/null and b/LayoutTests/svg/custom/svg-absolute-children-expected.png differ
diff --git a/LayoutTests/svg/custom/svg-absolute-children-expected.txt b/LayoutTests/svg/custom/svg-absolute-children-expected.txt
new file mode 100644 (file)
index 0000000..537bb6b
--- /dev/null
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+    RenderSVGContainer {svg} at (0,0) size 100x100
+      RenderPath {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"]
+      RenderPath {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/svg-absolute-children.svg b/LayoutTests/svg/custom/svg-absolute-children.svg
new file mode 100644 (file)
index 0000000..4d363b4
--- /dev/null
@@ -0,0 +1,19 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" style="position: static">
+  <rect width="100" height="100" fill="red" />
+  <rect id="rect" width="1" height="1" fill="green" style="position: absolute" />
+  <script>
+  <![CDATA[
+    if (window.layoutTestController)
+      layoutTestController.waitUntilDone();
+    
+    var test = function() {
+      var rect = document.getElementById('rect');
+      rect.setAttribute("width", "100");
+      rect.setAttribute("height", "100");
+      if (window.layoutTestController)
+        layoutTestController.notifyDone();
+    }
+    window.setTimeout(test, 0);
+  ]]>
+  </script>
+</svg>
index 506d577e5aebd3edb763bf22a98384bd26919464..1414f5029e626ce960d746a107f790f36270c686 100644 (file)
@@ -1,3 +1,22 @@
+2007-01-13  Eric Seidel  <eric@eseidel.com>
+
+        Reviewed by hyatt.
+
+        RichDraw demo does not live-update in Safari
+        (SVG elements should ignore CSS position)
+        http://bugs.webkit.org/show_bug.cgi?id=10364
+
+        * css/cssstyleselector.cpp:
+        (WebCore::CSSStyleSelector::adjustRenderStyle): ignore position for everything but <svg>
+        * ksvg2/svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::rebuildRenderer): move path generation into layout()
+        * rendering/RenderContainer.cpp:
+        (WebCore::RenderContainer::layout): ASSERT kids marked as having completed layout
+        * rendering/RenderPath.cpp:
+        (WebCore::RenderPath::layout): move path generation into layout()
+        * rendering/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::layout): ASSERT kids marked as having completed layout
+
 2007-01-12  David Hyatt  <hyatt@apple.com>
 
         Add support for column rules.
index 4a1957c652f0cb05aeee312b136f5d63b8ca0dc6..0868b2a34a4429215dfb6f61290b10bdd0c8910d 100644 (file)
@@ -63,6 +63,7 @@
 
 #ifdef SVG_SUPPORT
 #include "XLinkNames.h"
+#include "SVGNames.h"
 #endif
 
 using namespace std;
@@ -1139,6 +1140,10 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
             style->setOverflowX(OHIDDEN);
         else if (style->overflowX() == OAUTO)
             style->setOverflowX(OVISIBLE);
+        
+        // Only the root <svg> element in an SVG document fragment tree honors css position
+        if (!(e->hasTagName(SVGNames::svgTag) && e->parentNode() && !e->parentNode()->isSVGElement()))
+            style->setPosition(RenderStyle::initialPosition());
     }
 #endif
 }
index 94ab20050b71463fbae663cbd050a840797d879b..5cb36e3f571e818a54eea2d95e151505d78ecfd6 100644 (file)
@@ -106,17 +106,10 @@ void SVGStyledElement::rebuildRenderer() const
     if (!renderer() || !renderer()->isRenderPath())
         return;
     
-    RenderPath* renderPath = static_cast<RenderPath*>(renderer());
-    bool renderSection = false;
-    
+    RenderPath* renderPath = static_cast<RenderPath*>(renderer());    
     SVGElement* parentElement = svg_dynamic_cast(parentNode());
     if (parentElement && parentElement->renderer() && parentElement->isStyled()
         && parentElement->childShouldCreateRenderer(const_cast<SVGStyledElement*>(this)))
-        renderSection = true;
-
-    renderPath->setPath(toPathData());
-
-    if (renderSection)
         renderPath->setNeedsLayout(true);
 }
 
index ee4ec54a5e721c56f909f1143613f1a7209d5dfb..972a89a8f56765fa2aff7bc84cf61c7f2af08929 100644 (file)
@@ -476,6 +476,7 @@ void RenderContainer::layout()
     RenderObject* child = m_firstChild;
     while (child) {
         child->layoutIfNeeded();
+        ASSERT(!child->needsLayout());
         child = child->nextSibling();
     }
     setNeedsLayout(false);
index 399d7eabaca0cc46458a9f8a5b988c6129a7e3d0..2b61d1fdc53b5a10d6361712e93b715a75da1ee6 100644 (file)
@@ -120,11 +120,8 @@ void RenderPath::layout()
     bool checkForRepaint = checkForRepaintDuringLayout();
     if (selfNeedsLayout() && checkForRepaint)
         oldBounds = m_absoluteBounds;
-
-    // FIXME: Until JSSVGPathSeg* relies on the genericContext<> hack for update
-    // notifications, we can't really disable this. It would break js-update-path-changes.svg
-    // if (m_path.isEmpty() && m_fillBBox.isEmpty() && m_strokeBbox.isEmpty())
-        static_cast<SVGStyledElement*>(element())->rebuildRenderer();
+    
+    setPath(static_cast<SVGStyledElement*>(element())->toPathData());
 
     m_absoluteBounds = getAbsoluteRepaintRect();
 
index 37da004020e2c84d1497a6687ff2f0834502b302..36c7a942beb2244b591d8bfefb2075d1ba9954c0 100644 (file)
@@ -114,6 +114,7 @@ void RenderSVGContainer::layout()
             child->setNeedsLayout(true);
 
         child->layoutIfNeeded();
+        ASSERT(!child->needsLayout());
         child = child->nextSibling();
     }