aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/flow.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2015-09-08 18:59:30 -0700
committerMartin Robinson <mrobinson@igalia.com>2015-09-17 06:42:29 -0700
commit1e6f797268f1197a71ad1e1f3983ff637d4e01ed (patch)
tree8a10e2199a0b7b0c32dd42c3b602b315f25239e4 /components/layout/flow.rs
parent1b6d4daf85d672265824a014dba99c94c8c08814 (diff)
downloadservo-1e6f797268f1197a71ad1e1f3983ff637d4e01ed.tar.gz
servo-1e6f797268f1197a71ad1e1f3983ff637d4e01ed.zip
Ensure unique LayerIds for pseudo-elements
Currently pseudo-elements, like the fragments created for ::before and ::after, with layers will have the same LayerId as the body of their owning fragments. Instead all LayerIds should be unique. Fixes #2010.
Diffstat (limited to 'components/layout/flow.rs')
-rw-r--r--components/layout/flow.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 51321e75b2c..578a95fb05c 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -48,7 +48,7 @@ use wrapper::{PseudoElementType, ThreadSafeLayoutNode};
use euclid::{Point2D, Rect, Size2D};
use gfx::display_list::ClippingRegion;
-use msg::compositor_msg::LayerId;
+use msg::compositor_msg::{LayerId, LayerType};
use msg::constellation_msg::ConstellationChan;
use rustc_serialize::{Encoder, Encodable};
use std::fmt;
@@ -359,9 +359,16 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
/// Returns a layer ID for the given fragment.
#[allow(unsafe_code)]
- fn layer_id(&self, fragment_id: u32) -> LayerId {
+ fn layer_id(&self) -> LayerId {
let obj = unsafe { mem::transmute::<&&Self, &raw::TraitObject>(&self) };
- LayerId(obj.data as usize, fragment_id, 0)
+ LayerId::new_of_type(LayerType::FragmentBody, obj.data as usize)
+ }
+
+ /// Returns a layer ID for the given fragment.
+ #[allow(unsafe_code)]
+ fn layer_id_for_overflow_scroll(&self) -> LayerId {
+ let obj = unsafe { mem::transmute::<&&Self, &raw::TraitObject>(&self) };
+ LayerId::new_of_type(LayerType::OverflowScroll, obj.data as usize)
}
/// Attempts to perform incremental fixup of this flow by replacing its fragment's style with