mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Use [Reflect]
to implement HTMLPreElement.width
This commit is contained in:
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
3 changed files with 1 additions and 20 deletions
|
@ -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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@ public:
|
|||
// https://www.w3.org/TR/html-aria/#el-pre
|
||||
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
|
||||
|
||||
WebIDL::Long width() const;
|
||||
WebIDL::ExceptionOr<void> set_width(WebIDL::Long);
|
||||
|
||||
private:
|
||||
HTMLPreElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@ interface HTMLPreElement : HTMLElement {
|
|||
[HTMLConstructor] constructor();
|
||||
|
||||
// Obsolete
|
||||
[CEReactions] attribute long width;
|
||||
[CEReactions, Reflect] attribute long width;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue