1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibWeb: Hide implementation details of HTMLToken attribute list

Previously, HTMLToken would expose the Vector<Attribute> directly to
its users. In preparation for a future change, all users now use
implementation-agnostic APIs which do not expose the Vector directly.
This commit is contained in:
Max Wipfli 2021-07-14 23:53:11 +02:00 committed by Ali Mohammad Pur
parent 15d8635afc
commit 918bde98b1
6 changed files with 108 additions and 59 deletions

View file

@ -132,7 +132,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
{ palette.syntax_keyword(), {}, false, true },
token->is_start_tag() ? AugmentedTokenKind::OpenTag : AugmentedTokenKind::CloseTag);
for (auto& attribute : token->attributes()) {
token->for_each_attribute([&](auto& attribute) {
highlight(
attribute.name_start_position.line,
attribute.name_start_position.column + token_start_offset,
@ -147,7 +147,8 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
attribute.value_end_position.column + token_start_offset,
{ palette.syntax_string(), {} },
AugmentedTokenKind::AttributeValue);
}
return IterationDecision::Continue;
});
} else if (token->is_doctype()) {
highlight(
token->start_position().line,