servo: Merge #1808 - Send in the right container block size for relative positioning (from pradeep90:relative-position-container-block-size); r=pcwalton

This fixes #1757.

Source-Repo: https://github.com/servo/servo
Source-Revision: af616dba58cbf589b116b9e3cde4429df43e72cd
This commit is contained in:
S Pradeep Kumar 2014-03-11 21:28:40 -04:00
Родитель 4c7b3dcb01
Коммит da1cf9ab43
2 изменённых файлов: 11 добавлений и 3 удалений

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

@ -1279,6 +1279,7 @@ impl Box {
}
/// TODO: What exactly does this function return? Why is it Au(0) for GenericBox?
pub fn content_width(&self) -> Au {
match self.specific {
GenericBox | IframeBox(_) => Au(0),
@ -1312,6 +1313,13 @@ impl Box {
}
}
/// Return the size of the content box.
pub fn content_box_size(&self) -> Size2D<Au> {
let border_box_size = self.border_box.get().size;
Size2D(border_box_size.width - self.noncontent_width(),
border_box_size.height - self.noncontent_height())
}
/// Split box which includes new-line character
pub fn split_by_new_line(&self) -> SplitBoxResult {
match self.specific {

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

@ -957,9 +957,9 @@ impl<'a> MutableFlowUtils for &'a mut Flow {
// TODO(pradeep): Move this into a generated CB function and stuff in Flow.
match block.box_ {
Some(ref box_) => {
// FIXME: This should be the size of the content box (which is the
// Containing Block formed by a BlockFlow), not the border box.
container_block_size = box_.border_box.get().size;
// The Containing Block formed by a Block for relatively
// positioned descendants is the content box.
container_block_size = box_.content_box_size();
abs_cb_position = if block.is_positioned() {
block.base.abs_position + block.generated_cb_position()