Introduce CSSPixelLength and update NonNegativeLength.

First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
This commit is contained in:
Boris Chiou 2017-09-13 14:26:51 +08:00
parent cad3aff508
commit a949e2a057
40 changed files with 502 additions and 406 deletions

View file

@ -533,6 +533,7 @@ pub trait MatchMethods : TElement {
mut new_styles: ElementStyles,
important_rules_changed: bool,
) -> ChildCascadeRequirement {
use app_units::Au;
use dom::TNode;
use std::cmp;
use std::mem;
@ -581,7 +582,7 @@ pub trait MatchMethods : TElement {
if old_styles.primary.as_ref().map_or(true, |s| s.get_font().clone_font_size() != new_font_size) {
debug_assert!(self.owner_doc_matches_for_testing(device));
device.set_root_font_size(new_font_size.0);
device.set_root_font_size(Au::from(new_font_size));
// If the root font-size changed since last time, and something
// in the document did use rem units, ensure we recascade the
// entire tree.