diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/main/layout/box_.rs | 8 | ||||
-rw-r--r-- | src/components/main/layout/flow.rs | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/components/main/layout/box_.rs b/src/components/main/layout/box_.rs index 4f4a85b14fe..732bca8a819 100644 --- a/src/components/main/layout/box_.rs +++ b/src/components/main/layout/box_.rs @@ -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 { diff --git a/src/components/main/layout/flow.rs b/src/components/main/layout/flow.rs index d8abda6d7e8..512c61746bd 100644 --- a/src/components/main/layout/flow.rs +++ b/src/components/main/layout/flow.rs @@ -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() |