-
Notifications
You must be signed in to change notification settings - Fork 711
[css-images-4] object-* properties and the iframe element #7143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 to ignoring object-overflow, there is a clear security reason for it. For object-view-box, technically we could use a subset of the iframe's document as the content for the iframe but I'm not sure what the use-case would me. I naively thought the spec text (as written) would already makes it so object-view-box doesn't apply. It requires the content of the replaced element to have a natural/intrinsic size. And iframes shouldn't have an intrinsic size, the embedded document is sized to match the iframe's content box. But it looks like the above is the case for Firefox/Chrome but not Safari. object-fit and object-position on an iframe are currently a no-op in both except safari. |
Ah right, indeed object-view-box won't apply. object-position will; it moves the contents around after the concrete object size has been determined, so it doesn't rely on having intrinsic sizes. object-fit is technically applies, but when you chase the definitions you find that all values have the same effect as 'fill' when the object doesn't have intrinsic sizes, so in practice it doesn't apply. Okay, so then that simplifies things; this issue is solely about object-overflow, then. |
FWIW: if there are security concerns & restrictions-needed for Those are both replaced elements where these new And of course: like
|
I always forget those elements exist, but yes, they're in the exact same bucket as iframe. |
Also |
Does this property need to apply to svg? The implementation in Chrome/Safari doesn't respect any of the existing object* properties (object-fit/object-position) on an inline svg :
And the overflow can already be created using the standard CSS overflow property :
|
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> topic: [css-images-4] object-* properties and the iframe element<fantasai> github: https://github.com//issues/7143 <fantasai> TabAtkins: When I was discussing the object-overflow property internally, it was brought up in security review that allowing iframes escape the bounds, even if embedding page opts into it, because they can change content arbitrarily via script <fantasai> TabAtkins: use cases for this seem fairly minimal <fantasai> TabAtkins: main use case for this property was to allow images to be larger than their content bounds <fantasai> TabAtkins: iframes don't make as much sense <fantasai> TabAtkins: so go ahead and enforce that iframes always stay clipped, with UA !important rule <fantasai> TabAtkins: Other HTML elements were also brought up, e.g. embed, object, ??, and I'm not sure about SVG foreignObject <chris> foreignObject is basically an iframe <Rossen_> q? <fantasai> TabAtkins: Proposal is to force iframe object embed and any other HTML or SVG elements that can be scriptable to clip via UA !important rule <emilio> ack emilio <fantasai> smfr: Can authors override UA !important? <fantasai> TabAtkins: no <chrishtr> proposed resolution sgtm <fantasai> RESOLVED: Force iframe/object/embed/any other scriptable document-embedding element to object-overflow: clip !important; via UA rule |
@annevk Can you elaborate on the |
@tabatkins I thought some user agents supported |
Internal google security review of the object-overflow property led them to ask about how this works on iframes; the reviewers were concerned about the possibility of iframes drawing outside of their bounds when object-view-box or object-fit caused them to be larger than the content box of the element.
This seems like a very reasonable concern to me, and I think the use-case for iframes drawing outside their bounds is of minimal usefulness (especially compared to the intended use-case, images). I propose that we require
iframe { object-overflow: clip !important; }
in the UA stylesheet.It's possible we should restrict all the object-* properties to their initial values on iframes, as a cautionary measure. Do others have thoughts on this?
The text was updated successfully, but these errors were encountered: