stylo: Set the NS_STYLE_IS_TEXT_COMBINED flag.

This should fix at least
layout/reftests/writing-mode/1135361-ruby-justify-1.html
This commit is contained in:
Emilio Cobos Álvarez 2017-07-21 17:59:54 +02:00
parent 9b276565f8
commit b576229567
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 11 additions and 0 deletions

View file

@ -28,5 +28,10 @@ bitflags! {
/// This bit is propagated to all children of line participants. /// This bit is propagated to all children of line participants.
/// It is currently used by ruby to make its content unbreakable. /// It is currently used by ruby to make its content unbreakable.
const SHOULD_SUPPRESS_LINEBREAK = 1 << 1, 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,
} }
} }

View file

@ -107,6 +107,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
fn adjust_for_text_combine_upright(&mut self) { fn adjust_for_text_combine_upright(&mut self) {
use computed_values::text_combine_upright::T as text_combine_upright; use computed_values::text_combine_upright::T as text_combine_upright;
use computed_values::writing_mode::T as writing_mode; use computed_values::writing_mode::T as writing_mode;
use properties::computed_value_flags::IS_TEXT_COMBINED;
let writing_mode = let writing_mode =
self.style.get_inheritedbox().clone_writing_mode(); self.style.get_inheritedbox().clone_writing_mode();
@ -115,6 +116,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
if writing_mode != writing_mode::horizontal_tb && if writing_mode != writing_mode::horizontal_tb &&
text_combine_upright == text_combine_upright::all { 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); self.style.mutate_inheritedbox().set_writing_mode(writing_mode::horizontal_tb);
} }
} }
@ -409,6 +411,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
self.style.reset_border_struct(); self.style.reset_border_struct();
self.style.reset_padding_struct(); self.style.reset_padding_struct();
} }
// Force bidi isolation on all internal ruby boxes and ruby container // Force bidi isolation on all internal ruby boxes and ruby container
// per spec https://drafts.csswg.org/css-ruby-1/#bidi // per spec https://drafts.csswg.org/css-ruby-1/#bidi
if self_display.is_ruby_type() { if self_display.is_ruby_type() {

View file

@ -1742,6 +1742,9 @@ pub extern "C" fn Servo_ComputedValues_GetStyleBits(values: ServoStyleContextBor
if flags.contains(SHOULD_SUPPRESS_LINEBREAK) { if flags.contains(SHOULD_SUPPRESS_LINEBREAK) {
result |= structs::NS_STYLE_SUPPRESS_LINEBREAK as u64; result |= structs::NS_STYLE_SUPPRESS_LINEBREAK as u64;
} }
if flags.contains(IS_TEXT_COMBINED) {
result |= structs::NS_STYLE_IS_TEXT_COMBINED as u64;
}
result result
} }