From 8db0fcaa2945d178b4434732b0e20fff2653a2df Mon Sep 17 00:00:00 2001 From: Benjamin Dahse Date: Fri, 17 Mar 2017 21:41:42 +0100 Subject: [PATCH] Make writing-mode affect computed display If a box has a different writing-mode than its containing block, and has a specified display of inline, change the computed display to inline-block. Also adds the second manual testcase from #15754 as a WPT to assert that the computed display does in fact change. --- .../style/properties/properties.mako.rs | 15 ++++++++++++++ tests/wpt/mozilla/meta/MANIFEST.json | 10 ++++++++++ .../css/writing-mode_change_display.html.ini | 1 + .../css/writing-mode_change_display.html | 20 +++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 tests/wpt/mozilla/meta/css/writing-mode_change_display.html.ini create mode 100644 tests/wpt/mozilla/tests/css/writing-mode_change_display.html diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 5dca7bee0cc..d91f5c3daca 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2114,6 +2114,21 @@ pub fn apply_declarations<'a, F, I>(device: &Device, } } + { + use computed_values::display::T as display; + // CSS writing modes spec (https://drafts.csswg.org/css-writing-modes-3/#block-flow): + // + // If a box has a different writing-mode value than its containing block: + // - If the box has a specified display of inline, its display computes to inline-block. [CSS21] + // + // www-style mail regarding above spec: https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html + // See https://github.com/servo/servo/issues/15754 + if context.layout_parent_style.writing_mode != style.writing_mode && + style.get_box().clone_display() == display::inline { + style.mutate_box().set_display(display::inline_block); + } + } + { use computed_values::overflow_x::T as overflow; use computed_values::overflow_y; diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 5d7438c4e04..09e903d7a0b 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -11142,6 +11142,12 @@ {} ] ], + "css/writing-mode_change_display.html": [ + [ + "/_mozilla/css/writing-mode_change_display.html", + {} + ] + ], "mozilla/DOMParser.html": [ [ "/_mozilla/mozilla/DOMParser.html", @@ -24145,6 +24151,10 @@ "b16bf3e07cb3c45f7d630ca35bae1012d38d1b6b", "support" ], + "css/writing-mode_change_display.html": [ + "9ac1f9756a4cd44196242beb80621b9bc8cbe2ff", + "testharness" + ], "mozilla/2x2.png": [ "c67d3f646e86413722833d2308a9bfc793a916bf", "support" diff --git a/tests/wpt/mozilla/meta/css/writing-mode_change_display.html.ini b/tests/wpt/mozilla/meta/css/writing-mode_change_display.html.ini new file mode 100644 index 00000000000..27bb09770e7 --- /dev/null +++ b/tests/wpt/mozilla/meta/css/writing-mode_change_display.html.ini @@ -0,0 +1 @@ +prefs: [layout.writing-mode.enabled:true] diff --git a/tests/wpt/mozilla/tests/css/writing-mode_change_display.html b/tests/wpt/mozilla/tests/css/writing-mode_change_display.html new file mode 100644 index 00000000000..dd2b2cf3e56 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/writing-mode_change_display.html @@ -0,0 +1,20 @@ + + + + + writing-mode test + + + + +
+ Text +
+ + + +