diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-03-21 21:04:56 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-22 15:47:36 +0100 |
commit | 13e1232d798ae977da8c1077e9aeb07cf87283f8 (patch) | |
tree | 04e664fc0ffc11ebf460bef7469d2cbf89f49f73 | |
parent | c0d3f1a5e47476cd5c2ba4ea3058d88a0de2fda2 (diff) | |
download | serenity-13e1232d798ae977da8c1077e9aeb07cf87283f8.zip |
LibWeb: Remove separate Token::m_unit field
Dimension tokens don't make use of the m_value string for anything else,
so we can sneak the unit string in there.
- Token goes from 72 to 64 bytes
- StyleComponentValueRule goes from 80 to 72 bytes
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Token.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Token.h b/Userland/Libraries/LibWeb/CSS/Parser/Token.h index f09b74df5a..a5c6e7b156 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Token.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Token.h @@ -126,7 +126,7 @@ public: StringView dimension_unit() const { VERIFY(m_type == Type::Dimension); - return m_unit.view(); + return m_value.view(); } float dimension_value() const { @@ -155,7 +155,6 @@ private: Type m_type { Type::Invalid }; FlyString m_value; - FlyString m_unit; Number m_number_value; HashType m_hash_type { HashType::Unrestricted }; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp index 033af6beb5..b4d1d3d6ca 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp @@ -845,7 +845,8 @@ Token Tokenizer::consume_a_numeric_token() // 2. Consume a name. Set the <dimension-token>’s unit to the returned value. auto unit = consume_a_name(); VERIFY(!unit.is_empty()); - token.m_unit = move(unit); + // NOTE: We intentionally store this in the `value`, to save space. + token.m_value = move(unit); // 3. Return the <dimension-token>. return token; |