зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #7137 - layout: Make absolutely-positioned elements with `z-index: auto` not stacking contexts (from pcwalton:absolute-stacking-contexts); r=glennw
Improves many sites. Closes #7069. r? @glennw Source-Repo: https://github.com/servo/servo Source-Revision: 7ce47266acc7c23de537905746b274b4a75424fa
This commit is contained in:
Родитель
6ad3db2453
Коммит
81fce89118
|
@ -181,25 +181,31 @@ impl DisplayList {
|
|||
for item in items.iter() {
|
||||
match *item {
|
||||
DisplayItem::SolidColorClass(ref solid_color) => {
|
||||
println!("{:?} SolidColor. {:?}", indentation, solid_color.base.bounds)
|
||||
println!("{} SolidColor({},{},{},{}). {:?}",
|
||||
indentation,
|
||||
solid_color.color.r,
|
||||
solid_color.color.g,
|
||||
solid_color.color.b,
|
||||
solid_color.color.a,
|
||||
solid_color.base.bounds)
|
||||
}
|
||||
DisplayItem::TextClass(ref text) => {
|
||||
println!("{:?} Text. {:?}", indentation, text.base.bounds)
|
||||
println!("{} Text. {:?}", indentation, text.base.bounds)
|
||||
}
|
||||
DisplayItem::ImageClass(ref image) => {
|
||||
println!("{:?} Image. {:?}", indentation, image.base.bounds)
|
||||
println!("{} Image. {:?}", indentation, image.base.bounds)
|
||||
}
|
||||
DisplayItem::BorderClass(ref border) => {
|
||||
println!("{:?} Border. {:?}", indentation, border.base.bounds)
|
||||
println!("{} Border. {:?}", indentation, border.base.bounds)
|
||||
}
|
||||
DisplayItem::GradientClass(ref gradient) => {
|
||||
println!("{:?} Gradient. {:?}", indentation, gradient.base.bounds)
|
||||
println!("{} Gradient. {:?}", indentation, gradient.base.bounds)
|
||||
}
|
||||
DisplayItem::LineClass(ref line) => {
|
||||
println!("{:?} Line. {:?}", indentation, line.base.bounds)
|
||||
println!("{} Line. {:?}", indentation, line.base.bounds)
|
||||
}
|
||||
DisplayItem::BoxShadowClass(ref box_shadow) => {
|
||||
println!("{:?} Box_shadow. {:?}", indentation, box_shadow.base.bounds)
|
||||
println!("{} Box_shadow. {:?}", indentation, box_shadow.base.bounds)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1631,15 +1631,28 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
Some(outer_display_list_for_overflow_scroll)
|
||||
}
|
||||
_ => {
|
||||
self.build_display_list_for_block_base(
|
||||
&mut *display_list,
|
||||
layout_context,
|
||||
border_painting_mode,
|
||||
BackgroundAndBorderLevel::RootOfStackingContext);
|
||||
let establishes_stacking_context = self.fragment.establishes_stacking_context();
|
||||
let background_and_border_level = if establishes_stacking_context {
|
||||
BackgroundAndBorderLevel::RootOfStackingContext
|
||||
} else {
|
||||
BackgroundAndBorderLevel::Block
|
||||
};
|
||||
|
||||
self.build_display_list_for_block_base(&mut *display_list,
|
||||
layout_context,
|
||||
border_painting_mode,
|
||||
background_and_border_level);
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
if !self.fragment.establishes_stacking_context() {
|
||||
display_list.form_pseudo_stacking_context_for_positioned_content();
|
||||
self.base.display_list_building_result =
|
||||
DisplayListBuildingResult::Normal(display_list);
|
||||
return
|
||||
}
|
||||
|
||||
if !self.will_get_layer() {
|
||||
// We didn't need a layer.
|
||||
self.base.display_list_building_result =
|
||||
|
|
|
@ -35,9 +35,9 @@ use std::fmt;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use string_cache::Atom;
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{border_collapse, clear, mix_blend_mode, overflow_wrap, position};
|
||||
use style::computed_values::{text_align, text_decoration, white_space, word_break};
|
||||
use style::computed_values::transform_style;
|
||||
use style::computed_values::{border_collapse, clear, mix_blend_mode, overflow_wrap, overflow_x};
|
||||
use style::computed_values::{position, text_align, text_decoration, transform_style, white_space};
|
||||
use style::computed_values::{word_break, z_index};
|
||||
use style::properties::{self, ComputedValues, cascade_anonymous};
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::{LengthOrPercentageOrNone};
|
||||
|
@ -2027,13 +2027,24 @@ impl Fragment {
|
|||
return true
|
||||
}
|
||||
|
||||
match self.style().get_box().position {
|
||||
position::T::absolute | position::T::fixed => {
|
||||
// FIXME(pcwalton): This should only establish a new stacking context when
|
||||
// `z-index` is not `auto`. But this matches what we did before.
|
||||
true
|
||||
}
|
||||
position::T::relative | position::T::static_ => {
|
||||
// FIXME(pcwalton): Don't unconditionally form stacking contexts for `overflow_x: scroll`
|
||||
// and `overflow_y: scroll`. This needs multiple layers per stacking context.
|
||||
match (self.style().get_box().position,
|
||||
self.style().get_box().z_index,
|
||||
self.style().get_box().overflow_x,
|
||||
self.style().get_box().overflow_y.0) {
|
||||
(position::T::absolute,
|
||||
z_index::T::Auto,
|
||||
overflow_x::T::visible,
|
||||
overflow_x::T::visible) |
|
||||
(position::T::fixed,
|
||||
z_index::T::Auto,
|
||||
overflow_x::T::visible,
|
||||
overflow_x::T::visible) => false,
|
||||
(position::T::absolute, _, _, _) |
|
||||
(position::T::fixed, _, _, _) => true,
|
||||
(position::T::relative, _, _, _) |
|
||||
(position::T::static_, _, _, _) => {
|
||||
// FIXME(pcwalton): `position: relative` establishes a new stacking context if
|
||||
// `z-index` is not `auto`. But this matches what we did before.
|
||||
false
|
||||
|
|
Загрузка…
Ссылка в новой задаче