Skip to content
Permalink
Browse files

layout: Fix servo build.

  • Loading branch information...
emilio committed Mar 12, 2019
1 parent a65925c commit 0c01325c0523d3b04a0512bdb2ebb10328c11a32
@@ -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);

@@ -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.
@@ -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,
@@ -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,
};

0 comments on commit 0c01325

Please sign in to comment.
You can’t perform that action at this time.