Skip to content

Commit

Permalink
Update app_units to 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed May 20, 2017
1 parent f054911 commit 2230332
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 40 deletions.
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/geometry/Cargo.toml
Expand Up @@ -14,6 +14,6 @@ path = "lib.rs"
servo = ["euclid/unstable"]

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
euclid = "0.11"
heapsize = "0.3.0"
4 changes: 2 additions & 2 deletions components/geometry/lib.rs
Expand Up @@ -6,7 +6,7 @@ extern crate app_units;
extern crate euclid;
#[macro_use] extern crate heapsize;

use app_units::{Au, MAX_AU};
use app_units::{Au, MAX_AU, MIN_AU};
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
Expand Down Expand Up @@ -38,7 +38,7 @@ known_heap_size!(0, DeviceIndependentPixel);

#[inline(always)]
pub fn max_rect() -> Rect<Au> {
Rect::new(Point2D::new(Au(i32::MIN / 2), Au(i32::MIN / 2)), Size2D::new(MAX_AU, MAX_AU))
Rect::new(Point2D::new(MIN_AU / 2, MIN_AU / 2), Size2D::new(MAX_AU, MAX_AU))
}

/// A helper function to convert a rect of `f32` pixels to a rect of app units.
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/Cargo.toml
Expand Up @@ -11,7 +11,7 @@ name = "gfx"
path = "lib.rs"

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
bitflags = "0.7"
euclid = "0.11"
fnv = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions components/gfx/text/glyph.rs
Expand Up @@ -110,7 +110,7 @@ pub type DetailedGlyphCount = u16;
impl GlyphEntry {
#[inline(always)]
fn advance(&self) -> Au {
Au(((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) as i32)
Au::new(((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) as i32)
}

#[inline]
Expand Down Expand Up @@ -629,7 +629,7 @@ impl<'a> GlyphStore {
leftover_spaces += 1;
}
}
Au(advance) + leftover_advance + extra_word_spacing * (spaces + leftover_spaces)
Au::new(advance) + leftover_advance + extra_word_spacing * (spaces + leftover_spaces)
}

