Skip to content

Commit 4bcf988

Browse files
committed
LibWeb: Use FlyString attribute name comparisons in encoding detection
Prevent some unnecessary work by performing pointer comparisons.
1 parent 4ebbbdf commit 4bcf988

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ Optional<ByteString> run_prescan_byte_stream_algorithm(DOM::Document& document,
295295
auto const& attribute_name = attribute->name();
296296
attribute_list.append(attribute->name());
297297

298-
if (attribute_name == "http-equiv") {
298+
if (attribute_name == AttributeNames::http_equiv) {
299299
got_pragma = attribute->value() == "content-type";
300-
} else if (attribute_name == "content") {
300+
} else if (attribute_name == AttributeNames::content) {
301301
auto encoding = extract_character_encoding_from_meta_element(attribute->value().to_byte_string());
302302
if (encoding.has_value() && !charset.has_value()) {
303303
charset = encoding.value();
304304
need_pragma = true;
305305
}
306-
} else if (attribute_name == "charset") {
306+
} else if (attribute_name == AttributeNames::charset) {
307307
auto maybe_charset = TextCodec::get_standardized_encoding(attribute->value());
308308
if (maybe_charset.has_value()) {
309309
charset = Optional<ByteString> { maybe_charset };

0 commit comments

Comments
 (0)