Bug 37086

Summary: Explicit size of object tag ignored
Product: WebKit Reporter: Jeff Schiller <jeffschiller@google.com>
Component: SVGAssignee: Nobody <webkit-unassigned@lists.webkit.org>
Status: RESOLVED FIXED    
Severity: Normal CC: zimmermann@kde.org
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Mac OS X 10.5   
Bug Depends on: 10526    
Bug Blocks:    
Attachments:
Description Flags
Test HTML file
none
Test SVG file none

Description From 2010-04-05 07:46:31 PST
embed-rect.html:

<!DOCTYPE html>
<html><body>
  <p>Text above the rect</p>
  <object width="400" height="400" type="image/svg+xml" data="huge-rect.svg"/>
  <p>Text below the rect</p>
</body></html>



huge-rect.svg:

<?xml version="1.0"?>
<svg width="4000" height="4000" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
  <rect width="100" height="100" fill="blue" stroke-width="5" stroke="green"/>
</svg>


Firefox and Opera properly display the entire rect inside the 400x400 frame of the <object> element.  WebKit does not properly change the size of the rendered rect, only displaying the top-left corner in the 400x400 frame.

See http://www.w3.org/TR/SVG11/coords.html#ViewportSpace :

"The width attribute on the outermost 'svg' element establishes the viewport's width, unless the following conditions are met:

    * the SVG content is a separately stored resource that is embedded by reference (such as the 'object' element in [XHTML]), or the SVG content is embedded inline within a containing document;
    * and the referencing element or containing document is styled using CSS [CSS2] or XSL [XSL];
    * and there are CSS-compatible positioning properties [ CSS2-POSN] specified on the referencing element (e.g., the 'object' element) or on the containing document's outermost 'svg' element that are sufficient to establish the width of the viewport.

Under these conditions, the positioning properties establish the viewport's width."

This means that the width/height of the viewport are established by the object's width/height attributes and override the SVG's width/height.
------- Comment #1 From 2010-04-05 07:46:57 PST -------
Created an attachment (id=52534) [details]
Test HTML file
------- Comment #2 From 2010-04-05 07:47:15 PST -------
Created an attachment (id=52535) [details]
Test SVG file
------- Comment #3 From 2011-05-27 05:41:28 PST -------
The patch on bug 10526 fixes this bug.
------- Comment #4 From 2011-05-27 11:31:58 PST -------
Fixed in r87526.