diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-06-30 16:27:37 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-11 23:19:56 +0200 |
commit | a558916e1f77ed21c49e2e59cd83f09ce2dfa5ac (patch) | |
tree | d5a769ec7e76312d53d7f429acf2443a5de53751 /Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h | |
parent | f7c79de0c504c54ae482e4b57921b5c69172e905 (diff) | |
download | serenity-a558916e1f77ed21c49e2e59cd83f09ce2dfa5ac.zip |
LibWeb: Make CSS selector parsing use StyleComponentValueRules
Also added some pseudo-classes that were handled in the deprecated
parser:
- :disabled
- :enabled
- :checked
- :nth-child
- :nth-last-child
- :not
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h b/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h index 40a77826de..f03265dbef 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleComponentValueRule.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020-2021, the SerenityOS developers. + * Copyright (c) 2021, Sam Atkins <atkinssj@gmail.com> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -25,6 +26,19 @@ public: explicit StyleComponentValueRule(ComponentType); ~StyleComponentValueRule(); + bool is_block() const { return m_type == ComponentType::Block; } + StyleBlockRule const& block() const { return m_block; } + + bool is_function() const { return m_type == ComponentType::Function; } + StyleFunctionRule const& function() const { return m_function; } + + bool is(Token::TokenType type) const + { + return m_type == ComponentType::Token && m_token.is(type); + } + Token const& token() const { return m_token; } + operator Token() const { return m_token; } + String to_string() const; private: |