mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
style: Remove unused optional display from PseudoElementType definition.
Everyone passes None now.
This commit is contained in:
parent
55174991b6
commit
cb2bba8777
3 changed files with 13 additions and 24 deletions
|
@ -1473,15 +1473,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
||||||
None => {
|
None => {
|
||||||
// Pseudo-element.
|
// Pseudo-element.
|
||||||
let style = node.style(self.style_context());
|
let style = node.style(self.style_context());
|
||||||
let display = match node.get_pseudo_element_type() {
|
(style.get_box().display, style.get_box().float, style.get_box().position)
|
||||||
PseudoElementType::Normal => Display::Inline,
|
|
||||||
PseudoElementType::Before(maybe_display) |
|
|
||||||
PseudoElementType::After(maybe_display) |
|
|
||||||
PseudoElementType::DetailsContent(maybe_display) |
|
|
||||||
PseudoElementType::DetailsSummary(maybe_display)
|
|
||||||
=> maybe_display.unwrap_or(style.get_box().display),
|
|
||||||
};
|
|
||||||
(display, style.get_box().float, style.get_box().position)
|
|
||||||
}
|
}
|
||||||
Some(LayoutNodeType::Element(_)) => {
|
Some(LayoutNodeType::Element(_)) => {
|
||||||
let style = node.style(self.style_context());
|
let style = node.style(self.style_context());
|
||||||
|
|
|
@ -63,7 +63,6 @@ use std::sync::atomic::Ordering;
|
||||||
use style::CaseSensitivityExt;
|
use style::CaseSensitivityExt;
|
||||||
use style::applicable_declarations::ApplicableDeclarationBlock;
|
use style::applicable_declarations::ApplicableDeclarationBlock;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
use style::computed_values::display;
|
|
||||||
use style::context::SharedStyleContext;
|
use style::context::SharedStyleContext;
|
||||||
use style::data::ElementData;
|
use style::data::ElementData;
|
||||||
use style::dom::{DomChildren, LayoutIterator, NodeInfo, OpaqueNode};
|
use style::dom::{DomChildren, LayoutIterator, NodeInfo, OpaqueNode};
|
||||||
|
@ -804,7 +803,7 @@ pub struct ServoThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
/// The pseudo-element type, with (optionally)
|
/// The pseudo-element type, with (optionally)
|
||||||
/// a specified display value to override the stylesheet.
|
/// a specified display value to override the stylesheet.
|
||||||
pseudo: PseudoElementType<Option<display::T>>,
|
pseudo: PseudoElementType<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
||||||
|
@ -1083,7 +1082,7 @@ pub struct ServoThreadSafeLayoutElement<'le> {
|
||||||
|
|
||||||
/// The pseudo-element type, with (optionally)
|
/// The pseudo-element type, with (optionally)
|
||||||
/// a specified display value to override the stylesheet.
|
/// a specified display value to override the stylesheet.
|
||||||
pseudo: PseudoElementType<Option<display::T>>,
|
pseudo: PseudoElementType<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
||||||
|
@ -1096,15 +1095,14 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<display::T>> {
|
fn get_pseudo_element_type(&self) -> PseudoElementType<()> {
|
||||||
self.pseudo
|
self.pseudo
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_pseudo(&self,
|
fn with_pseudo(&self, pseudo: PseudoElementType<()>) -> Self {
|
||||||
pseudo: PseudoElementType<Option<display::T>>) -> Self {
|
|
||||||
ServoThreadSafeLayoutElement {
|
ServoThreadSafeLayoutElement {
|
||||||
element: self.element.clone(),
|
element: self.element.clone(),
|
||||||
pseudo: pseudo,
|
pseudo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ use servo_arc::Arc;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
use style::computed_values::display::T as Display;
|
|
||||||
use style::context::SharedStyleContext;
|
use style::context::SharedStyleContext;
|
||||||
use style::data::ElementData;
|
use style::data::ElementData;
|
||||||
use style::dom::{LayoutIterator, NodeInfo, TNode};
|
use style::dom::{LayoutIterator, NodeInfo, TNode};
|
||||||
|
@ -197,7 +196,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
||||||
fn as_element(&self) -> Option<Self::ConcreteThreadSafeLayoutElement>;
|
fn as_element(&self) -> Option<Self::ConcreteThreadSafeLayoutElement>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<Display>> {
|
fn get_pseudo_element_type(&self) -> PseudoElementType<()> {
|
||||||
self.as_element().map_or(PseudoElementType::Normal, |el| el.get_pseudo_element_type())
|
self.as_element().map_or(PseudoElementType::Normal, |el| el.get_pseudo_element_type())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +301,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
|
|
||||||
/// Creates a new `ThreadSafeLayoutElement` for the same `LayoutElement`
|
/// Creates a new `ThreadSafeLayoutElement` for the same `LayoutElement`
|
||||||
/// with a different pseudo-element type.
|
/// with a different pseudo-element type.
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType<Option<Display>>) -> Self;
|
fn with_pseudo(&self, pseudo: PseudoElementType<()>) -> Self;
|
||||||
|
|
||||||
/// Returns the type ID of this node.
|
/// Returns the type ID of this node.
|
||||||
/// Returns `None` if this is a pseudo-element; otherwise, returns `Some`.
|
/// Returns `None` if this is a pseudo-element; otherwise, returns `Some`.
|
||||||
|
@ -325,12 +324,12 @@ pub trait ThreadSafeLayoutElement
|
||||||
fn style_data(&self) -> AtomicRef<ElementData>;
|
fn style_data(&self) -> AtomicRef<ElementData>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<Display>>;
|
fn get_pseudo_element_type(&self) -> PseudoElementType<()>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_before_pseudo(&self) -> Option<Self> {
|
fn get_before_pseudo(&self) -> Option<Self> {
|
||||||
if self.style_data().styles.pseudos.get(&PseudoElement::Before).is_some() {
|
if self.style_data().styles.pseudos.get(&PseudoElement::Before).is_some() {
|
||||||
Some(self.with_pseudo(PseudoElementType::Before(None)))
|
Some(self.with_pseudo(PseudoElementType::Before(())))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -339,7 +338,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_after_pseudo(&self) -> Option<Self> {
|
fn get_after_pseudo(&self) -> Option<Self> {
|
||||||
if self.style_data().styles.pseudos.get(&PseudoElement::After).is_some() {
|
if self.style_data().styles.pseudos.get(&PseudoElement::After).is_some() {
|
||||||
Some(self.with_pseudo(PseudoElementType::After(None)))
|
Some(self.with_pseudo(PseudoElementType::After(())))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -349,7 +348,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
||||||
if self.get_local_name() == &local_name!("details") &&
|
if self.get_local_name() == &local_name!("details") &&
|
||||||
self.get_namespace() == &ns!(html) {
|
self.get_namespace() == &ns!(html) {
|
||||||
Some(self.with_pseudo(PseudoElementType::DetailsSummary(None)))
|
Some(self.with_pseudo(PseudoElementType::DetailsSummary(())))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -360,7 +359,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
if self.get_local_name() == &local_name!("details") &&
|
if self.get_local_name() == &local_name!("details") &&
|
||||||
self.get_namespace() == &ns!(html) &&
|
self.get_namespace() == &ns!(html) &&
|
||||||
self.get_attr(&ns!(), &local_name!("open")).is_some() {
|
self.get_attr(&ns!(), &local_name!("open")).is_some() {
|
||||||
Some(self.with_pseudo(PseudoElementType::DetailsContent(None)))
|
Some(self.with_pseudo(PseudoElementType::DetailsContent(())))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue