aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_dom/element.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-03-26 09:33:12 +0100
committerGitHub <noreply@github.com>2025-03-26 08:33:12 +0000
commita9b393a854cea733c8e157072d374d89e93ea469 (patch)
treeaff992e5a169899ccbef046af2f77af799ddc4b9 /components/script/layout_dom/element.rs
parent09041e77a044fdc771338d8e3023a830608d4264 (diff)
downloadservo-a9b393a854cea733c8e157072d374d89e93ea469.tar.gz
servo-a9b393a854cea733c8e157072d374d89e93ea469.zip
script: Eliminate `PseudoElementType` (#36146)
Servo has a `PseudoElementType` which more or less duplicate's Stylo's `PseudoElement` with the addition of a non-pseudo element variant. This type needs to be converted into `PseudoElement` anyway when asking for the style of an element from Stylo, so eliminate Servo's version and simply use `Option<PseudoElement>` with the `None` variant meaning the non-pseudo. This is preparation for adding support for the `::marker` pseudo element. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/layout_dom/element.rs')
-rw-r--r--components/script/layout_dom/element.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index ab09c9f7d20..7237ec68d37 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -11,7 +11,7 @@ use constellation_traits::UntrustedNodeAddress;
use html5ever::{LocalName, Namespace, local_name, namespace_url, ns};
use js::jsapi::JSObject;
use script_layout_interface::wrapper_traits::{
- LayoutNode, PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
+ LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{LayoutNodeType, StyleData};
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
@@ -785,9 +785,9 @@ impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> {
pub struct ServoThreadSafeLayoutElement<'dom> {
pub(super) element: ServoLayoutElement<'dom>,
- /// The pseudo-element type, with (optionally)
- /// a specified display value to override the stylesheet.
- pub(super) pseudo: PseudoElementType,
+ /// The pseudo-element type for this element, or `None` if it is the non-pseudo
+ /// version of the element.
+ pub(super) pseudo: Option<PseudoElement>,
}
impl<'dom> ThreadSafeLayoutElement<'dom> for ServoThreadSafeLayoutElement<'dom> {
@@ -801,14 +801,14 @@ impl<'dom> ThreadSafeLayoutElement<'dom> for ServoThreadSafeLayoutElement<'dom>
}
}
- fn get_pseudo_element_type(&self) -> PseudoElementType {
+ fn pseudo_element(&self) -> Option<PseudoElement> {
self.pseudo
}
- fn with_pseudo(&self, pseudo: PseudoElementType) -> Self {
+ fn with_pseudo(&self, pseudo: PseudoElement) -> Self {
ServoThreadSafeLayoutElement {
element: self.element,
- pseudo,
+ pseudo: Some(pseudo),
}
}