mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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.
This commit is contained in:
parent
1b6d4daf85
commit
1e6f797268
9 changed files with 128 additions and 41 deletions
|
@ -66,11 +66,6 @@ use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode
|
|||
use util::opts;
|
||||
use util::range::Range;
|
||||
|
||||
/// The fake fragment ID we use to indicate the inner display list for `overflow: scroll`.
|
||||
///
|
||||
/// FIXME(pcwalton): This is pretty ugly. Consider modifying `LayerId` somehow.
|
||||
const FAKE_FRAGMENT_ID_FOR_OVERFLOW_SCROLL: u32 = 1000000;
|
||||
|
||||
/// The logical width of an insertion point: at the moment, a one-pixel-wide line.
|
||||
const INSERTION_POINT_LOGICAL_WIDTH: Au = Au(1 * AU_PER_PX);
|
||||
|
||||
|
@ -1641,7 +1636,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
&self.base,
|
||||
display_list,
|
||||
layout_context,
|
||||
StackingContextLayerNecessity::Always(self.layer_id(0), scroll_policy),
|
||||
StackingContextLayerNecessity::Always(self.layer_id(), scroll_policy),
|
||||
StackingContextCreationMode::Normal);
|
||||
DisplayListBuildingResult::StackingContext(stacking_context)
|
||||
} else if self.fragment.establishes_stacking_context() {
|
||||
|
@ -1650,7 +1645,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
&self.base,
|
||||
display_list,
|
||||
layout_context,
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id(0)),
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id()),
|
||||
StackingContextCreationMode::Normal))
|
||||
} else {
|
||||
match self.fragment.style.get_box().position {
|
||||
|
@ -1727,7 +1722,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
&self.base,
|
||||
display_list,
|
||||
layout_context,
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id(0)),
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id()),
|
||||
StackingContextCreationMode::Normal));
|
||||
}
|
||||
return
|
||||
|
@ -1747,9 +1742,9 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
};
|
||||
|
||||
let layer_id = if outer_display_list_for_overflow_scroll.is_some() {
|
||||
self.layer_id(FAKE_FRAGMENT_ID_FOR_OVERFLOW_SCROLL)
|
||||
self.layer_id_for_overflow_scroll()
|
||||
} else {
|
||||
self.layer_id(0)
|
||||
self.layer_id()
|
||||
};
|
||||
let stacking_context = self.fragment.create_stacking_context(
|
||||
&self.base,
|
||||
|
@ -1766,7 +1761,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
&self.base,
|
||||
outer_display_list_for_overflow_scroll,
|
||||
layout_context,
|
||||
StackingContextLayerNecessity::Always(self.layer_id(0), scroll_policy),
|
||||
StackingContextLayerNecessity::Always(self.layer_id(), scroll_policy),
|
||||
StackingContextCreationMode::OuterScrollWrapper)
|
||||
}
|
||||
None => stacking_context,
|
||||
|
@ -1792,7 +1787,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
&self.base,
|
||||
display_list,
|
||||
layout_context,
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id(0)),
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id()),
|
||||
StackingContextCreationMode::Normal))
|
||||
} else {
|
||||
DisplayListBuildingResult::Normal(display_list)
|
||||
|
@ -1892,7 +1887,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
|
|||
&self.base,
|
||||
display_list,
|
||||
layout_context,
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id(0)),
|
||||
StackingContextLayerNecessity::IfCanvas(self.layer_id()),
|
||||
StackingContextCreationMode::Normal))
|
||||
} else {
|
||||
DisplayListBuildingResult::Normal(display_list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue