mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
LibWeb: Compute display: contents as none for unusual elements
https://drafts.csswg.org/css-display-3/#unbox-html specifies certain elements that have their `display` style computed as `none` when specified as `contents`. This fixes at least one WPT test: http://wpt.live/css/css-display/display-contents-suppression-dynamic-001.html
This commit is contained in:
committed by
Andreas Kling
parent
eef9a53eec
commit
3b1d1d4582
@@ -8,6 +8,7 @@
|
||||
#include <LibWeb/Bindings/HTMLObjectElementPrototype.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/DocumentLoading.h>
|
||||
@@ -155,6 +156,13 @@ JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(CSS::StyleProperti
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void HTMLObjectElement::adjust_computed_style(CSS::StyleProperties& style)
|
||||
{
|
||||
// https://drafts.csswg.org/css-display-3/#unbox
|
||||
if (style.display().is_contents())
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)));
|
||||
}
|
||||
|
||||
bool HTMLObjectElement::has_ancestor_media_element_or_object_element_not_showing_fallback_content() const
|
||||
{
|
||||
for (auto const* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
|
||||
Reference in New Issue
Block a user