/// When SIMD isn't available, fallback to the slow path.
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/text/shaping/harfbuzz.rs
Expand Up @@ -404,7 +404,7 @@ impl Shaper {
if character == ' ' || character == '\u{a0}' {
// https://drafts.csswg.org/css-text-3/#word-spacing-property
let (length, percent) = options.word_spacing;
advance = (advance + length) + Au((advance.0 as f32 * percent.into_inner()) as i32);
advance = (advance + length) + Au::new((advance.0 as f32 * percent.into_inner()) as i32);
}

advance
Expand Down
2 changes: 1 addition & 1 deletion components/layout/Cargo.toml
Expand Up @@ -10,7 +10,7 @@ name = "layout"
path = "lib.rs"

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
atomic_refcell = "0.1"
bitflags = "0.7"
canvas_traits = {path = "../canvas_traits"}
Expand Down
13 changes: 6 additions & 7 deletions components/layout/floats.rs
Expand Up @@ -2,13 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use app_units::Au;
use app_units::{Au, MAX_AU};
use block::FormattingContextType;
use flow::{self, CLEARS_LEFT, CLEARS_RIGHT, Flow, ImmutableFlowUtils};
use persistent_list::PersistentList;
use std::cmp::{max, min};
use std::fmt;
use std::i32;
use style::computed_values::float;
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
use style::values::computed::LengthOrPercentageOrAuto;
Expand Down Expand Up @@ -319,15 +318,15 @@ impl Floats {
Au(0),
info.ceiling,
info.max_inline_size,
Au(i32::MAX))
MAX_AU)
}
FloatKind::Right => {
return LogicalRect::new(
self.writing_mode,
info.max_inline_size - info.size.inline,
info.ceiling,
info.max_inline_size,
Au(i32::MAX))
MAX_AU)
}
}
}
Expand All @@ -352,15 +351,15 @@ impl Floats {
Au(0),
float_b,
info.max_inline_size,
Au(i32::MAX))
MAX_AU)
}
FloatKind::Right => {
LogicalRect::new(
self.writing_mode,
info.max_inline_size - info.size.inline,
float_b,
info.max_inline_size,
Au(i32::MAX))
MAX_AU)
}
}
}
Expand All @@ -373,7 +372,7 @@ impl Floats {
let block_size = self.max_block_size_for_bounds(rect.start.i,
rect.start.b,
rect.size.inline);
let block_size = block_size.unwrap_or(Au(i32::MAX));
let block_size = block_size.unwrap_or(MAX_AU);
return match info.kind {
FloatKind::Left => {
LogicalRect::new(
Expand Down
8 changes: 4 additions & 4 deletions components/layout/fragment.rs
Expand Up @@ -1058,7 +1058,7 @@ impl Fragment {
// Note: We can not precompute the ratio and store it as a float, because
// doing so may result one pixel difference in calculation for certain
// images, thus make some tests fail.
Au((inline_size.0 as i64 * intrinsic_block_size.0 as i64 /
Au::new((inline_size.0 as i64 * intrinsic_block_size.0 as i64 /
intrinsic_inline_size.0 as i64) as i32)
} else {
intrinsic_block_size
Expand All @@ -1068,7 +1068,7 @@ impl Fragment {
(MaybeAuto::Auto, MaybeAuto::Specified(block_size)) => {
let block_size = block_constraint.clamp(block_size);
let inline_size = if self.has_intrinsic_ratio() {
Au((block_size.0 as i64 * intrinsic_inline_size.0 as i64 /
Au::new((block_size.0 as i64 * intrinsic_inline_size.0 as i64 /
intrinsic_block_size.0 as i64) as i32)
} else {
intrinsic_inline_size
Expand All @@ -1084,10 +1084,10 @@ impl Fragment {
// First, create two rectangles that keep aspect ratio while may be clamped
// by the contraints;
let first_isize = inline_constraint.clamp(intrinsic_inline_size);
let first_bsize = Au((first_isize.0 as i64 * intrinsic_block_size.0 as i64 /
let first_bsize = Au::new((first_isize.0 as i64 * intrinsic_block_size.0 as i64 /
intrinsic_inline_size.0 as i64) as i32);
let second_bsize = block_constraint.clamp(intrinsic_block_size);
let second_isize = Au((second_bsize.0 as i64 * intrinsic_inline_size.0 as i64 /
let second_isize = Au::new((second_bsize.0 as i64 * intrinsic_inline_size.0 as i64 /
intrinsic_block_size.0 as i64) as i32);
let (inline_size, block_size) = match (first_isize.cmp(&intrinsic_inline_size) ,
second_isize.cmp(&intrinsic_inline_size)) {
Expand Down
4 changes: 2 additions & 2 deletions components/layout/inline.rs
Expand Up @@ -5,7 +5,7 @@
#![deny(unsafe_code)]

use StyleArc;
use app_units::Au;
use app_units::{Au, MIN_AU};
use block::AbsoluteAssignBSizesTraversal;
use context::LayoutContext;
use display_list_builder::{DisplayListBuildState, InlineFlowDisplayListBuilding};
Expand Down Expand Up @@ -1113,7 +1113,7 @@ impl InlineFlow {
let line_height = text::line_height_from_style(style, &font_metrics);
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);

let mut line_metrics = LineMetrics::new(Au(0), Au(i32::MIN));
let mut line_metrics = LineMetrics::new(Au(0), MIN_AU);
let mut largest_block_size_for_top_fragments = Au(0);
let mut largest_block_size_for_bottom_fragments = Au(0);

Expand Down
2 changes: 1 addition & 1 deletion components/layout_thread/Cargo.toml
Expand Up @@ -10,7 +10,7 @@ name = "layout_thread"
path = "lib.rs"

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
euclid = "0.11"
fnv = "1.0"
gfx = {path = "../gfx"}
Expand Down
2 changes: 1 addition & 1 deletion components/script/Cargo.toml
Expand Up @@ -25,7 +25,7 @@ tinyfiledialogs = "2.5.9"

[dependencies]
angle = {git = "https://github.com/servo/angle", branch = "servo"}
app_units = "0.4"
app_units = "0.4.1"
audio-video-metadata = "0.1.2"
atomic_refcell = "0.1"
base64 = "0.4.2"
Expand Down
2 changes: 1 addition & 1 deletion components/script_layout_interface/Cargo.toml
Expand Up @@ -10,7 +10,7 @@ name = "script_layout_interface"
path = "lib.rs"

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
atomic_refcell = "0.1"
canvas_traits = {path = "../canvas_traits"}
cssparser = "0.13.3"
Expand Down
2 changes: 1 addition & 1 deletion components/style/Cargo.toml
Expand Up @@ -30,7 +30,7 @@ testing = []
gecko_debug = ["nsstring_vendor/gecko_debug"]

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
arrayvec = "0.3.20"
atomic_refcell = "0.1"
bitflags = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion components/style_traits/Cargo.toml
Expand Up @@ -15,7 +15,7 @@ servo = ["heapsize", "heapsize_derive", "serde", "serde_derive",
gecko = []

[dependencies]
app_units = "0.4"
app_units = "0.4.1"
cssparser = "0.13.3"
euclid = "0.11"
heapsize = {version = "0.3.0", optional = true}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/style/Cargo.toml
Expand Up @@ -14,7 +14,7 @@ testing = ["style/testing"]

[dependencies]
byteorder = "1.0"
app_units = "0.4"
app_units = "0.4.1"
cssparser = "0.13.3"
euclid = "0.11"
html5ever = "0.16"
Expand Down

0 comments on commit 2230332

Please sign in to comment.