servo: Merge #13765 - layout: Make percentages in `top` and `bottom` for relative positions relative to height, not width (from pcwalton:relative-position-vertical-percentage); r=emilio

Improves etsy.com.

Closes #13760.

r? @mbrubeck

Source-Repo: https://github.com/servo/servo
Source-Revision: 759185abe05c31c2851d9ac586ddc2d065aa755f
This commit is contained in:
Patrick Walton 2016-10-14 23:47:24 -05:00
Родитель 11032cab67
Коммит 3dc4b5d94d
2 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -753,6 +753,17 @@ impl BlockFlow {
}
}
/// Writes in the size of the relative containing block for children. (This information
/// is also needed to handle RTL.)
fn propagate_early_absolute_position_info_to_children(&mut self) {
for kid in self.base.child_iter_mut() {
flow::mut_base(kid).early_absolute_position_info = EarlyAbsolutePositionInfo {
relative_containing_block_size: self.fragment.content_box().size,
relative_containing_block_mode: self.fragment.style().writing_mode,
}
}
}
/// Assign block-size for current flow.
///
/// * Collapse margins for flow's children and set in-flow child flows' block offsets now that
@ -1011,16 +1022,9 @@ impl BlockFlow {
self.fragment.border_box.size.block = block_size;
}
// Write in the size of the relative containing block for children. (This information
// is also needed to handle RTL.)
for kid in self.base.child_iter_mut() {
flow::mut_base(kid).early_absolute_position_info = EarlyAbsolutePositionInfo {
relative_containing_block_size: self.fragment.content_box().size,
relative_containing_block_mode: self.fragment.style().writing_mode,
};
}
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
self.propagate_early_absolute_position_info_to_children();
return None
}
@ -1050,10 +1054,9 @@ impl BlockFlow {
// position.
self.fragment.border_box.size.block = cur_b;
self.fragment.border_box.start.b = Au(0);
self.base.position.size.block = cur_b;
if !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
self.base.position.size.block = cur_b;
}
self.propagate_early_absolute_position_info_to_children();
// Translate the current set of floats back into the parent coordinate system in the
// inline direction, and store them in the flow so that flows that come later in the

Просмотреть файл

@ -1379,10 +1379,10 @@ impl Fragment {
};
let offset_b = if offsets.block_start != LengthOrPercentageOrAuto::Auto {
MaybeAuto::from_style(offsets.block_start,
container_size.inline).specified_or_zero()
container_size.block).specified_or_zero()
} else {
-MaybeAuto::from_style(offsets.block_end,
container_size.inline).specified_or_zero()
container_size.block).specified_or_zero()
};
LogicalSize::new(style.writing_mode, offset_i, offset_b)
}