Bug 37086 - Explicit size of object tag ignored
Summary: Explicit size of object tag ignored
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 10526
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-05 07:46 PDT by Jeff Schiller
Modified: 2011-05-27 11:31 PDT (History)
1 user (show)

See Also:


Attachments
Test HTML file (174 bytes, text/html)
2010-04-05 07:46 PDT, Jeff Schiller
no flags Details
Test SVG file (197 bytes, image/svg+xml)
2010-04-05 07:47 PDT, Jeff Schiller
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Schiller 2010-04-05 07:46:31 PDT
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 Jeff Schiller 2010-04-05 07:46:57 PDT
Created attachment 52534 [details]
Test HTML file
Comment 2 Jeff Schiller 2010-04-05 07:47:15 PDT
Created attachment 52535 [details]
Test SVG file
Comment 3 Nikolas Zimmermann 2011-05-27 05:41:28 PDT
The patch on bug 10526 fixes this bug.
Comment 4 Nikolas Zimmermann 2011-05-27 11:31:58 PDT
Fixed in r87526.