mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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:
parent
cad3aff508
commit
a949e2a057
40 changed files with 502 additions and 406 deletions
|
@ -118,7 +118,7 @@ impl FontContext {
|
|||
|
||||
let layout_font_group_cache_key = LayoutFontGroupCacheKey {
|
||||
pointer: style.clone(),
|
||||
size: style.font_size.0,
|
||||
size: Au::from(style.font_size),
|
||||
};
|
||||
if let Some(ref cached_font_group) = self.layout_font_group_cache.get(
|
||||
&layout_font_group_cache_key) {
|
||||
|
@ -148,7 +148,7 @@ impl FontContext {
|
|||
Some(ref cached_font_ref) => {
|
||||
let cached_font = (*cached_font_ref).borrow();
|
||||
if cached_font.descriptor == desc &&
|
||||
cached_font.requested_pt_size == style.font_size.0 &&
|
||||
cached_font.requested_pt_size == Au::from(style.font_size) &&
|
||||
cached_font.variant == style.font_variant_caps {
|
||||
fonts.push((*cached_font_ref).clone());
|
||||
cache_hit = true;
|
||||
|
@ -166,7 +166,7 @@ impl FontContext {
|
|||
Some(template_info) => {
|
||||
let layout_font = self.create_layout_font(template_info.font_template,
|
||||
desc.clone(),
|
||||
style.font_size.0,
|
||||
Au::from(style.font_size),
|
||||
style.font_variant_caps,
|
||||
template_info.font_key);
|
||||
let font = match layout_font {
|
||||
|
@ -199,7 +199,7 @@ impl FontContext {
|
|||
for cached_font_entry in &self.fallback_font_cache {
|
||||
let cached_font = cached_font_entry.font.borrow();
|
||||
if cached_font.descriptor == desc &&
|
||||
cached_font.requested_pt_size == style.font_size.0 &&
|
||||
cached_font.requested_pt_size == Au::from(style.font_size) &&
|
||||
cached_font.variant == style.font_variant_caps {
|
||||
fonts.push(cached_font_entry.font.clone());
|
||||
cache_hit = true;
|
||||
|
@ -211,7 +211,7 @@ impl FontContext {
|
|||
let template_info = self.font_cache_thread.last_resort_font_template(desc.clone());
|
||||
let layout_font = self.create_layout_font(template_info.font_template,
|
||||
desc.clone(),
|
||||
style.font_size.0,
|
||||
Au::from(style.font_size),
|
||||
style.font_variant_caps,
|
||||
template_info.font_key);
|
||||
match layout_font {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue