mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-06 00:51:51 +00:00
LibWeb: Map dimension attributes for table elements
This commit is contained in:
parent
728236f4d2
commit
140dc95e67
Notes:
github-actions[bot]
2024-10-02 09:28:16 +00:00
Author: https://github.com/tcl3
Commit: 140dc95e67
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1591
9 changed files with 61 additions and 8 deletions
|
@ -6,8 +6,10 @@
|
|||
|
||||
#include <LibWeb/Bindings/HTMLTableColElementPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/HTML/HTMLTableColElement.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -42,4 +44,16 @@ WebIDL::ExceptionOr<void> HTMLTableColElement::set_span(unsigned int value)
|
|||
return set_attribute(HTML::AttributeNames::span, MUST(String::number(value)));
|
||||
}
|
||||
|
||||
void HTMLTableColElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:maps-to-the-dimension-property-2
|
||||
if (name == HTML::AttributeNames::width) {
|
||||
if (auto parsed_value = parse_dimension_value(value)) {
|
||||
style.set_property(CSS::PropertyID::Width, *parsed_value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue