servo: Merge #7563 - Layerize StackingContexts that are on top of layers (from mrobinson:layerize-stacking-contexts); r=pcwalton

StackingContexts that should be painted on top of StackingContexts that
are already layerized should automatically get their own layer. This
will ensure proper painting order.

Source-Repo: https://github.com/servo/servo
Source-Revision: c0381c732569b9abe6282c6c750533bc271a2019
This commit is contained in:
Martin Robinson
2015-09-09 10:52:56 -06:00
parent ccdb612ff8
commit 568dda00c6
4 changed files with 124 additions and 9 deletions

View File

@@ -36,19 +36,35 @@ impl FrameTreeId {
}
#[derive(Clone, PartialEq, Eq, Copy, Hash, Deserialize, Serialize, HeapSizeOf)]
pub struct LayerId(pub usize, pub u32);
pub struct LayerId(
/// A base layer ID, currently derived from DOM element pointer address.
pub usize,
/// FIXME(#2010, pcwalton): A marker for overflow scroll layers.
pub u32,
/// A sub ID, which is used for synthesizing new layers for content that
/// belongs on top of this layer. This prevents accidentally making colliding
/// layer ids.
pub u32
);
impl Debug for LayerId {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let LayerId(a, b) = *self;
write!(f, "Layer({}, {})", a, b)
let LayerId(a, b, c) = *self;
write!(f, "Layer({}, {}, {})", a, b, c)
}
}
impl LayerId {
/// FIXME(#2011, pcwalton): This is unfortunate. Maybe remove this in the future.
pub fn null() -> LayerId {
LayerId(0, 0)
LayerId(0, 0, 0)
}
pub fn next_layer_id(&self) -> LayerId {
let LayerId(a, b, sub_id) = *self;
LayerId(a, b, sub_id + 1)
}
}