Skip to content

Commit 13bab5e

Browse files
committed
Add checkmark pseudo element
Adds a `::-servo-checkmark` pseudo element for checkbox and radio inputs. Signed-off-by: Luke Warlow <lwarlow@igalia.com>
1 parent 9c1d70b commit 13bab5e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

style/servo/selector_parser.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub enum PseudoElement {
6969
// Private, Servo-specific implemented pseudos. Only matchable in UA sheet.
7070
ServoTextControlInnerContainer,
7171
ServoTextControlInnerEditor,
72+
ServoCheckmark,
7273

7374
// Other Servo-specific pseudos.
7475
ServoAnonymousBox,
@@ -98,6 +99,7 @@ impl ToCss for PseudoElement {
9899
Marker => "::marker",
99100
ColorSwatch => "::color-swatch",
100101
Placeholder => "::placeholder",
102+
ServoCheckmark => "::-servo-checkmark",
101103
ServoTextControlInnerContainer => "::-servo-text-control-inner-container",
102104
ServoTextControlInnerEditor => "::-servo-text-control-inner-editor",
103105
ServoAnonymousBox => "::-servo-anonymous-box",
@@ -248,6 +250,7 @@ impl PseudoElement {
248250
| PseudoElement::DetailsSummary
249251
| PseudoElement::Marker
250252
| PseudoElement::Placeholder
253+
| PseudoElement::ServoCheckmark
251254
| PseudoElement::ServoTextControlInnerContainer
252255
| PseudoElement::ServoTextControlInnerEditor => PseudoElementCascadeType::Lazy,
253256
PseudoElement::DetailsContent
@@ -632,6 +635,12 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
632635
"backdrop" => Backdrop,
633636
"selection" => Selection,
634637
"marker" => Marker,
638+
"-servo-checkmark" => {
639+
if !self.in_user_agent_stylesheet() {
640+
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))
641+
}
642+
ServoCheckmark
643+
},
635644
"-servo-details-summary" => {
636645
if !self.in_user_agent_stylesheet() {
637646
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))

0 commit comments

Comments
 (0)