Skip to content

Commit

Permalink
LibWeb: Make HTMLToken::{Position,AttributeBuilder} structs public
Browse files Browse the repository at this point in the history
There was and is no reason for those to be private. Making them public
also allows us to explicitly specify the return type of some getters.
  • Loading branch information
MaxWipfli authored and alimpfard committed Jul 17, 2021
1 parent eb282ad commit d82f3eb
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Andreas Kling <[email protected]>
* Copyright (c) 2021, Max Wipfli <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
Expand Down Expand Up @@ -29,6 +30,22 @@ class HTMLToken {
EndOfFile,
};

struct Position {
size_t line { 0 };
size_t column { 0 };
};

struct AttributeBuilder {
String prefix;
String local_name;
String namespace_;
String value;
Position name_start_position;
Position value_start_position;
Position name_end_position;
Position value_end_position;
};

static HTMLToken make_character(u32 code_point)
{
HTMLToken token;
Expand Down Expand Up @@ -158,32 +175,16 @@ class HTMLToken {

String to_string() const;

auto const& start_position() const { return m_start_position; }
auto const& end_position() const { return m_end_position; }
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }

auto const& attributes() const
Vector<Attribute> const& attributes() const
{
VERIFY(is_start_tag() || is_end_tag());
return m_tag.attributes;
}

private:
struct Position {
size_t line { 0 };
size_t column { 0 };
};

struct AttributeBuilder {
String prefix;
String local_name;
String namespace_;
String value;
Position name_start_position;
Position value_start_position;
Position name_end_position;
Position value_end_position;
};

Type m_type { Type::Invalid };

// Type::DOCTYPE
Expand Down

0 comments on commit d82f3eb

Please sign in to comment.