Layerize StackingContexts that are on top of layers

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.
This commit is contained in:
Martin Robinson 2015-09-04 12:44:43 -07:00
parent c442132196
commit 184238c348
8 changed files with 171 additions and 14 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)
}
}