From 7ca1137d25ec5ec80cb8e2138aabed52d36809b2 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sat, 8 Aug 2015 13:31:57 -0700 Subject: [PATCH] layout: Allow list items to be absolute containing blocks. Fixes overflowing highlight in the side menu on GitHub. --- components/layout/list_item.rs | 11 ++++++++++- tests/ref/basic.list | 1 + tests/ref/li_absolute_containing_block_a.html | 19 +++++++++++++++++++ .../ref/li_absolute_containing_block_ref.html | 19 +++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/ref/li_absolute_containing_block_a.html create mode 100644 tests/ref/li_absolute_containing_block_ref.html diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index abf2164837a..ef4a7dc91d7 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -24,7 +24,7 @@ use util::geometry::Au; use util::logical_geometry::LogicalSize; use util::opts; use style::properties::ComputedValues; -use style::computed_values::list_style_type; +use style::computed_values::{list_style_type, position}; use std::sync::Arc; /// A block with the CSS `display` property equal to `list-item`. @@ -130,6 +130,10 @@ impl Flow for ListItemFlow { self.block_flow.place_float_if_applicable(layout_context) } + fn is_absolute_containing_block(&self) -> bool { + self.block_flow.is_absolute_containing_block() + } + fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) { self.block_flow.update_late_computed_inline_position_if_necessary(inline_position) } @@ -157,6 +161,11 @@ impl Flow for ListItemFlow { self.block_flow.generated_containing_block_size(flow) } + /// The 'position' property of this flow. + fn positioning(&self) -> position::T { + self.block_flow.positioning() + } + fn iterate_through_fragment_border_boxes(&self, iterator: &mut FragmentBorderBoxIterator, level: i32, diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 448e5cb1379..ffaf75fa5ed 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -185,6 +185,7 @@ experimental == iframe/size_attributes_vertical_writing_mode.html iframe/size_at == legacy_td_width_attribute_a.html legacy_td_width_attribute_ref.html == legacy_th_width_attribute_a.html legacy_td_width_attribute_ref.html == letter_spacing_a.html letter_spacing_ref.html +== li_absolute_containing_block_a.html li_absolute_containing_block_ref.html == line_breaking_whitespace_collapse_a.html line_breaking_whitespace_collapse_ref.html == line_height_a.html line_height_ref.html == line_height_float_placement_a.html line_height_float_placement_ref.html diff --git a/tests/ref/li_absolute_containing_block_a.html b/tests/ref/li_absolute_containing_block_a.html new file mode 100644 index 00000000000..40765d4888e --- /dev/null +++ b/tests/ref/li_absolute_containing_block_a.html @@ -0,0 +1,19 @@ + + +
  • X
  • diff --git a/tests/ref/li_absolute_containing_block_ref.html b/tests/ref/li_absolute_containing_block_ref.html new file mode 100644 index 00000000000..47d4a4cb730 --- /dev/null +++ b/tests/ref/li_absolute_containing_block_ref.html @@ -0,0 +1,19 @@ + + +
    X