From 3ec2b4f486f2bc3a190c68772c43129c1a9bd6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 10 May 2017 12:57:00 +0200 Subject: [PATCH] style: Adjust text-align properly for -moz- values in tables. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes bug 1363576. Signed-off-by: Emilio Cobos Álvarez --- components/style/properties/gecko.mako.rs | 1 - components/style/style_adjuster.rs | 24 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 4995e9abfceb..3f741666a89e 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3385,7 +3385,6 @@ fn static_assert() { <% text_align_keyword = Keyword("text-align", "start end left right center justify -moz-center -moz-left -moz-right char", gecko_strip_moz_prefix=False) %> - <% text_align_reachable_keyword = Keyword("text-align", "start end left right center justify char") %> ${impl_keyword('text_align', 'mTextAlign', text_align_keyword, need_clone=False)} ${impl_keyword_clone('text_align', 'mTextAlign', text_align_keyword)} diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index b8a71b223d7c..78d44c8007e0 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -259,6 +259,29 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { } } + /// -moz-center, -moz-left and -moz-right are used for HTML's alignment. + /// + /// This is covering the
...
case. + /// + /// In this case, we don't want to inherit the text alignment into the + /// table. + #[cfg(feature = "gecko")] + fn adjust_for_table_text_align(&mut self) { + use properties::longhands::text_align::computed_value::T as text_align; + if self.style.get_box().clone_display() != display::table { + return; + } + + match self.style.get_inheritedtext().clone_text_align() { + text_align::_moz_left | + text_align::_moz_center | + text_align::_moz_right => {} + _ => return, + } + + self.style.mutate_inheritedtext().set_text_align(text_align::start); + } + /// Adjusts the style to account for various fixups that don't fit naturally /// into the cascade. /// @@ -274,6 +297,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { self.adjust_for_overflow(); #[cfg(feature = "gecko")] { + self.adjust_for_table_text_align(); self.adjust_for_contain(); } #[cfg(feature = "servo")]