mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Add 'Attribute' as a CSS SimpleSelector::Type
Previously, SimpleSelectors optionally had Attribute-selector data as well as their main type. Now, they're either one or the other, which better matches the spec, and makes parsing and matching more straightforward.
This commit is contained in:
committed by
Andreas Kling
parent
dadcb46344
commit
96b2356cbb
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -21,6 +22,7 @@ public:
|
||||
TagName,
|
||||
Id,
|
||||
Class,
|
||||
Attribute,
|
||||
};
|
||||
Type type { Type::Invalid };
|
||||
|
||||
@@ -56,20 +58,22 @@ public:
|
||||
|
||||
FlyString value;
|
||||
|
||||
enum class AttributeMatchType {
|
||||
None,
|
||||
HasAttribute,
|
||||
ExactValueMatch,
|
||||
ContainsWord, // [att~=val]
|
||||
ContainsString, // [att*=val]
|
||||
StartsWithSegment, // [att|=val]
|
||||
StartsWithString, // [att^=val]
|
||||
EndsWithString, // [att$=val]
|
||||
struct Attribute {
|
||||
enum class MatchType {
|
||||
None,
|
||||
HasAttribute,
|
||||
ExactValueMatch,
|
||||
ContainsWord, // [att~=val]
|
||||
ContainsString, // [att*=val]
|
||||
StartsWithSegment, // [att|=val]
|
||||
StartsWithString, // [att^=val]
|
||||
EndsWithString, // [att$=val]
|
||||
};
|
||||
MatchType match_type { MatchType::None };
|
||||
FlyString name;
|
||||
String value;
|
||||
};
|
||||
|
||||
AttributeMatchType attribute_match_type { AttributeMatchType::None };
|
||||
FlyString attribute_name;
|
||||
String attribute_value;
|
||||
Attribute attribute;
|
||||
|
||||
struct NthChildPattern {
|
||||
int step_size = 0;
|
||||
|
||||
Reference in New Issue
Block a user