mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Upgrade Stylo to 2024-03-01 (#32089)
* Upgrade Stylo to 2024-03-01 * Fixup for https://bugzil.la/1882754 * Update test expectations
This commit is contained in:
parent
0678136b17
commit
f5bdfdfe94
33 changed files with 290 additions and 302 deletions
|
@ -20,6 +20,7 @@ bitflags = { workspace = true }
|
|||
byteorder = { workspace = true }
|
||||
canvas_traits = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
cssparser = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
font-kit = "0.11"
|
||||
fnv = { workspace = true }
|
||||
|
|
|
@ -21,7 +21,7 @@ use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
|
|||
use log::{debug, error, warn};
|
||||
use num_traits::ToPrimitive;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use style::values::computed::font;
|
||||
use style_traits::values::ToCss;
|
||||
|
@ -74,7 +74,7 @@ impl PathState {
|
|||
pub trait Backend {
|
||||
fn get_composition_op(&self, opts: &DrawOptions) -> CompositionOp;
|
||||
fn need_to_draw_shadow(&self, color: &Color) -> bool;
|
||||
fn set_shadow_color(&mut self, color: RgbaLegacy, state: &mut CanvasPaintState<'_>);
|
||||
fn set_shadow_color(&mut self, color: AbsoluteColor, state: &mut CanvasPaintState<'_>);
|
||||
fn set_fill_style(
|
||||
&mut self,
|
||||
style: FillOrStrokeStyle,
|
||||
|
@ -1155,7 +1155,7 @@ impl<'a> CanvasData<'a> {
|
|||
self.state.shadow_blur = value;
|
||||
}
|
||||
|
||||
pub fn set_shadow_color(&mut self, value: RgbaLegacy) {
|
||||
pub fn set_shadow_color(&mut self, value: AbsoluteColor) {
|
||||
self.backend.set_shadow_color(value, &mut self.state);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use canvas_traits::canvas::*;
|
||||
use cssparser::color::clamp_unit_f32;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
||||
use euclid::Angle;
|
||||
use font_kit::font::Font;
|
||||
use log::warn;
|
||||
use lyon_geom::Arc;
|
||||
use raqote::PathOp;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
|
||||
use crate::canvas_data;
|
||||
use crate::canvas_data::{
|
||||
|
@ -29,7 +30,7 @@ impl Backend for RaqoteBackend {
|
|||
color.as_raqote().a != 0
|
||||
}
|
||||
|
||||
fn set_shadow_color(&mut self, color: RgbaLegacy, state: &mut CanvasPaintState<'_>) {
|
||||
fn set_shadow_color(&mut self, color: AbsoluteColor, state: &mut CanvasPaintState<'_>) {
|
||||
state.shadow_color = Color::Raqote(color.to_raqote_style());
|
||||
}
|
||||
|
||||
|
@ -850,40 +851,14 @@ pub trait ToRaqoteGradientStop {
|
|||
fn to_raqote(self) -> raqote::GradientStop;
|
||||
}
|
||||
|
||||
/// Clamp a 0..1 number to a 0..255 range to u8.
|
||||
///
|
||||
/// Whilst scaling by 256 and flooring would provide
|
||||
/// an equal distribution of integers to percentage inputs,
|
||||
/// this is not what Gecko does so we instead multiply by 255
|
||||
/// and round (adding 0.5 and flooring is equivalent to rounding)
|
||||
///
|
||||
/// Chrome does something similar for the alpha value, but not
|
||||
/// the rgb values.
|
||||
///
|
||||
/// See <https://bugzilla.mozilla.org/show_bug.cgi?id=1340484>
|
||||
///
|
||||
/// Clamping to 256 and rounding after would let 1.0 map to 256, and
|
||||
/// `256.0_f32 as u8` is undefined behavior:
|
||||
///
|
||||
/// <https://github.com/rust-lang/rust/issues/10184>
|
||||
#[inline]
|
||||
pub fn clamp_unit_f32(val: f32) -> u8 {
|
||||
clamp_floor_256_f32(val * 255.)
|
||||
}
|
||||
|
||||
/// Round and clamp a single number to a u8.
|
||||
#[inline]
|
||||
pub fn clamp_floor_256_f32(val: f32) -> u8 {
|
||||
val.round().clamp(0., 255.) as u8
|
||||
}
|
||||
|
||||
impl ToRaqoteGradientStop for CanvasGradientStop {
|
||||
fn to_raqote(self) -> raqote::GradientStop {
|
||||
let srgb = self.color.into_srgb_legacy();
|
||||
let color = raqote::Color::new(
|
||||
clamp_unit_f32(self.color.alpha),
|
||||
self.color.red,
|
||||
self.color.green,
|
||||
self.color.blue,
|
||||
clamp_unit_f32(srgb.alpha),
|
||||
clamp_unit_f32(srgb.components.0),
|
||||
clamp_unit_f32(srgb.components.1),
|
||||
clamp_unit_f32(srgb.components.2),
|
||||
);
|
||||
let position = self.offset as f32;
|
||||
raqote::GradientStop { position, color }
|
||||
|
@ -896,12 +871,15 @@ impl ToRaqotePattern<'_> for FillOrStrokeStyle {
|
|||
use canvas_traits::canvas::FillOrStrokeStyle::*;
|
||||
|
||||
match self {
|
||||
Color(color) => Some(Pattern::Color(
|
||||
clamp_unit_f32(color.alpha),
|
||||
color.red,
|
||||
color.green,
|
||||
color.blue,
|
||||
)),
|
||||
Color(color) => {
|
||||
let srgb = color.into_srgb_legacy();
|
||||
Some(Pattern::Color(
|
||||
clamp_unit_f32(srgb.alpha),
|
||||
clamp_unit_f32(srgb.components.0),
|
||||
clamp_unit_f32(srgb.components.1),
|
||||
clamp_unit_f32(srgb.components.2),
|
||||
))
|
||||
},
|
||||
LinearGradient(style) => {
|
||||
let start = Point2D::new(style.x0 as f32, style.y0 as f32);
|
||||
let end = Point2D::new(style.x1 as f32, style.y1 as f32);
|
||||
|
@ -951,15 +929,16 @@ impl Color {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToRaqoteStyle for RgbaLegacy {
|
||||
impl ToRaqoteStyle for AbsoluteColor {
|
||||
type Target = raqote::SolidSource;
|
||||
|
||||
fn to_raqote_style(self) -> Self::Target {
|
||||
let srgb = self.into_srgb_legacy();
|
||||
raqote::SolidSource::from_unpremultiplied_argb(
|
||||
clamp_unit_f32(self.alpha),
|
||||
self.red,
|
||||
self.green,
|
||||
self.blue,
|
||||
clamp_unit_f32(srgb.alpha),
|
||||
clamp_unit_f32(srgb.components.0),
|
||||
clamp_unit_f32(srgb.components.1),
|
||||
clamp_unit_f32(srgb.components.2),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use canvas_traits::canvas::{
|
|||
FillRule, LineCapStyle, LineJoinStyle, LinearGradientStyle, RadialGradientStyle,
|
||||
RepetitionStyle, TextAlign, TextBaseline,
|
||||
};
|
||||
use cssparser::color::clamp_unit_f32;
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
||||
use euclid::vec2;
|
||||
|
@ -22,8 +23,7 @@ use pixels::PixelFormat;
|
|||
use profile_traits::ipc as profiled_ipc;
|
||||
use script_traits::ScriptMsg;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::{AbsoluteColor, ColorSpace};
|
||||
use style::color::{AbsoluteColor, ColorFlags, ColorSpace};
|
||||
use style::context::QuirksMode;
|
||||
use style::parser::ParserContext;
|
||||
use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
|
||||
|
@ -32,7 +32,7 @@ use style::stylesheets::{CssRuleType, Origin};
|
|||
use style::values::computed::font::FontStyle;
|
||||
use style::values::specified::color::Color;
|
||||
use style_traits::values::ToCss;
|
||||
use style_traits::ParsingMode;
|
||||
use style_traits::{CssWriter, ParsingMode};
|
||||
use url::Url;
|
||||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
|
@ -63,7 +63,7 @@ use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
|
|||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) enum CanvasFillOrStrokeStyle {
|
||||
Color(#[no_trace] RgbaLegacy),
|
||||
Color(#[no_trace] AbsoluteColor),
|
||||
Gradient(Dom<CanvasGradient>),
|
||||
Pattern(Dom<CanvasPattern>),
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ pub(crate) struct CanvasContextState {
|
|||
shadow_offset_y: f64,
|
||||
shadow_blur: f64,
|
||||
#[no_trace]
|
||||
shadow_color: RgbaLegacy,
|
||||
shadow_color: AbsoluteColor,
|
||||
#[no_trace]
|
||||
font_style: Option<Font>,
|
||||
#[no_trace]
|
||||
|
@ -114,13 +114,12 @@ impl CanvasContextState {
|
|||
const DEFAULT_FONT_STYLE: &'static str = "10px sans-serif";
|
||||
|
||||
pub(crate) fn new() -> CanvasContextState {
|
||||
let black = RgbaLegacy::new(0, 0, 0, 1.0);
|
||||
CanvasContextState {
|
||||
global_alpha: 1.0,
|
||||
global_composition: CompositionOrBlending::default(),
|
||||
image_smoothing_enabled: true,
|
||||
fill_style: CanvasFillOrStrokeStyle::Color(black),
|
||||
stroke_style: CanvasFillOrStrokeStyle::Color(black),
|
||||
fill_style: CanvasFillOrStrokeStyle::Color(AbsoluteColor::BLACK),
|
||||
stroke_style: CanvasFillOrStrokeStyle::Color(AbsoluteColor::BLACK),
|
||||
line_width: 1.0,
|
||||
line_cap: LineCapStyle::Butt,
|
||||
line_join: LineJoinStyle::Miter,
|
||||
|
@ -129,7 +128,7 @@ impl CanvasContextState {
|
|||
shadow_offset_x: 0.0,
|
||||
shadow_offset_y: 0.0,
|
||||
shadow_blur: 0.0,
|
||||
shadow_color: RgbaLegacy::new(0, 0, 0, 0.0),
|
||||
shadow_color: AbsoluteColor::TRANSPARENT_BLACK,
|
||||
font_style: None,
|
||||
text_align: Default::default(),
|
||||
text_baseline: Default::default(),
|
||||
|
@ -1689,7 +1688,7 @@ impl CanvasState {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<RgbaLegacy, ()> {
|
||||
pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<AbsoluteColor, ()> {
|
||||
let mut input = ParserInput::new(string);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
let url = Url::parse("about:blank").unwrap().into();
|
||||
|
@ -1726,15 +1725,7 @@ pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<R
|
|||
},
|
||||
};
|
||||
|
||||
let rgba = color
|
||||
.resolve_to_absolute(¤t_color)
|
||||
.to_color_space(ColorSpace::Srgb);
|
||||
Ok(RgbaLegacy::from_floats(
|
||||
rgba.components.0,
|
||||
rgba.components.1,
|
||||
rgba.components.2,
|
||||
rgba.alpha,
|
||||
))
|
||||
Ok(color.resolve_to_absolute(¤t_color))
|
||||
},
|
||||
None => Err(()),
|
||||
}
|
||||
|
@ -1747,17 +1738,21 @@ pub fn is_rect_valid(rect: Rect<f64>) -> bool {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#serialisation-of-a-color
|
||||
pub fn serialize<W>(color: &RgbaLegacy, dest: &mut W) -> fmt::Result
|
||||
pub fn serialize<W>(color: &AbsoluteColor, dest: &mut W) -> fmt::Result
|
||||
where
|
||||
W: fmt::Write,
|
||||
{
|
||||
let RgbaLegacy {
|
||||
red,
|
||||
green,
|
||||
blue,
|
||||
alpha,
|
||||
} = color;
|
||||
if *alpha == 1.0 {
|
||||
let srgb = match color.color_space {
|
||||
ColorSpace::Srgb if color.flags.contains(ColorFlags::IS_LEGACY_SRGB) => *color,
|
||||
ColorSpace::Hsl | ColorSpace::Hwb => color.into_srgb_legacy(),
|
||||
_ => return color.to_css(&mut CssWriter::new(dest)),
|
||||
};
|
||||
debug_assert!(srgb.flags.contains(ColorFlags::IS_LEGACY_SRGB));
|
||||
let red = clamp_unit_f32(srgb.components.0);
|
||||
let green = clamp_unit_f32(srgb.components.1);
|
||||
let blue = clamp_unit_f32(srgb.components.2);
|
||||
let alpha = srgb.alpha;
|
||||
if alpha == 1.0 {
|
||||
write!(
|
||||
dest,
|
||||
"#{:x}{:x}{:x}{:x}{:x}{:x}",
|
||||
|
|
|
@ -709,15 +709,9 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
|||
};
|
||||
|
||||
if let Some(color) = bgcolor {
|
||||
use style::color::parsing::FromParsedColor;
|
||||
hints.push(from_declaration(
|
||||
shared_lock,
|
||||
PropertyDeclaration::BackgroundColor(specified::Color::from_rgba(
|
||||
color.red,
|
||||
color.green,
|
||||
color.blue,
|
||||
color.alpha,
|
||||
)),
|
||||
PropertyDeclaration::BackgroundColor(specified::Color::from_absolute_color(color)),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -749,11 +743,10 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
|||
};
|
||||
|
||||
if let Some(color) = color {
|
||||
use style::color::parsing::FromParsedColor;
|
||||
hints.push(from_declaration(
|
||||
shared_lock,
|
||||
PropertyDeclaration::Color(longhands::color::SpecifiedValue(
|
||||
specified::Color::from_rgba(color.red, color.green, color.blue, color.alpha),
|
||||
specified::Color::from_absolute_color(color),
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
|||
use js::rust::HandleObject;
|
||||
use servo_url::ServoUrl;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::HTMLBodyElementMethods;
|
||||
|
@ -100,20 +100,20 @@ impl HTMLBodyElementMethods for HTMLBodyElement {
|
|||
}
|
||||
|
||||
pub trait HTMLBodyElementLayoutHelpers {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_background_color(self) -> Option<AbsoluteColor>;
|
||||
fn get_color(self) -> Option<AbsoluteColor>;
|
||||
fn get_background(self) -> Option<ServoUrl>;
|
||||
}
|
||||
|
||||
impl HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement> {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_background_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
|
||||
.and_then(AttrValue::as_color)
|
||||
.cloned()
|
||||
}
|
||||
|
||||
fn get_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("text"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -7,7 +7,7 @@ use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
|||
use js::rust::HandleObject;
|
||||
use servo_atoms::Atom;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
|
@ -107,13 +107,13 @@ impl VirtualMethods for HTMLFontElement {
|
|||
}
|
||||
|
||||
pub trait HTMLFontElementLayoutHelpers {
|
||||
fn get_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_color(self) -> Option<AbsoluteColor>;
|
||||
fn get_face(self) -> Option<Atom>;
|
||||
fn get_size(self) -> Option<u32>;
|
||||
}
|
||||
|
||||
impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement> {
|
||||
fn get_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("color"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -6,7 +6,7 @@ use dom_struct::dom_struct;
|
|||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding::HTMLHRElementMethods;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
|
@ -70,12 +70,12 @@ impl HTMLHRElementMethods for HTMLHRElement {
|
|||
}
|
||||
|
||||
pub trait HTMLHRLayoutHelpers {
|
||||
fn get_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_color(self) -> Option<AbsoluteColor>;
|
||||
fn get_width(self) -> LengthOrPercentageOrAuto;
|
||||
}
|
||||
|
||||
impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement> {
|
||||
fn get_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("color"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -6,7 +6,7 @@ use dom_struct::dom_struct;
|
|||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
use style::context::QuirksMode;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
|
||||
|
@ -106,7 +106,7 @@ impl HTMLTableCellElementMethods for HTMLTableCellElement {
|
|||
}
|
||||
|
||||
pub trait HTMLTableCellElementLayoutHelpers<'dom> {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_background_color(self) -> Option<AbsoluteColor>;
|
||||
fn get_colspan(self) -> Option<u32>;
|
||||
fn get_rowspan(self) -> Option<u32>;
|
||||
fn get_table(self) -> Option<LayoutDom<'dom, HTMLTableElement>>;
|
||||
|
@ -114,7 +114,7 @@ pub trait HTMLTableCellElementLayoutHelpers<'dom> {
|
|||
}
|
||||
|
||||
impl<'dom> HTMLTableCellElementLayoutHelpers<'dom> for LayoutDom<'dom, HTMLTableCellElement> {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_background_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -8,7 +8,7 @@ use dom_struct::dom_struct;
|
|||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
|
||||
|
@ -438,7 +438,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
|
|||
}
|
||||
|
||||
pub trait HTMLTableElementLayoutHelpers {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_background_color(self) -> Option<AbsoluteColor>;
|
||||
fn get_border(self) -> Option<u32>;
|
||||
fn get_cellpadding(self) -> Option<u32>;
|
||||
fn get_cellspacing(self) -> Option<u32>;
|
||||
|
@ -446,7 +446,7 @@ pub trait HTMLTableElementLayoutHelpers {
|
|||
}
|
||||
|
||||
impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement> {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_background_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -6,7 +6,7 @@ use dom_struct::dom_struct;
|
|||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::HTMLTableRowElementMethods;
|
||||
|
@ -153,11 +153,11 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
|
|||
}
|
||||
|
||||
pub trait HTMLTableRowElementLayoutHelpers {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_background_color(self) -> Option<AbsoluteColor>;
|
||||
}
|
||||
|
||||
impl HTMLTableRowElementLayoutHelpers for LayoutDom<'_, HTMLTableRowElement> {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_background_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -6,7 +6,7 @@ use dom_struct::dom_struct;
|
|||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
|
@ -91,11 +91,11 @@ impl HTMLTableSectionElementMethods for HTMLTableSectionElement {
|
|||
}
|
||||
|
||||
pub trait HTMLTableSectionElementLayoutHelpers {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy>;
|
||||
fn get_background_color(self) -> Option<AbsoluteColor>;
|
||||
}
|
||||
|
||||
impl HTMLTableSectionElementLayoutHelpers for LayoutDom<'_, HTMLTableSectionElement> {
|
||||
fn get_background_color(self) -> Option<RgbaLegacy> {
|
||||
fn get_background_color(self) -> Option<AbsoluteColor> {
|
||||
self.upcast::<Element>()
|
||||
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
|
||||
.and_then(AttrValue::as_color)
|
||||
|
|
|
@ -10,7 +10,7 @@ use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMem
|
|||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_bytes::ByteBuf;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::AbsoluteColor;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use webrender_api::ImageKey;
|
||||
|
||||
|
@ -75,7 +75,7 @@ pub enum Canvas2dMsg {
|
|||
SetShadowOffsetX(f64),
|
||||
SetShadowOffsetY(f64),
|
||||
SetShadowBlur(f64),
|
||||
SetShadowColor(RgbaLegacy),
|
||||
SetShadowColor(AbsoluteColor),
|
||||
SetFont(FontStyleStruct),
|
||||
SetTextAlign(TextAlign),
|
||||
SetTextBaseline(TextBaseline),
|
||||
|
@ -94,7 +94,7 @@ pub enum FromScriptMsg {
|
|||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct CanvasGradientStop {
|
||||
pub offset: f64,
|
||||
pub color: RgbaLegacy,
|
||||
pub color: AbsoluteColor,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
|
@ -183,7 +183,7 @@ impl SurfaceStyle {
|
|||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum FillOrStrokeStyle {
|
||||
Color(RgbaLegacy),
|
||||
Color(AbsoluteColor),
|
||||
LinearGradient(LinearGradientStyle),
|
||||
RadialGradient(RadialGradientStyle),
|
||||
Surface(SurfaceStyle),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue