RE: Embedding SVG - need help

Thanks, that makes sense. The discrepancy between browsers leads me to believe that other developers are also overlooking this connection; it might be worthwhile to update the wording in the SVG specification to explicitly call this out in the first bullet point in 7.2. For example (caps lock just because this is plain mail):

    * the SVG content is a separately stored resource that is embedded by reference USING A REPLACED ELEMENT (such as the 'object' element in XHTML [XHTML]), or the SVG content is embedded inline within a containing document;

- Tony

-----Original Message-----
From: Jonathan Watt [mailto:jwatt@jwatt.org] 
Sent: Tuesday, September 14, 2010 5:42 PM
To: Tony Schreiner
Cc: Jeff Schiller; www-svg
Subject: Re: Embedding SVG - need help

On 14/09/2010 17:26, Tony Schreiner wrote:
> Interesting... After looking at the test page on several browsers including IE9 I have a couple questions about section 7.2:
> 
> 1) Based on the language in the spec I don't see how IFRAME should behave differently than OBJECT/EMBED, but browsers such as Opera that do not show scrollbars in the first or second row for OBJECT and EMBED still do for IFRAME.

That's because <iframe> is not a "replaced element" (a CSS term), whereas <img>, <object> and <embed> are.

> 2) If the width and height of the containing OBJECT/EMBED/IFRAME element always overrides what is specified on the outermost SVG element, how would a developer embed an SVG document that's large and intended to be scrolled?

The width/height of the <svg> is not overridden in the case of <iframe> - so authors would use <iframe> if they want the scrolling behavior.

> As an aside, there are a similar set of inconsistencies across browsers when the size is left off the containing OBJECT, EMBED, IFRAME, and IMG elements.

Indeed. In the case that the referencing HTML element does not have its size fixed purely by its own document, it should look at the document that it's embedding and use the intrinsic dimensions or aspect ration of that document to help in deciding its dimensions. (See the "replaced element" sections of chapter
10 of CSS 2.1 for the exact mechanisms*.) That done, the overriding of the width/height of the <svg> continues as normal - although after applying the CSS rules to the dimensions of the <object> (or whatever) it will often then have the same dimensions as the <svg>.

Jonathan

* http://www.w3.org/TR/CSS21/visudet.html

> Thanks,
> - Tony
> 
> -----Original Message-----
> From: www-svg-request@w3.org [mailto:www-svg-request@w3.org] On Behalf 
> Of Jonathan Watt
> Sent: Tuesday, September 14, 2010 4:23 PM
> To: Jeff Schiller
> Cc: www-svg
> Subject: Re: Embedding SVG - need help
> 
> I don't have the time to read the other replies in this thread right now, but here's my take:
> 
> For me on Mac, Mozilla nightly and Opera 10.61 show the same thing in all rows except the second row. Mozilla has the <object> and <embed> entries in this row wrong - scrollbars should not be displayed because SVG 1.1 says the width/height of the referenced SVG file is overridden in these cases:
> 
>   http://www.w3.org/TR/SVG11/coords.html#ViewportSpace
> 
> IMO Opera has the <img> entry in this row wrong, since for <img> too the width/height of the referenced SVG should be overridden by the width/height of the <img>. I imagine Erik may disagree with me on this one case though.
> 
> IMO both browsers otherwise behave as the specs require them too.
> 
> Jonathan
> 
> On 14/09/2010 11:20, Jeff Schiller wrote:
>>
>>
>> On Tue, Sep 14, 2010 at 11:08 AM, Doug Schepers <schepers@w3.org 
>> <mailto:schepers@w3.org>> wrote:
>>
>>     There's the SVG Integration spec:
>>      http://dev.w3.org/SVG/modules/integration/SVGIntegration.html
>>
>>     I've got a few actions to follow up on from the last SVG WG F2F, and as soon
>>     as I update the draft, we will be pushing for a First Public Working Draft
>>     on the spec.  It should answer some of the questions I anticipate you have.
>>
>>
>> Correct me if I'm wrong, but that spec doesn't (yet?) cover sizing 
>> issues (though it does specify other important things like Referencing Modes.
>>
>> For sizing, it seems there are a lot of things to consider:
>>
>> - containing object's explicit/implicit size
>> - <svg>'s size (fixed, percentage)
>> - viewBox
>> - preserveAspectRatio
>>
>> I think the behavior might be specified across the CSS, HTML, SVG 1.1 
>> specs, but it's really not 100% clear to me.  That's why I made that 
>> grid of 16 tests testing 3 dimensions (referencing element type, svg width/height, viewBox).
>> Note that there are other dimensions to the test that I didn't bother 
>> with (ones where <img> and <object> don't have specified sizes, preserveAspectRatio=none).
>>
>> Maybe this is something that was covered clearly in the WICD/CDF specs?
>>
>> Thanks,
>> Jeff
> 
> 
> 
> 

Received on Wednesday, 15 September 2010 01:08:01 UTC