Title: [98263] trunk
Revision
98263
Author
[email protected]
Date
2011-10-24 11:56:16 -0700 (Mon, 24 Oct 2011)

Log Message

<svg> fails to use explicit width and height inside <html> inside IFRAME
https://bugs.webkit.org/show_bug.cgi?id=64823

Reviewed by Nikolas Zimmermann.

Source/WebCore: 

Checking that embedded SVG is in an SVG document before negotiating size
with the host document.

Test: svg/as-object/svg-embedded-in-html-in-iframe.html

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::isEmbeddedThroughFrameContainingSVGDocument):
(WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
(WebCore::RenderSVGRoot::computeReplacedLogicalHeight):

LayoutTests: 

Fixing a bug where SVG negotiated size when embedded in html inside an iframe.

* platform/chromium/test_expectations.txt: Will update with results on other platforms.
* platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.png: Added.
* platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt: Added.
* svg/as-object/svg-embedded-in-html-in-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98262 => 98263)


--- trunk/LayoutTests/ChangeLog	2011-10-24 18:41:35 UTC (rev 98262)
+++ trunk/LayoutTests/ChangeLog	2011-10-24 18:56:16 UTC (rev 98263)
@@ -1,3 +1,17 @@
+2011-10-24  Levi Weintraub  <[email protected]>
+
+        <svg> fails to use explicit width and height inside <html> inside IFRAME
+        https://bugs.webkit.org/show_bug.cgi?id=64823
+
+        Reviewed by Nikolas Zimmermann.
+
+        Fixing a bug where SVG negotiated size when embedded in html inside an iframe.
+
+        * platform/chromium/test_expectations.txt: Will update with results on other platforms.
+        * platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.png: Added.
+        * platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt: Added.
+        * svg/as-object/svg-embedded-in-html-in-iframe.html: Added.
+
 2011-10-24  Julien Chaffraix  <[email protected]>
 
         Unreviewed gardening rebaselining.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (98262 => 98263)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-10-24 18:41:35 UTC (rev 98262)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-10-24 18:56:16 UTC (rev 98263)
@@ -3819,3 +3819,7 @@
 BUGWK70704 SNOWLEOPARD : fast/ruby/base-shorter-than-text.html = IMAGE+TEXT PASS
 BUGWK70704 SNOWLEOPARD : fast/writing-mode/fallback-orientation.html = TEXT
 BUGWK70704 SNOWLEOPARD : fast/backgrounds/background-leakage-transforms.html = TEXT
+
+// Will rebaseline
+BUGLEVIW : svg/as-object/svg-embedded-in-html-in-iframe.html = FAIL
+

Added: trunk/LayoutTests/platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt (0 => 98263)


--- trunk/LayoutTests/platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt	2011-10-24 18:56:16 UTC (rev 98263)
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x170
+  RenderBlock {HTML} at (0,0) size 800x170
+    RenderBody {BODY} at (8,8) size 784x154
+      RenderPartObject {IFRAME} at (0,0) size 784x150
+        layer at (0,0) size 784x150
+          RenderView at (0,0) size 784x150
+        layer at (0,0) size 784x120
+          RenderBlock {HTML} at (0,0) size 784x120
+            RenderBody {BODY} at (8,8) size 768x104
+              RenderSVGRoot {svg} at (8,8) size 100x100
+                RenderSVGPath {circle} at (8,8) size 100x100 [fill={[type=SOLID] [color=#0000FF]}] [cx=50.00] [cy=50.00] [r=50.00]
+              RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0

Added: trunk/LayoutTests/svg/as-object/svg-embedded-in-html-in-iframe.html (0 => 98263)


--- trunk/LayoutTests/svg/as-object/svg-embedded-in-html-in-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/svg/as-object/svg-embedded-in-html-in-iframe.html	2011-10-24 18:56:16 UTC (rev 98263)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/_javascript_">
+function CreateCircle(){
+var B="";
+B+="<!DOCTYPE html>";
+B+="<html>";
+B+="<body>";
+B+="<svg style=\"width:100px;height:100px;\">";
+B+="<circle cx=\"50%\" cy=\"50%\" r=\"50%\" fill=\"blue\" stroke=\"none\" />";
+B+="</svg>";
+B+="</body></html>";
+return B;
+}
+</script>
+</head>
+<body>
+<iframe src="" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (98262 => 98263)


--- trunk/Source/WebCore/ChangeLog	2011-10-24 18:41:35 UTC (rev 98262)
+++ trunk/Source/WebCore/ChangeLog	2011-10-24 18:56:16 UTC (rev 98263)
@@ -1,3 +1,20 @@
+2011-10-24  Levi Weintraub  <[email protected]>
+
+        <svg> fails to use explicit width and height inside <html> inside IFRAME
+        https://bugs.webkit.org/show_bug.cgi?id=64823
+
+        Reviewed by Nikolas Zimmermann.
+
+        Checking that embedded SVG is in an SVG document before negotiating size
+        with the host document.
+
+        Test: svg/as-object/svg-embedded-in-html-in-iframe.html
+
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::isEmbeddedThroughFrameContainingSVGDocument):
+        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
+        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
+
 2011-10-24  Rafael Weinstein  <[email protected]>
 
         Node::registeredMutationObserversOfType should be prefixed by "get"

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (98262 => 98263)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2011-10-24 18:41:35 UTC (rev 98262)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2011-10-24 18:56:16 UTC (rev 98263)
@@ -130,6 +130,15 @@
     return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom()));
 }
 
+static inline bool isEmbeddedThroughFrameContainingSVGDocument(const Frame* frame)
+{
+    ASSERT(frame);
+    ASSERT(frame->document());
+    // If our frame has an owner renderer, we're embedded through eg. object/embed/iframe,
+    // but we only negotiate if we're in an SVG document.
+    return !frame->ownerRenderer() || !frame->document()->isSVGDocument();
+}
+
 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
 {
     LayoutUnit replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth);
@@ -137,11 +146,10 @@
     if (!frame)
         return computeIntrinsicWidth(replacedWidth);
 
-    // If our frame has an owner renderer, we're embedded through eg. object/embed.
-    RenderPart* ownerRenderer = frame->ownerRenderer();
-    if (!ownerRenderer)
+    if (isEmbeddedThroughFrameContainingSVGDocument(frame))
         return computeIntrinsicWidth(replacedWidth);
 
+    RenderPart* ownerRenderer = frame->ownerRenderer();
     RenderStyle* ownerRendererStyle = ownerRenderer->style();
     ASSERT(ownerRendererStyle);
     ASSERT(frame->contentRenderer());
@@ -179,11 +187,10 @@
     if (!frame)
         return computeIntrinsicHeight(replacedHeight);
 
-    // If our frame has an owner renderer, we're embedded through eg. object/embed.
-    RenderPart* ownerRenderer = frame->ownerRenderer();
-    if (!ownerRenderer)
+    if (isEmbeddedThroughFrameContainingSVGDocument(frame))
         return computeIntrinsicHeight(replacedHeight);
 
+    RenderPart* ownerRenderer = frame->ownerRenderer();
     RenderStyle* ownerRendererStyle = ownerRenderer->style();
     ASSERT(ownerRendererStyle);
     ASSERT(frame->contentRenderer());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to