diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 326a688e5df..804ce001eac 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -569,10 +569,11 @@ impl FragmentDisplayListBuilding for Fragment { // Outlines are not accounted for in the dimensions of the border box, so adjust the // absolute bounds. let mut bounds = *bounds; - bounds.origin.x = bounds.origin.x - width; - bounds.origin.y = bounds.origin.y - width; - bounds.size.width = bounds.size.width + width + width; - bounds.size.height = bounds.size.height + width + width; + let offset = width + style.get_outline().outline_offset; + bounds.origin.x = bounds.origin.x - offset; + bounds.origin.y = bounds.origin.y - offset; + bounds.size.width = bounds.size.width + offset + offset; + bounds.size.height = bounds.size.height + offset + offset; // Append the outline to the display list. let color = style.resolve_color(style.get_outline().outline_color).to_gfx_color(); diff --git a/components/style/properties/common_types.rs b/components/style/properties/common_types.rs index 723cf36a73f..84539d6d059 100644 --- a/components/style/properties/common_types.rs +++ b/components/style/properties/common_types.rs @@ -933,6 +933,14 @@ pub mod computed { } } } + + #[allow(non_snake_case)] + #[inline] + pub fn compute_Length(value: specified::Length, context: &Context) -> Au { + compute_Au(value, context) + } + + pub type Length = Au; } pub fn parse_url(input: &str, base_url: &Url) -> Url { diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako index c8e8c3c0c4a..3726152f026 100644 --- a/components/style/properties/mod.rs.mako +++ b/components/style/properties/mod.rs.mako @@ -381,6 +381,8 @@ pub mod longhands { } %self:longhand> + ${predefined_type("outline-offset", "Length", "Au(0)")} + ${new_style_struct("PositionOffsets", is_inherited=False)} % for side in ["top", "right", "bottom", "left"]: diff --git a/tests/ref/basic.list b/tests/ref/basic.list index fedf64bfb12..6c3faf2688c 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -225,3 +225,4 @@ fragment=top != ../html/acid2.html acid2_ref.html == stacking_context_overflow_a.html stacking_context_overflow_ref.html == stacking_context_overflow_relative_outline_a.html stacking_context_overflow_relative_outline_ref.html == word_break_a.html word_break_ref.html +== outline_offset_a.html outline_offset_ref.html diff --git a/tests/ref/outline_offset_a.html b/tests/ref/outline_offset_a.html new file mode 100644 index 00000000000..5ec0c1eb1a5 --- /dev/null +++ b/tests/ref/outline_offset_a.html @@ -0,0 +1,22 @@ + + +
+ + + + + + + diff --git a/tests/ref/outline_offset_ref.html b/tests/ref/outline_offset_ref.html new file mode 100644 index 00000000000..0540761c9bb --- /dev/null +++ b/tests/ref/outline_offset_ref.html @@ -0,0 +1,24 @@ + + + + + + +