mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Apply nowrap
attribute as presentational hint
This commit is contained in:
parent
a4ee3fb1f0
commit
d3c51ea05e
Notes:
github-actions[bot]
2025-02-22 09:13:06 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/d3c51ea05e9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3655 Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 21 additions and 0 deletions
|
@ -47,6 +47,7 @@ bool HTMLTableCellElement::is_presentational_hint(FlyString const& name) const
|
|||
HTML::AttributeNames::background,
|
||||
HTML::AttributeNames::bgcolor,
|
||||
HTML::AttributeNames::height,
|
||||
HTML::AttributeNames::nowrap,
|
||||
HTML::AttributeNames::valign,
|
||||
HTML::AttributeNames::width);
|
||||
}
|
||||
|
@ -92,6 +93,9 @@ void HTMLTableCellElement::apply_presentational_hints(GC::Ref<CSS::CascadedPrope
|
|||
if (auto parsed_value = document().encoding_parse_url(value); parsed_value.has_value())
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(*parsed_value));
|
||||
return;
|
||||
} else if (name == HTML::AttributeNames::nowrap) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::WhiteSpace, CSS::CSSKeywordValue::create(CSS::Keyword::Nowrap));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<div style="width: 100px; height: 100px; background: green;"></div>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/#tables-2">
|
||||
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=821915">
|
||||
<link rel="match" href="../../../../../../expected/wpt-import/html/rendering/non-replaced-elements/tables/table-cell-nowrap-with-fixed-width-ref.html">
|
||||
<title>A td element with the nowrap attribute should unconditionally apply white-space:nowrap</title>
|
||||
<style>
|
||||
table { border-spacing: 0; }
|
||||
td { width: 10px; padding: 0; }
|
||||
div { display: inline-block; background: green; width: 50px; height: 100px; }
|
||||
</style>
|
||||
<table>
|
||||
<td nowrap>
|
||||
<div></div><div></div>
|
||||
</td>
|
||||
</table>
|
Loading…
Add table
Reference in a new issue