Skip to content

Commit 8deef12

Browse files
committed
Add support for the ::marker pseudo-element
Signed-off-by: Martin Robinson <[email protected]>
1 parent 127952e commit 8deef12

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

style/servo/selector_parser.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@ pub enum PseudoElement {
5050
// them. Also, make sure the UA sheet has the !important rules some of the
5151
// APPLIES_TO_PLACEHOLDER properties expect!
5252

53-
Backdrop,
54-
5553
// Non-eager pseudos.
54+
Backdrop,
5655
DetailsSummary,
5756
DetailsContent,
57+
Marker,
5858
ServoAnonymousBox,
5959
ServoAnonymousTable,
6060
ServoAnonymousTableCell,
6161
ServoAnonymousTableRow,
62-
ServoLegacyText,
6362
ServoLegacyInputText,
6463
ServoLegacyTableWrapper,
6564
ServoLegacyAnonymousTableWrapper,
@@ -87,11 +86,11 @@ impl ToCss for PseudoElement {
8786
Backdrop => "::backdrop",
8887
DetailsSummary => "::-servo-details-summary",
8988
DetailsContent => "::-servo-details-content",
89+
Marker => "::marker",
9090
ServoAnonymousBox => "::-servo-anonymous-box",
9191
ServoAnonymousTable => "::-servo-anonymous-table",
9292
ServoAnonymousTableCell => "::-servo-anonymous-table-cell",
9393
ServoAnonymousTableRow => "::-servo-anonymous-table-row",
94-
ServoLegacyText => "::-servo-legacy-text",
9594
ServoLegacyInputText => "::-servo-legacy-input-text",
9695
ServoLegacyTableWrapper => "::-servo-legacy-table-wrapper",
9796
ServoLegacyAnonymousTableWrapper => "::-servo-legacy-anonymous-table-wrapper",
@@ -155,7 +154,7 @@ impl PseudoElement {
155154
/// Whether this pseudo-element is the ::marker pseudo.
156155
#[inline]
157156
pub fn is_marker(&self) -> bool {
158-
false
157+
*self == PseudoElement::Marker
159158
}
160159

161160
/// Whether this pseudo-element is the ::selection pseudo.
@@ -226,22 +225,25 @@ impl PseudoElement {
226225

227226
/// Returns which kind of cascade type has this pseudo.
228227
///
229-
/// For more info on cascade types, see docs/components/style.md
228+
/// See the documentation for `PseudoElementCascadeType` for how we choose
229+
/// which cascade type to use.
230230
///
231-
/// Note: Keep this in sync with EAGER_PSEUDO_COUNT.
231+
/// Note: Keep eager pseudos in sync with `EAGER_PSEUDO_COUNT` and
232+
/// `EMPTY_PSEUDO_ARRAY` in `style/data.rs`
232233
#[inline]
233234
pub fn cascade_type(&self) -> PseudoElementCascadeType {
234235
match *self {
235236
PseudoElement::After | PseudoElement::Before | PseudoElement::Selection => {
236237
PseudoElementCascadeType::Eager
237238
},
238-
PseudoElement::Backdrop | PseudoElement::DetailsSummary => PseudoElementCascadeType::Lazy,
239+
PseudoElement::Backdrop |
240+
PseudoElement::DetailsSummary |
241+
PseudoElement::Marker => PseudoElementCascadeType::Lazy,
239242
PseudoElement::DetailsContent |
240243
PseudoElement::ServoAnonymousBox |
241244
PseudoElement::ServoAnonymousTable |
242245
PseudoElement::ServoAnonymousTableCell |
243246
PseudoElement::ServoAnonymousTableRow |
244-
PseudoElement::ServoLegacyText |
245247
PseudoElement::ServoLegacyInputText |
246248
PseudoElement::ServoLegacyTableWrapper |
247249
PseudoElement::ServoLegacyAnonymousTableWrapper |
@@ -608,8 +610,9 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
608610
let pseudo_element = match_ignore_ascii_case! { &name,
609611
"before" => Before,
610612
"after" => After,
611-
"selection" => Selection,
612613
"backdrop" => Backdrop,
614+
"selection" => Selection,
615+
"marker" => Marker,
613616
"-servo-details-summary" => {
614617
if !self.in_user_agent_stylesheet() {
615618
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))
@@ -628,12 +631,6 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
628631
}
629632
ServoAnonymousBox
630633
},
631-
"-servo-legacy-text" => {
632-
if !self.in_user_agent_stylesheet() {
633-
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))
634-
}
635-
ServoLegacyText
636-
},
637634
"-servo-legacy-input-text" => {
638635
if !self.in_user_agent_stylesheet() {
639636
return Err(location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))

stylo_static_prefs/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ macro_rules! pref {
3636
("layout.css.transition-behavior.enabled") => {
3737
true
3838
};
39+
("layout.css.marker.restricted") => {
40+
true
41+
};
3942
($string:literal) => {
4043
false
4144
};

0 commit comments

Comments
 (0)