mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Fix servo build.
This commit is contained in:
parent
a65925cb85
commit
0c01325c05
4 changed files with 26 additions and 23 deletions
|
@ -58,7 +58,7 @@ use style::properties::{style_structs, ComputedValues};
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use style::values::computed::effects::SimpleShadow;
|
use style::values::computed::effects::SimpleShadow;
|
||||||
use style::values::computed::image::Image as ComputedImage;
|
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::background::BackgroundSize;
|
||||||
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
||||||
use style::values::specified::ui::CursorKind;
|
use style::values::specified::ui::CursorKind;
|
||||||
|
@ -2627,19 +2627,22 @@ impl BlockFlow {
|
||||||
_ => return,
|
_ => 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(
|
let clip_origin = Point2D::new(
|
||||||
stacking_relative_border_box.origin.x +
|
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 +
|
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
|
let right = extract_clip_component(&style_clip_rect.right)
|
||||||
.right
|
|
||||||
.map(Au::from)
|
|
||||||
.unwrap_or(stacking_relative_border_box.size.width);
|
.unwrap_or(stacking_relative_border_box.size.width);
|
||||||
let bottom = style_clip_rect
|
let bottom = extract_clip_component(&style_clip_rect.bottom)
|
||||||
.bottom
|
|
||||||
.map(Au::from)
|
|
||||||
.unwrap_or(stacking_relative_border_box.size.height);
|
.unwrap_or(stacking_relative_border_box.size.height);
|
||||||
let clip_size = Size2D::new(right - clip_origin.x, bottom - clip_origin.y);
|
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::computed::{LengthPercentage, LengthPercentageOrAuto, Size};
|
||||||
use style::values::generics::box_::{Perspective, VerticalAlign};
|
use style::values::generics::box_::{Perspective, VerticalAlign};
|
||||||
use style::values::generics::transform;
|
use style::values::generics::transform;
|
||||||
|
use style::Zero;
|
||||||
use webrender_api::{self, LayoutTransform};
|
use webrender_api::{self, LayoutTransform};
|
||||||
|
|
||||||
// From gfxFontConstants.h in Firefox.
|
// From gfxFontConstants.h in Firefox.
|
||||||
|
|
|
@ -19,7 +19,7 @@ use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
use style::properties::ComputedValues;
|
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::generics::column::ColumnCount;
|
||||||
use style::values::Either;
|
use style::values::Either;
|
||||||
|
|
||||||
|
@ -114,7 +114,9 @@ impl Flow for MulticolFlow {
|
||||||
|
|
||||||
let column_style = style.get_column();
|
let column_style = style.get_column();
|
||||||
let mut column_count;
|
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);
|
let column_width = Au::from(column_width);
|
||||||
column_count = max(
|
column_count = max(
|
||||||
1,
|
1,
|
||||||
|
|
|
@ -14,7 +14,6 @@ use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
|
||||||
use gfx::text::glyph::ByteIndex;
|
use gfx::text::glyph::ByteIndex;
|
||||||
use gfx::text::text_run::TextRun;
|
use gfx::text::text_run::TextRun;
|
||||||
use gfx::text::util::{self, CompressionMode};
|
use gfx::text::util::{self, CompressionMode};
|
||||||
use ordered_float::NotNan;
|
|
||||||
use range::Range;
|
use range::Range;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
@ -196,11 +195,7 @@ impl TextRunScanner {
|
||||||
};
|
};
|
||||||
text_transform = inherited_text_style.text_transform;
|
text_transform = inherited_text_style.text_transform;
|
||||||
letter_spacing = inherited_text_style.letter_spacing;
|
letter_spacing = inherited_text_style.letter_spacing;
|
||||||
word_spacing = inherited_text_style
|
word_spacing = inherited_text_style.word_spacing.to_hash_key();
|
||||||
.word_spacing
|
|
||||||
.value()
|
|
||||||
.map(|lop| lop.to_hash_key())
|
|
||||||
.unwrap_or((Au(0), NotNan::new(0.0).unwrap()));
|
|
||||||
text_rendering = inherited_text_style.text_rendering;
|
text_rendering = inherited_text_style.text_rendering;
|
||||||
word_break = inherited_text_style.word_break;
|
word_break = inherited_text_style.word_break;
|
||||||
}
|
}
|
||||||
|
@ -321,11 +316,9 @@ impl TextRunScanner {
|
||||||
// example, `finally` with a wide `letter-spacing` renders as `f i n a l l y` and not
|
// example, `finally` with a wide `letter-spacing` renders as `f i n a l l y` and not
|
||||||
// `fi n a l l y`.
|
// `fi n a l l y`.
|
||||||
let mut flags = ShapingFlags::empty();
|
let mut flags = ShapingFlags::empty();
|
||||||
if let Some(v) = letter_spacing.value() {
|
if letter_spacing.0.px() != 0. {
|
||||||
if v.px() != 0. {
|
|
||||||
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if text_rendering == TextRendering::Optimizespeed {
|
if text_rendering == TextRendering::Optimizespeed {
|
||||||
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
||||||
flags.insert(ShapingFlags::DISABLE_KERNING_SHAPING_FLAG)
|
flags.insert(ShapingFlags::DISABLE_KERNING_SHAPING_FLAG)
|
||||||
|
@ -334,8 +327,12 @@ impl TextRunScanner {
|
||||||
flags.insert(ShapingFlags::KEEP_ALL_FLAG);
|
flags.insert(ShapingFlags::KEEP_ALL_FLAG);
|
||||||
}
|
}
|
||||||
let options = ShapingOptions {
|
let options = ShapingOptions {
|
||||||
letter_spacing: letter_spacing.value().cloned().map(Au::from),
|
letter_spacing: if letter_spacing.0.px() == 0. {
|
||||||
word_spacing: word_spacing,
|
None
|
||||||
|
} else {
|
||||||
|
Some(Au::from(letter_spacing.0))
|
||||||
|
},
|
||||||
|
word_spacing,
|
||||||
script: Script::Common,
|
script: Script::Common,
|
||||||
flags: flags,
|
flags: flags,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue