mirror of
https://github.com/servo/servo.git
synced 2025-07-25 16:20:36 +01:00
Auto merge of #18399 - Manishearth:stylo-fuzzfix, r=emilio
stylo: Overflow fixes r=emilio https://bugzilla.mozilla.org/show_bug.cgi?id=1397363 , https://bugzilla.mozilla.org/show_bug.cgi?id=1397439 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18399) <!-- Reviewable:end -->
This commit is contained in:
commit
812cac78f0
3 changed files with 6 additions and 10 deletions
|
@ -2341,7 +2341,7 @@ fn static_assert() {
|
||||||
pub fn calculate_script_level_size(&self, parent: &Self, device: &Device) -> (Au, Au) {
|
pub fn calculate_script_level_size(&self, parent: &Self, device: &Device) -> (Au, Au) {
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
let delta = self.gecko.mScriptLevel - parent.gecko.mScriptLevel;
|
let delta = self.gecko.mScriptLevel.saturating_sub(parent.gecko.mScriptLevel);
|
||||||
|
|
||||||
let parent_size = Au(parent.gecko.mSize);
|
let parent_size = Au(parent.gecko.mSize);
|
||||||
let parent_unconstrained_size = Au(parent.gecko.mScriptUnconstrainedSize);
|
let parent_unconstrained_size = Au(parent.gecko.mScriptUnconstrainedSize);
|
||||||
|
|
|
@ -162,7 +162,7 @@ where
|
||||||
impl Animate for Au {
|
impl Animate for Au {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
Ok(Au(self.0.animate(&other.0, procedure)?))
|
Ok(Au::new(self.0.animate(&other.0, procedure)?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//!
|
//!
|
||||||
//! [length]: https://drafts.csswg.org/css-values/#lengths
|
//! [length]: https://drafts.csswg.org/css-values/#lengths
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::{Au, MAX_AU, MIN_AU};
|
||||||
use cssparser::{Parser, Token, BasicParseError};
|
use cssparser::{Parser, Token, BasicParseError};
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use font_metrics::FontMetricsQueryResult;
|
use font_metrics::FontMetricsQueryResult;
|
||||||
|
@ -236,16 +236,12 @@ impl CharacterWidth {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as Gecko
|
|
||||||
const ABSOLUTE_LENGTH_MAX: i32 = (1 << 30);
|
|
||||||
const ABSOLUTE_LENGTH_MIN: i32 = - (1 << 30);
|
|
||||||
|
|
||||||
/// Helper to convert a floating point length to application units
|
/// Helper to convert a floating point length to application units
|
||||||
fn to_au_round(length: CSSFloat, au_per_unit: CSSFloat) -> Au {
|
fn to_au_round(length: CSSFloat, au_per_unit: CSSFloat) -> Au {
|
||||||
Au(
|
Au(
|
||||||
(length * au_per_unit)
|
((length * au_per_unit) as f64)
|
||||||
.min(ABSOLUTE_LENGTH_MAX as f32)
|
.min(MAX_AU.0 as f64)
|
||||||
.max(ABSOLUTE_LENGTH_MIN as f32)
|
.max(MIN_AU.0 as f64)
|
||||||
.round() as i32
|
.round() as i32
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue