⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 100034 in webkit


Ignore:
Timestamp:
Nov 11, 2011, 3:15:14 PM (15 years ago)
Author:
leviw@chromium.org
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.
Location:
branches/chromium/874
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/chromium/874/LayoutTests/ChangeLog

    r98521 r100034  
     12011-10-24  Levi Weintraub  <leviw@chromium.org>
     2
     3        <svg> fails to use explicit width and height inside <html> inside IFRAME
     4        https://bugs.webkit.org/show_bug.cgi?id=64823
     5
     6        Reviewed by Nikolas Zimmermann.
     7
     8        Fixing a bug where SVG negotiated size when embedded in html inside an iframe.
     9
     10        * platform/chromium/test_expectations.txt: Will update with results on other platforms.
     11        * platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.png: Added.
     12        * platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt: Added.
     13        * svg/as-object/svg-embedded-in-html-in-iframe.html: Added.
     14
    1152011-10-20  Simon Fraser  <simon.fraser@apple.com>
    216
  • branches/chromium/874/LayoutTests/platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt

    r99115 r100034  
    1414              RenderText {#text} at (0,0) size 0x0
    1515      RenderText {#text} at (0,0) size 0x0
     16layer at (0,0) size 800x600
     17  RenderView at (0,0) size 800x600
     18layer at (0,0) size 800x170
     19  RenderBlock {HTML} at (0,0) size 800x170
     20    RenderBody {BODY} at (8,8) size 784x154
     21      RenderPartObject {IFRAME} at (0,0) size 784x150
     22        layer at (0,0) size 784x150
     23          RenderView at (0,0) size 784x150
     24        layer at (0,0) size 784x120
     25          RenderBlock {HTML} at (0,0) size 784x120
     26            RenderBody {BODY} at (8,8) size 768x104
     27              RenderSVGRoot {svg} at (8,8) size 100x100
     28                RenderSVGPath {circle} at (8,8) size 100x100 [fill={[type=SOLID] [color=#0000FF]}] [cx=50.00] [cy=50.00] [r=50.00]
     29              RenderText {#text} at (0,0) size 0x0
     30      RenderText {#text} at (0,0) size 0x0
  • branches/chromium/874/LayoutTests/svg/as-object/svg-embedded-in-html-in-iframe.html

    r99115 r100034  
    2121</html>
    2222
     23<!DOCTYPE html>
     24<html>
     25<head>
     26<script type="text/javascript">
     27function CreateCircle(){
     28var B="";
     29B+="<!DOCTYPE html>";
     30B+="<html>";
     31B+="<body>";
     32B+="<svg style=\"width:100px;height:100px;\">";
     33B+="<circle cx=\"50%\" cy=\"50%\" r=\"50%\" fill=\"blue\" stroke=\"none\" />";
     34B+="</svg>";
     35B+="</body></html>";
     36return B;
     37}
     38</script>
     39</head>
     40<body>
     41<iframe src="javascript:parent.CreateCircle();" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
     42</body>
     43</html>
     44
  • branches/chromium/874/Source/WebCore/ChangeLog

    r98522 r100034  
     12011-10-24  Levi Weintraub  <leviw@chromium.org>
     2
     3        <svg> fails to use explicit width and height inside <html> inside IFRAME
     4        https://bugs.webkit.org/show_bug.cgi?id=64823
     5
     6        Reviewed by Nikolas Zimmermann.
     7
     8        Checking that embedded SVG is in an SVG document before negotiating size
     9        with the host document.
     10
     11        Test: svg/as-object/svg-embedded-in-html-in-iframe.html
     12
     13        * rendering/svg/RenderSVGRoot.cpp:
     14        (WebCore::isEmbeddedThroughFrameContainingSVGDocument):
     15        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
     16        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
     17
    1182011-10-21  Simon Fraser  <simon.fraser@apple.com>
    219
  • branches/chromium/874/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r94372 r100034  
    131131}
    132132
     133static inline bool isEmbeddedThroughFrameContainingSVGDocument(const Frame* frame)
     134{
     135    ASSERT(frame);
     136    ASSERT(frame->document());
     137    // If our frame has an owner renderer, we're embedded through eg. object/embed/iframe,
     138    // but we only negotiate if we're in an SVG document.
     139    return !frame->ownerRenderer() || !frame->document()->isSVGDocument();
     140}
     141
    133142LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
    134143{
     
    138147        return computeIntrinsicWidth(replacedWidth);
    139148
    140     // If our frame has an owner renderer, we're embedded through eg. object/embed.
     149    if (isEmbeddedThroughFrameContainingSVGDocument(frame))
     150        return computeIntrinsicWidth(replacedWidth);
     151
    141152    RenderPart* ownerRenderer = frame->ownerRenderer();
    142     if (!ownerRenderer)
    143         return computeIntrinsicWidth(replacedWidth);
    144 
    145153    RenderStyle* ownerRendererStyle = ownerRenderer->style();
    146154    ASSERT(ownerRendererStyle);
     
    180188        return computeIntrinsicHeight(replacedHeight);
    181189
    182     // If our frame has an owner renderer, we're embedded through eg. object/embed.
     190    if (isEmbeddedThroughFrameContainingSVGDocument(frame))
     191        return computeIntrinsicHeight(replacedHeight);
     192
    183193    RenderPart* ownerRenderer = frame->ownerRenderer();
    184     if (!ownerRenderer)
    185         return computeIntrinsicHeight(replacedHeight);
    186 
    187194    RenderStyle* ownerRendererStyle = ownerRenderer->style();
    188195    ASSERT(ownerRendererStyle);
Note: See TracChangeset for help on using the changeset viewer.