mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
LibWeb: Use [Reflect] to implement HTMLPreElement.width
This commit is contained in:
committed by
Andreas Kling
parent
2a7cf1c588
commit
58bb5e1f7a
Notes:
sideshowbarker
2024-07-17 07:38:17 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/58bb5e1f7a Pull-request: https://github.com/SerenityOS/serenity/pull/24402 Reviewed-by: https://github.com/mattco98
@@ -38,20 +38,4 @@ void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) con
|
||||
});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/obsolete.html#dom-pre-width
|
||||
WebIDL::Long HTMLPreElement::width() const
|
||||
{
|
||||
// The width IDL attribute of the pre element must reflect the content attribute of the same name.
|
||||
if (auto width_string = get_attribute(HTML::AttributeNames::width); width_string.has_value()) {
|
||||
if (auto width = parse_integer(*width_string); width.has_value())
|
||||
return *width;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> HTMLPreElement::set_width(WebIDL::Long width)
|
||||
{
|
||||
return set_attribute(HTML::AttributeNames::width, MUST(String::number(width)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user