diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-08-04 12:53:26 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-08-04 12:53:26 -0600 |
commit | 56d3426431d98a6f43698f33bb7ce4d3ad67adeb (patch) | |
tree | acf8f93b9e6c3341a6b95bc527d8b95d393bde9b /components/layout/wrapper.rs | |
parent | 220557008318350b444ba1917a3b07e03d30bec5 (diff) | |
parent | 0a589d413d03b11198033e34b28cb24bed99c0fb (diff) | |
download | servo-56d3426431d98a6f43698f33bb7ce4d3ad67adeb.tar.gz servo-56d3426431d98a6f43698f33bb7ce4d3ad67adeb.zip |
Auto merge of #6940 - pcwalton:inline-pseudo-repair-jumpiness, r=mbrubeck
layout: When repairing styles for incremental reflow, only repair styles of nodes that represent the dirty node, *including its pseudo-element*.
r? @mbrubeck
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6940)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/wrapper.rs')
-rw-r--r-- | components/layout/wrapper.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 26378daf40c..93e52192d64 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -588,13 +588,13 @@ impl<'le> TElementAttributes for LayoutElement<'le> { } #[derive(Copy, PartialEq, Clone)] -pub enum PseudoElementType { +pub enum PseudoElementType<T> { Normal, - Before(display::T), - After(display::T), + Before(T), + After(T), } -impl PseudoElementType { +impl<T> PseudoElementType<T> { pub fn is_before(&self) -> bool { match *self { PseudoElementType::Before(_) => true, @@ -608,6 +608,14 @@ impl PseudoElementType { _ => false, } } + + pub fn strip(&self) -> PseudoElementType<()> { + match *self { + PseudoElementType::Normal => PseudoElementType::Normal, + PseudoElementType::Before(_) => PseudoElementType::Before(()), + PseudoElementType::After(_) => PseudoElementType::After(()), + } + } } /// A thread-safe version of `LayoutNode`, used during flow construction. This type of layout @@ -617,7 +625,7 @@ pub struct ThreadSafeLayoutNode<'ln> { /// The wrapped node. node: LayoutNode<'ln>, - pseudo: PseudoElementType, + pseudo: PseudoElementType<display::T>, } impl<'ln> ThreadSafeLayoutNode<'ln> { @@ -639,7 +647,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// Creates a new `ThreadSafeLayoutNode` for the same `LayoutNode` /// with a different pseudo-element type. - fn with_pseudo(&self, pseudo: PseudoElementType) -> ThreadSafeLayoutNode<'ln> { + fn with_pseudo(&self, pseudo: PseudoElementType<display::T>) -> ThreadSafeLayoutNode<'ln> { ThreadSafeLayoutNode { node: self.node.clone(), pseudo: pseudo, @@ -697,7 +705,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { } #[inline] - pub fn get_pseudo_element_type(&self) -> PseudoElementType { + pub fn get_pseudo_element_type(&self) -> PseudoElementType<display::T> { self.pseudo } |