servo: Merge #17819 - stylo: Set the NS_STYLE_IS_TEXT_COMBINED flag (from emilio:text-combined); r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 21 Jul 2017 17:30:05 -0700
changeset 419025 c95dcaacd9fd7b9b67682ce14cc2da8644b82e3b
parent 419024 8f0e9bc0c3a401f35a18bbabcfa59af7f5f6055e
child 419026 ffb8e24e573e86b119c7bd9531136089f52c3503
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs17819, 1135361
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17819 - stylo: Set the NS_STYLE_IS_TEXT_COMBINED flag (from emilio:text-combined); r=xidorn This should fix at least layout/reftests/writing-mode/1135361-ruby-justify-1.html Source-Repo: https://github.com/servo/servo Source-Revision: e4ac067a9b4db4f8bee7cf0eebaabd807dd8627b
servo/components/style/properties/computed_value_flags.rs
servo/components/style/style_adjuster.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/properties/computed_value_flags.rs
+++ b/servo/components/style/properties/computed_value_flags.rs
@@ -23,10 +23,15 @@ bitflags! {
         ///
         /// If this flag is set, the line should not be broken inside,
         /// which means inlines act as if nowrap is set, <br> element is
         /// suppressed, and blocks are inlinized.
         ///
         /// This bit is propagated to all children of line participants.
         /// It is currently used by ruby to make its content unbreakable.
         const SHOULD_SUPPRESS_LINEBREAK = 1 << 1,
+
+        /// A flag used to mark text that that has text-combine-upright.
+        ///
+        /// This is used from Gecko's layout engine.
+        const IS_TEXT_COMBINED = 1 << 2,
     }
 }
--- a/servo/components/style/style_adjuster.rs
+++ b/servo/components/style/style_adjuster.rs
@@ -102,24 +102,26 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
     /// properties, and text is just plain inheritance.
     ///
     /// TODO(emilio): we should (Gecko too) revise these adjustments in presence
     /// of display: contents.
     #[cfg(feature = "gecko")]
     fn adjust_for_text_combine_upright(&mut self) {
         use computed_values::text_combine_upright::T as text_combine_upright;
         use computed_values::writing_mode::T as writing_mode;
+        use properties::computed_value_flags::IS_TEXT_COMBINED;
 
         let writing_mode =
             self.style.get_inheritedbox().clone_writing_mode();
         let text_combine_upright =
             self.style.get_inheritedtext().clone_text_combine_upright();
 
         if writing_mode != writing_mode::horizontal_tb &&
            text_combine_upright == text_combine_upright::all {
+            self.style.flags.insert(IS_TEXT_COMBINED);
             self.style.mutate_inheritedbox().set_writing_mode(writing_mode::horizontal_tb);
         }
     }
 
     /// https://drafts.csswg.org/css-writing-modes-3/#block-flow:
     ///
     ///    If a box has a different writing-mode value than its containing
     ///    block:
@@ -404,16 +406,17 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
         // Suppress border and padding for ruby level containers.
         // This is actually not part of the spec. It is currently unspecified
         // how border and padding should be handled for ruby level container,
         // and suppressing them here make it easier for layout to handle.
         if self_display.is_ruby_level_container() {
             self.style.reset_border_struct();
             self.style.reset_padding_struct();
         }
+
         // Force bidi isolation on all internal ruby boxes and ruby container
         // per spec https://drafts.csswg.org/css-ruby-1/#bidi
         if self_display.is_ruby_type() {
             let new_value = match self.style.get_text().clone_unicode_bidi() {
                 unicode_bidi::normal | unicode_bidi::embed => Some(unicode_bidi::isolate),
                 unicode_bidi::bidi_override => Some(unicode_bidi::isolate_override),
                 _ => None,
             };
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -1737,16 +1737,19 @@ pub extern "C" fn Servo_ComputedValues_G
     let flags = values.flags;
     let mut result = 0;
     if flags.contains(HAS_TEXT_DECORATION_LINES) {
         result |= structs::NS_STYLE_HAS_TEXT_DECORATION_LINES as u64;
     }
     if flags.contains(SHOULD_SUPPRESS_LINEBREAK) {
         result |= structs::NS_STYLE_SUPPRESS_LINEBREAK as u64;
     }
+    if flags.contains(IS_TEXT_COMBINED) {
+        result |= structs::NS_STYLE_IS_TEXT_COMBINED as u64;
+    }
     result
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(values: ServoStyleContextBorrowed)
                                                                         -> bool {
     let b = values.get_box();
     b.specifies_animations() || b.specifies_transitions()