diff options
-rw-r--r-- | components/layout/display_list/builder.rs | 21 | ||||
-rw-r--r-- | components/layout/fragment.rs | 1 | ||||
-rw-r--r-- | components/layout/multicol.rs | 6 | ||||
-rw-r--r-- | components/layout/text.rs | 21 |
4 files changed, 26 insertions, 23 deletions
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index d26cd6b9c32..73343c3a4f2 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -58,7 +58,7 @@ use style::properties::{style_structs, ComputedValues}; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::computed::effects::SimpleShadow; use style::values::computed::image::Image as ComputedImage; -use style::values::computed::Gradient; +use style::values::computed::{Gradient, LengthOrAuto}; use style::values::generics::background::BackgroundSize; use style::values::generics::image::{GradientKind, Image, PaintWorklet}; use style::values::specified::ui::CursorKind; @@ -2627,19 +2627,22 @@ impl BlockFlow { _ => return, } + fn extract_clip_component(p: &LengthOrAuto) -> Option<Au> { + match *p { + LengthOrAuto::Auto => None, + LengthOrAuto::LengthPercentage(ref length) => Some(Au::from(*length)), + } + } + let clip_origin = Point2D::new( stacking_relative_border_box.origin.x + - style_clip_rect.left.map(Au::from).unwrap_or(Au(0)), + extract_clip_component(&style_clip_rect.left).unwrap_or_default(), stacking_relative_border_box.origin.y + - style_clip_rect.top.map(Au::from).unwrap_or(Au(0)), + extract_clip_component(&style_clip_rect.top).unwrap_or_default(), ); - let right = style_clip_rect - .right - .map(Au::from) + let right = extract_clip_component(&style_clip_rect.right) .unwrap_or(stacking_relative_border_box.size.width); - let bottom = style_clip_rect - .bottom - .map(Au::from) + let bottom = extract_clip_component(&style_clip_rect.bottom) .unwrap_or(stacking_relative_border_box.size.height); let clip_size = Size2D::new(right - clip_origin.x, bottom - clip_origin.y); diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index d8183eae1c9..ff62cc79638 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -64,6 +64,7 @@ use style::values::computed::counters::ContentItem; use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, Size}; use style::values::generics::box_::{Perspective, VerticalAlign}; use style::values::generics::transform; +use style::Zero; use webrender_api::{self, LayoutTransform}; // From gfxFontConstants.h in Firefox. diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index ca92c200d40..f8ddfa8200c 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -19,7 +19,7 @@ use std::fmt; use std::sync::Arc; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; -use style::values::computed::{MaxSize, Size}; +use style::values::computed::length::{MaxSize, NonNegativeLengthOrAuto, Size}; use style::values::generics::column::ColumnCount; use style::values::Either; @@ -114,7 +114,9 @@ impl Flow for MulticolFlow { let column_style = style.get_column(); let mut column_count; - if let Either::First(column_width) = column_style.column_width { + if let NonNegativeLengthOrAuto::LengthPercentage(column_width) = + column_style.column_width + { let column_width = Au::from(column_width); column_count = max( 1, diff --git a/components/layout/text.rs b/components/layout/text.rs index aba5703a1c6..b26e531e670 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -14,7 +14,6 @@ use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::TextRun; use gfx::text::util::{self, CompressionMode}; -use ordered_float::NotNan; use range::Range; use servo_atoms::Atom; use std::borrow::ToOwned; @@ -196,11 +195,7 @@ impl TextRunScanner { }; text_transform = inherited_text_style.text_transform; letter_spacing = inherited_text_style.letter_spacing; - word_spacing = inherited_text_style - .word_spacing - .value() - .map(|lop| lop.to_hash_key()) - .unwrap_or((Au(0), NotNan::new(0.0).unwrap())); + word_spacing = inherited_text_style.word_spacing.to_hash_key(); text_rendering = inherited_text_style.text_rendering; word_break = inherited_text_style.word_break; } @@ -321,10 +316,8 @@ impl TextRunScanner { // example, `finally` with a wide `letter-spacing` renders as `f i n a l l y` and not // `fi n a l l y`. let mut flags = ShapingFlags::empty(); - if let Some(v) = letter_spacing.value() { - if v.px() != 0. { - flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG); - } + if letter_spacing.0.px() != 0. { + flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG); } if text_rendering == TextRendering::Optimizespeed { flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG); @@ -334,8 +327,12 @@ impl TextRunScanner { flags.insert(ShapingFlags::KEEP_ALL_FLAG); } let options = ShapingOptions { - letter_spacing: letter_spacing.value().cloned().map(Au::from), - word_spacing: word_spacing, + letter_spacing: if letter_spacing.0.px() == 0. { + None + } else { + Some(Au::from(letter_spacing.0)) + }, + word_spacing, script: Script::Common, flags: flags, }; |