Skip to content
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

Why is <object> doing half of replaced element sizing negotiation? #7037

Open
tabatkins opened this issue Sep 7, 2021 · 1 comment
Open

Comments

@tabatkins
Copy link
Contributor

(Copied from w3c/csswg-drafts#6469 to solicit wider review.)

Why are object elements doing only half of the object size negotiation? They're passing up sizing information from the embedded SVG to the OBJECT box (as you can see it respecting the SVG's aspect ratio to calculate the object's height), but the resulting SVG is laid out inside the OBJECT as if in an IFRAME rather than in an IMG element.

Afaict, nothing in the HTML spec says to treat them differently than IMG... https://html.spec.whatwg.org/multipage/rendering.html

Testcase comparing img, object, iframe, inline svg; source code below:

<!doctype html>
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' style='background: orange'><circle cx='50' cy='50' r='50' fill='blue' /></svg>">

<object type="image/svg+xml" data="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' style='background: orange'><circle cx='50' cy='50' r='50' fill='blue' /></svg>"></object>

<iframe type="image/svg+xml" src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' style='background: orange'><circle cx='50' cy='50' r='50' fill='blue' /></svg>"></iframe>

<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' style='background: orange'><circle cx='50' cy='50' r='50' fill='blue' /></svg>

<style>
img, object, iframe, svg { border: thick dotted; width: 200px; }
</style>

@annevk
Copy link
Member

annevk commented Sep 8, 2021

For a number of cases object and embed create a nested browsing context. They do so for SVG as well, otherwise getSVGDocument() would not work.

That sizing is still passed around to some extent is not exactly desirable as this presents an information leak and is something we should try to remove over time.

In general both object and embed probably need to be deprecated. (And they also need cleanup, as per #1460 and various other issues, not all of them recorded.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants