2006-01-29 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jan 2006 09:40:10 +0000 (09:40 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jan 2006 09:40:10 +0000 (09:40 +0000)
        Reviewed by hyatt.

        First set of fixes for SVG Tetris:
        http://bugzilla.opendarwin.org/show_bug.cgi?id=6889

        Tests:
        * svg/custom/viewport-update.svg
        Key press test not yet possible:
        http://bugzilla.opendarwin.org/show_bug.cgi?id=6906

        * bridge/mac/MacFrame.mm:
        (MacFrame::keyEvent): pass key events to things other than HTML
        * ksvg2/svg/SVGSVGElementImpl.cpp:
        (WebCore::SVGSVGElementImpl::parseMappedAttribute): update viewport

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/viewport-update-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/viewport-update-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/viewport-update-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/viewport-update.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bridge/mac/MacFrame.mm
WebCore/ksvg2/svg/SVGSVGElementImpl.cpp

index 8bcf8eb92693813a37e7e6a81268862e7ef68cf8..cedd79c86f65301b79d985fc07de6f2e1ac5cf8d 100644 (file)
@@ -1,3 +1,12 @@
+2006-01-29  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by hyatt.
+
+        * svg/custom/viewport-update-expected.checksum: Added.
+        * svg/custom/viewport-update-expected.png: Added.
+        * svg/custom/viewport-update-expected.txt: Added.
+        * svg/custom/viewport-update.svg: Added.
+
 2006-01-29  Darin Adler  <darin@apple.com>
 
         - updated tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=6895
diff --git a/LayoutTests/svg/custom/viewport-update-expected.checksum b/LayoutTests/svg/custom/viewport-update-expected.checksum
new file mode 100644 (file)
index 0000000..7363841
--- /dev/null
@@ -0,0 +1 @@
+778803df0a824ed8f2c7dfa07c56832e
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/viewport-update-expected.png b/LayoutTests/svg/custom/viewport-update-expected.png
new file mode 100644 (file)
index 0000000..3db2634
Binary files /dev/null and b/LayoutTests/svg/custom/viewport-update-expected.png differ
diff --git a/LayoutTests/svg/custom/viewport-update-expected.txt b/LayoutTests/svg/custom/viewport-update-expected.txt
new file mode 100644 (file)
index 0000000..3467f0d
--- /dev/null
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (-100,-100) size 200x200
+      KCanvasItem {rect} at (-100,-100) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M-100.00,-100.00L0.00,-100.00L0.00,0.00L-100.00,0.00"]
+      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/viewport-update.svg b/LayoutTests/svg/custom/viewport-update.svg
new file mode 100644 (file)
index 0000000..bb3b829
--- /dev/null
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-100 -100 800 600">
+<script>
+document.documentElement.setAttribute("viewBox", "0 0 800 600");
+</script>
+<rect x="-100" y="-100" width="100" height="100" fill="red"/>
+<rect x="0" y="0" width="100" height="100" fill="green"/>
+</svg>
\ No newline at end of file
index bff83aa9e81f129e505b40408b0ca626527d78cb..8d149b33f3de6634bc346f933bf86d6ad3e4cba7 100644 (file)
@@ -1,3 +1,20 @@
+2006-01-29  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by hyatt.
+
+        First set of fixes for SVG Tetris:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=6889
+
+        Tests:
+        * svg/custom/viewport-update.svg
+        Key press test not yet possible:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=6906
+
+        * bridge/mac/MacFrame.mm:
+        (MacFrame::keyEvent): pass key events to things other than HTML
+        * ksvg2/svg/SVGSVGElementImpl.cpp:
+        (WebCore::SVGSVGElementImpl::parseMappedAttribute): update viewport
+
 2006-01-29  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by mjs.
index 9b3859ef585623ebaf1fc864353a8d61c0ed757c..497b7fa11ef771dc30102302720537586d4dbb85 100644 (file)
@@ -1448,10 +1448,12 @@ bool MacFrame::keyEvent(NSEvent *event)
     }
     NodeImpl *node = doc->focusNode();
     if (!node) {
-        node = doc->body();
-        if (!node) {
+        if (doc->isHTMLDocument())
+            node = doc->body();
+        else
+            node = doc->documentElement();
+        if (!node)
             return false;
-        }
     }
     
     if ([event type] == NSKeyDown) {
index 892356ab11e4cfa878f21933b7f95f46b3d062f7..2f5d15da7cee84a93c086fb2fe9d4e152ef67384 100644 (file)
@@ -269,7 +269,10 @@ void SVGSVGElementImpl::parseMappedAttribute(KDOM::MappedAttributeImpl *attr)
         if(SVGTestsImpl::parseMappedAttribute(attr)) return;
         if(SVGLangSpaceImpl::parseMappedAttribute(attr)) return;
         if(SVGExternalResourcesRequiredImpl::parseMappedAttribute(attr)) return;
-        if(SVGFitToViewBoxImpl::parseMappedAttribute(attr)) return;
+        if (SVGFitToViewBoxImpl::parseMappedAttribute(attr)) {
+            if (renderer())
+                static_cast<KCanvasContainer*>(renderer())->setViewBox(FloatRect(viewBox()->baseVal()->x(), viewBox()->baseVal()->y(), viewBox()->baseVal()->width(), viewBox()->baseVal()->height()));
+        }
         if(SVGZoomAndPanImpl::parseMappedAttribute(attr)) return;
 
         SVGStyledLocatableElementImpl::parseMappedAttribute(attr);