Open Bug 893946 Opened 11 years ago Updated 1 month ago

Follow the specs/other UAs regarding <embed hidden> behaviour

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: mounir, Unassigned)

References

Details

(Keywords: parity-chrome, parity-safari)

Attachments

(1 file)

We currently have a behaviour that could be made more standard (whether de-facto or by-spec), see bug 890516 comment 7.

The HTML5 spec call for width: 0px, height: 0px and display: inline when hidden is set on <embed>.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5

I couldn't find anything in html.css so I guess the hidden attribute is implemented elsewhere. (I also didn't test other browsers though.)

Severity: normal → --
Component: DOM: Core & HTML → CSS Parsing and Computation
Priority: P5 → --

It's implemented via attr mapping. See https://searchfox.org/mozilla-central/rev/f47a4b67643b3048ef9a2e2ac0c34edf6d1ebff3/dom/html/nsGenericHTMLElement.cpp#1195-1199

Note that <embed> already does weird things around the "hidden" attribute: it calls nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden so the "hidden" attribute is just a no-op for it right now, afaict. This bug is about making that attribute map to some styles, I guess?

(Also, HTMLEmbedElement::MapAttributesIntoRule seems to be dead code?)

Severity: -- → S3
Attached file testcase 1

Here's a testcase. Interop here is pretty bad; Firefox, Chromium, and WebKit render this quite differently.

  • Firefox renders all 4 embeds the same (with zero height and 100% auto-width, given that it's styled as display:block)
  • Chromium and WebKit don't render the first and third embeds at all (not even the border) -- i.e. no src attribute seems to make it effectively display:none for them? -- and they render the second one using the standard replaced-element-fallback 300x150 sizing.
  • Chromium renders the 4th embed as 0x0
  • WebKit renders the 4th embed as 300x150 (like the second); i.e. they have no special behavior for "hidden".

Chrome's devtools do show this style rule applying for the 3rd and 4th embed here (the embed hidden parts of this testcase):

embed[Attributes Style] {
    width: 0px;
    height: 0px;
}

...which I think correspond to the html5 spec thing that Mounir was referencing.

WebKit 176 now passes the WPT html/semantics/embedded-content/the-embed-element/embed-hidden-attribute.html

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: