Skip to content

Commit

Permalink
Convert embed hidden into a proper boolean attribute
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259550

Reviewed by Tim Nguyen.

This patch aligns WebKit with Blink / Chromium.

Inspired by: https://chromium-review.googlesource.com/c/chromium/src/+/3565492

This patch makes the 'hidden' attribute behaves as a normal
boolean attribute - presence of the attribute is interpreted as
a "true" value.

This appears to be per-spec:

- https://html.spec.whatwg.org/#the-embed-element
- https://html.spec.whatwg.org/#the-hidden-attribute
- https://html.spec.whatwg.org/#boolean-attribute

* Source/WebCore/html/HTMLEmbedElement.cpp:
(HTMLEmbedElement::collectPresentationalHintsForAttribute): Remove 'attribute' cases and add assert for 'value'
* LayoutTests/TestExpectations: Remove failing test case

Canonical link: https://commits.webkit.org/266399@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Jul 28, 2023
1 parent 6517574 commit 54238fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ imported/w3c/web-platform-tests/html/canvas/element/manual/filters/tentative/can
imported/w3c/web-platform-tests/html/canvas/element/manual/layers/layers-several-complex.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/appearance/appearance-animation-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/appearance/appearance-transition-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-hidden-attribute.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-layout-stale-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-selection.html [ Pass Failure ]

Expand Down
7 changes: 3 additions & 4 deletions Source/WebCore/html/HTMLEmbedElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ RenderWidget* HTMLEmbedElement::renderWidgetLoadingPlugin() const
void HTMLEmbedElement::collectPresentationalHintsForAttribute(const QualifiedName& name, const AtomString& value, MutableStyleProperties& style)
{
if (name == hiddenAttr) {
if (equalLettersIgnoringASCIICase(value, "yes"_s) || equalLettersIgnoringASCIICase(value, "true"_s)) {
addPropertyToPresentationalHintStyle(style, CSSPropertyWidth, 0, CSSUnitType::CSS_PX);
addPropertyToPresentationalHintStyle(style, CSSPropertyHeight, 0, CSSUnitType::CSS_PX);
}
ASSERT(!value.isNull());
addPropertyToPresentationalHintStyle(style, CSSPropertyWidth, 0, CSSUnitType::CSS_PX);
addPropertyToPresentationalHintStyle(style, CSSPropertyHeight, 0, CSSUnitType::CSS_PX);
} else
HTMLPlugInImageElement::collectPresentationalHintsForAttribute(name, value, style);
}
Expand Down

0 comments on commit 54238fd

Please sign in to comment.