LibWeb: Use HTML::AttributeNames::foo instead of FlyString("foo")

To avoid the costly instantiation of FlyStrings whenever we're looking
up attributes, use the premade HTML::AttributeNames globals. :^)
This commit is contained in:
Andreas Kling 2020-06-03 20:51:28 +02:00
parent ff55d00261
commit 2149820260
Notes: sideshowbarker 2024-07-19 05:51:40 +09:00
16 changed files with 71 additions and 43 deletions

View file

@ -81,10 +81,10 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
text_box.set_text(value());
text_box.on_change = [this] {
auto& widget = to<LayoutWidget>(layout_node())->widget();
const_cast<HTMLInputElement*>(this)->set_attribute("value", static_cast<const GUI::TextBox&>(widget).text());
const_cast<HTMLInputElement*>(this)->set_attribute(HTML::AttributeNames::value, static_cast<const GUI::TextBox&>(widget).text());
};
int text_width = Gfx::Font::default_font().width(value());
auto size_value = attribute("size");
auto size_value = attribute(HTML::AttributeNames::size);
if (!size_value.is_null()) {
bool ok;
auto size = size_value.to_int(ok);