mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
Qualify libstyle enums.
This commit is contained in:
parent
9068e62f2a
commit
d759b07299
5 changed files with 38 additions and 38 deletions
|
@ -41,7 +41,7 @@ use std::fmt;
|
||||||
use std::slice::Items;
|
use std::slice::Items;
|
||||||
use style::ComputedValues;
|
use style::ComputedValues;
|
||||||
use style::computed_values::border_style;
|
use style::computed_values::border_style;
|
||||||
use style::computed_values::cursor::{AutoCursor, SpecifiedCursor};
|
use style::computed_values::cursor;
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
|
|
||||||
// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
|
// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
|
||||||
|
@ -629,8 +629,8 @@ impl DisplayItemMetadata {
|
||||||
DisplayItemMetadata {
|
DisplayItemMetadata {
|
||||||
node: node,
|
node: node,
|
||||||
cursor: match style.get_pointing().cursor {
|
cursor: match style.get_pointing().cursor {
|
||||||
AutoCursor => default_cursor,
|
cursor::T::AutoCursor => default_cursor,
|
||||||
SpecifiedCursor(cursor) => cursor,
|
cursor::T::SpecifiedCursor(cursor) => cursor,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,8 +194,8 @@ impl Font {
|
||||||
|
|
||||||
pub fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
pub fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
||||||
let codepoint = match self.variant {
|
let codepoint = match self.variant {
|
||||||
font_variant::small_caps => codepoint.to_uppercase(),
|
font_variant::T::small_caps => codepoint.to_uppercase(),
|
||||||
font_variant::normal => codepoint,
|
font_variant::T::normal => codepoint,
|
||||||
};
|
};
|
||||||
self.handle.glyph_index(codepoint)
|
self.handle.glyph_index(codepoint)
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,8 @@ impl FontContext {
|
||||||
// painting. We should also support true small-caps (where the
|
// painting. We should also support true small-caps (where the
|
||||||
// font supports it) in the future.
|
// font supports it) in the future.
|
||||||
let actual_pt_size = match variant {
|
let actual_pt_size = match variant {
|
||||||
font_variant::small_caps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR),
|
font_variant::T::small_caps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR),
|
||||||
font_variant::normal => pt_size,
|
font_variant::T::normal => pt_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
let handle: FontHandle = FontHandleMethods::new_from_template(&self.platform_handle,
|
let handle: FontHandle = FontHandleMethods::new_from_template(&self.platform_handle,
|
||||||
|
@ -139,7 +139,7 @@ impl FontContext {
|
||||||
// so they will never be released. Find out a good time to drop them.
|
// so they will never be released. Find out a good time to drop them.
|
||||||
|
|
||||||
let desc = FontTemplateDescriptor::new(style.font_weight,
|
let desc = FontTemplateDescriptor::new(style.font_weight,
|
||||||
style.font_style == font_style::italic);
|
style.font_style == font_style::T::italic);
|
||||||
let mut fonts = SmallVec8::new();
|
let mut fonts = SmallVec8::new();
|
||||||
|
|
||||||
for family in style.font_family.iter() {
|
for family in style.font_family.iter() {
|
||||||
|
|
|
@ -176,8 +176,8 @@ impl<'a> PaintContext<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
match style_select {
|
match style_select {
|
||||||
border_style::none | border_style::hidden => {}
|
border_style::T::none | border_style::T::hidden => {}
|
||||||
border_style::dotted => {
|
border_style::T::dotted => {
|
||||||
// FIXME(sammykim): This doesn't work well with dash_pattern and cap_style.
|
// FIXME(sammykim): This doesn't work well with dash_pattern and cap_style.
|
||||||
self.draw_dashed_border_segment(direction,
|
self.draw_dashed_border_segment(direction,
|
||||||
bounds,
|
bounds,
|
||||||
|
@ -185,20 +185,20 @@ impl<'a> PaintContext<'a> {
|
||||||
color_select,
|
color_select,
|
||||||
DashSize::DottedBorder);
|
DashSize::DottedBorder);
|
||||||
}
|
}
|
||||||
border_style::dashed => {
|
border_style::T::dashed => {
|
||||||
self.draw_dashed_border_segment(direction,
|
self.draw_dashed_border_segment(direction,
|
||||||
bounds,
|
bounds,
|
||||||
border,
|
border,
|
||||||
color_select,
|
color_select,
|
||||||
DashSize::DashedBorder);
|
DashSize::DashedBorder);
|
||||||
}
|
}
|
||||||
border_style::solid => {
|
border_style::T::solid => {
|
||||||
self.draw_solid_border_segment(direction, bounds, border, radius, color_select);
|
self.draw_solid_border_segment(direction, bounds, border, radius, color_select);
|
||||||
}
|
}
|
||||||
border_style::double => {
|
border_style::T::double => {
|
||||||
self.draw_double_border_segment(direction, bounds, border, radius, color_select);
|
self.draw_double_border_segment(direction, bounds, border, radius, color_select);
|
||||||
}
|
}
|
||||||
border_style::groove | border_style::ridge => {
|
border_style::T::groove | border_style::T::ridge => {
|
||||||
self.draw_groove_ridge_border_segment(direction,
|
self.draw_groove_ridge_border_segment(direction,
|
||||||
bounds,
|
bounds,
|
||||||
border,
|
border,
|
||||||
|
@ -206,7 +206,7 @@ impl<'a> PaintContext<'a> {
|
||||||
color_select,
|
color_select,
|
||||||
style_select);
|
style_select);
|
||||||
}
|
}
|
||||||
border_style::inset | border_style::outset => {
|
border_style::T::inset | border_style::T::outset => {
|
||||||
self.draw_inset_outset_border_segment(direction,
|
self.draw_inset_outset_border_segment(direction,
|
||||||
bounds,
|
bounds,
|
||||||
border,
|
border,
|
||||||
|
@ -224,28 +224,28 @@ impl<'a> PaintContext<'a> {
|
||||||
style: border_style::T) {
|
style: border_style::T) {
|
||||||
let border = SideOffsets2D::new_all_same(bounds.size.width).to_float_px();
|
let border = SideOffsets2D::new_all_same(bounds.size.width).to_float_px();
|
||||||
match style {
|
match style {
|
||||||
border_style::none | border_style::hidden => {}
|
border_style::T::none | border_style::T::hidden => {}
|
||||||
border_style::dotted => {
|
border_style::T::dotted => {
|
||||||
self.draw_dashed_border_segment(Direction::Right,
|
self.draw_dashed_border_segment(Direction::Right,
|
||||||
bounds,
|
bounds,
|
||||||
&border,
|
&border,
|
||||||
color,
|
color,
|
||||||
DashSize::DottedBorder);
|
DashSize::DottedBorder);
|
||||||
}
|
}
|
||||||
border_style::dashed => {
|
border_style::T::dashed => {
|
||||||
self.draw_dashed_border_segment(Direction::Right,
|
self.draw_dashed_border_segment(Direction::Right,
|
||||||
bounds,
|
bounds,
|
||||||
&border,
|
&border,
|
||||||
color,
|
color,
|
||||||
DashSize::DashedBorder);
|
DashSize::DashedBorder);
|
||||||
}
|
}
|
||||||
border_style::solid => {
|
border_style::T::solid => {
|
||||||
self.draw_solid_border_segment(Direction::Right, bounds, &border, radius, color)
|
self.draw_solid_border_segment(Direction::Right, bounds, &border, radius, color)
|
||||||
}
|
}
|
||||||
border_style::double => {
|
border_style::T::double => {
|
||||||
self.draw_double_border_segment(Direction::Right, bounds, &border, radius, color)
|
self.draw_double_border_segment(Direction::Right, bounds, &border, radius, color)
|
||||||
}
|
}
|
||||||
border_style::groove | border_style::ridge => {
|
border_style::T::groove | border_style::T::ridge => {
|
||||||
self.draw_groove_ridge_border_segment(Direction::Right,
|
self.draw_groove_ridge_border_segment(Direction::Right,
|
||||||
bounds,
|
bounds,
|
||||||
&border,
|
&border,
|
||||||
|
@ -253,7 +253,7 @@ impl<'a> PaintContext<'a> {
|
||||||
color,
|
color,
|
||||||
style);
|
style);
|
||||||
}
|
}
|
||||||
border_style::inset | border_style::outset => {
|
border_style::T::inset | border_style::T::outset => {
|
||||||
self.draw_inset_outset_border_segment(Direction::Right,
|
self.draw_inset_outset_border_segment(Direction::Right,
|
||||||
bounds,
|
bounds,
|
||||||
&border,
|
&border,
|
||||||
|
@ -719,9 +719,9 @@ impl<'a> PaintContext<'a> {
|
||||||
0.5 * border.bottom,
|
0.5 * border.bottom,
|
||||||
0.5 * border.left);
|
0.5 * border.left);
|
||||||
let is_groove = match style {
|
let is_groove = match style {
|
||||||
border_style::groove => true,
|
border_style::T::groove => true,
|
||||||
border_style::ridge => false,
|
border_style::T::ridge => false,
|
||||||
_ => panic!("invalid border style")
|
_ => panic!("invalid border style")
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut lighter_color;
|
let mut lighter_color;
|
||||||
|
@ -762,9 +762,9 @@ impl<'a> PaintContext<'a> {
|
||||||
color: Color,
|
color: Color,
|
||||||
style: border_style::T) {
|
style: border_style::T) {
|
||||||
let is_inset = match style {
|
let is_inset = match style {
|
||||||
border_style::inset => true,
|
border_style::T::inset => true,
|
||||||
border_style::outset => false,
|
border_style::T::outset => false,
|
||||||
_ => panic!("invalid border style")
|
_ => panic!("invalid border style")
|
||||||
};
|
};
|
||||||
// original bounds as a Rect<f32>
|
// original bounds as a Rect<f32>
|
||||||
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
unsafe { (*self.face).style_flags & FT_STYLE_FLAG_ITALIC != 0 }
|
unsafe { (*self.face).style_flags & FT_STYLE_FLAG_ITALIC != 0 }
|
||||||
}
|
}
|
||||||
fn boldness(&self) -> font_weight::T {
|
fn boldness(&self) -> font_weight::T {
|
||||||
let default_weight = font_weight::Weight400;
|
let default_weight = font_weight::T::Weight400;
|
||||||
if unsafe { (*self.face).style_flags & FT_STYLE_FLAG_BOLD == 0 } {
|
if unsafe { (*self.face).style_flags & FT_STYLE_FLAG_BOLD == 0 } {
|
||||||
default_weight
|
default_weight
|
||||||
} else {
|
} else {
|
||||||
|
@ -140,15 +140,15 @@ impl FontHandleMethods for FontHandle {
|
||||||
if valid {
|
if valid {
|
||||||
let weight =(*os2).usWeightClass;
|
let weight =(*os2).usWeightClass;
|
||||||
match weight {
|
match weight {
|
||||||
1 | 100...199 => font_weight::Weight100,
|
1 | 100...199 => font_weight::T::Weight100,
|
||||||
2 | 200...299 => font_weight::Weight200,
|
2 | 200...299 => font_weight::T::Weight200,
|
||||||
3 | 300...399 => font_weight::Weight300,
|
3 | 300...399 => font_weight::T::Weight300,
|
||||||
4 | 400...499 => font_weight::Weight400,
|
4 | 400...499 => font_weight::T::Weight400,
|
||||||
5 | 500...599 => font_weight::Weight500,
|
5 | 500...599 => font_weight::T::Weight500,
|
||||||
6 | 600...699 => font_weight::Weight600,
|
6 | 600...699 => font_weight::T::Weight600,
|
||||||
7 | 700...799 => font_weight::Weight700,
|
7 | 700...799 => font_weight::T::Weight700,
|
||||||
8 | 800...899 => font_weight::Weight800,
|
8 | 800...899 => font_weight::T::Weight800,
|
||||||
9 | 900...999 => font_weight::Weight900,
|
9 | 900...999 => font_weight::T::Weight900,
|
||||||
_ => default_weight
|
_ => default_weight
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue