diff --git a/components/layout/block.rs b/components/layout/block.rs index 7a668f81711..fa3a13c58e7 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1049,7 +1049,8 @@ impl BlockFlow { let float_offset = self.base.floats.last_float_pos().unwrap() .convert(self.base.floats.writing_mode, self.base.writing_mode, - container_size); + container_size) + .start; let margin_offset = LogicalPoint::new(self.base.writing_mode, Au(0), self.fragment.margin.block_start); diff --git a/components/layout/floats.rs b/components/layout/floats.rs index a3f06e80667..e3028a90f8c 100644 --- a/components/layout/floats.rs +++ b/components/layout/floats.rs @@ -4,7 +4,7 @@ use util::geometry::Au; use util::logical_geometry::WritingMode; -use util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize}; +use util::logical_geometry::{LogicalRect, LogicalSize}; use util::persistent_list::PersistentList; use std::cmp::{max, min}; use std::i32; @@ -146,10 +146,10 @@ impl Floats { } /// Returns the position of the last float in flow coordinates. - pub fn last_float_pos(&self) -> Option> { + pub fn last_float_pos(&self) -> Option> { match self.list.floats.front() { None => None, - Some(float) => Some(float.bounds.start + self.offset), + Some(float) => Some(float.bounds.translate_by_size(self.offset)), } } diff --git a/components/util/logical_geometry.rs b/components/util/logical_geometry.rs index 23ebaa85bab..8084e28b3c3 100644 --- a/components/util/logical_geometry.rs +++ b/components/util/logical_geometry.rs @@ -919,6 +919,13 @@ impl + Sub> LogicalRect { } } + pub fn translate_by_size(&self, offset: LogicalSize) -> LogicalRect { + LogicalRect { + start: self.start + offset, + ..*self + } + } + pub fn translate(&self, offset: &LogicalPoint) -> LogicalRect { LogicalRect { start: self.start + LogicalSize { diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 1cb8d976ea7..9a9e015e4fb 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -264,6 +264,7 @@ experimental != overconstrained_block.html overconstrained_block_ref.html == root_margin_collapse_a.html root_margin_collapse_b.html == root_pseudo_a.html root_pseudo_b.html experimental == rtl_body.html rtl_body_ref.html +experimental == rtl_float_a.html rtl_float_ref.html experimental == rtl_margin_a.html rtl_margin_ref.html experimental == rtl_simple.html rtl_simple_ref.html experimental == rtl_table_a.html rtl_table_ref.html diff --git a/tests/ref/rtl_float_a.html b/tests/ref/rtl_float_a.html new file mode 100644 index 00000000000..715594261e5 --- /dev/null +++ b/tests/ref/rtl_float_a.html @@ -0,0 +1,20 @@ + + + + + RTL float test + + + +
+ + + diff --git a/tests/ref/rtl_float_ref.html b/tests/ref/rtl_float_ref.html new file mode 100644 index 00000000000..3432a957d81 --- /dev/null +++ b/tests/ref/rtl_float_ref.html @@ -0,0 +1,19 @@ + + + + + RTL float reference + + + +
+ + +