aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2024-03-18 14:52:40 +0100
committerGitHub <noreply@github.com>2024-03-18 13:52:40 +0000
commitc07484fcb605a9ab0a3f9fba4cb4ddd24d89cb87 (patch)
tree3328bfaa0552bee8f6d7833b8e07a06b2b5ebedc /components
parent94c1f2c99229fde82e09ae5d8e06792ea9d90787 (diff)
downloadservo-c07484fcb605a9ab0a3f9fba4cb4ddd24d89cb87.tar.gz
servo-c07484fcb605a9ab0a3f9fba4cb4ddd24d89cb87.zip
Update Stylo to 2023-09-01 (#31609)
* Update Stylo to 2023-09-01 * Fixup for https://phabricator.services.mozilla.com/D184929 * Fixup for https://phabricator.services.mozilla.com/D184526 * Fixup for https://phabricator.services.mozilla.com/D184525 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D184685 * Fixup for https://phabricator.services.mozilla.com/D185916 * Fixup for https://phabricator.services.mozilla.com/D185492 * Fixup for https://phabricator.services.mozilla.com/D186626 * Update test expectations
Diffstat (limited to 'components')
-rw-r--r--components/canvas/canvas_data.rs6
-rw-r--r--components/canvas/raqote_backend.rs30
-rw-r--r--components/layout/display_list/builder.rs16
-rw-r--r--components/layout/display_list/gradient.rs10
-rw-r--r--components/layout/table_row.rs2
-rw-r--r--components/layout_2020/display_list/gradient.rs49
-rw-r--r--components/script/canvas_state.rs41
-rw-r--r--components/script/dom/element.rs29
-rw-r--r--components/script/dom/htmlbodyelement.rs10
-rw-r--r--components/script/dom/htmlfontelement.rs6
-rw-r--r--components/script/dom/htmlhrelement.rs6
-rw-r--r--components/script/dom/htmlstyleelement.rs1
-rw-r--r--components/script/dom/htmltablecellelement.rs6
-rw-r--r--components/script/dom/htmltableelement.rs6
-rw-r--r--components/script/dom/htmltablerowelement.rs6
-rw-r--r--components/script/dom/htmltablesectionelement.rs6
-rw-r--r--components/script/dom/node.rs6
-rw-r--r--components/script/layout_dom/element.rs14
-rw-r--r--components/shared/canvas/canvas.rs8
19 files changed, 155 insertions, 103 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs
index b125eb4e65c..c9855b1937b 100644
--- a/components/canvas/canvas_data.rs
+++ b/components/canvas/canvas_data.rs
@@ -7,7 +7,7 @@ use std::mem;
use std::sync::{Arc, Mutex};
use canvas_traits::canvas::*;
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use euclid::{point2, vec2};
use font_kit::family_name::FamilyName;
@@ -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: RGBA, state: &mut CanvasPaintState<'_>);
+ fn set_shadow_color(&mut self, color: RgbaLegacy, state: &mut CanvasPaintState<'_>);
fn set_fill_style(
&mut self,
style: FillOrStrokeStyle,
@@ -1156,7 +1156,7 @@ impl<'a> CanvasData<'a> {
self.state.shadow_blur = value;
}
- pub fn set_shadow_color(&mut self, value: RGBA) {
+ pub fn set_shadow_color(&mut self, value: RgbaLegacy) {
self.backend.set_shadow_color(value, &mut self.state);
}
diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs
index aa3737897eb..ae7266475af 100644
--- a/components/canvas/raqote_backend.rs
+++ b/components/canvas/raqote_backend.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::canvas::*;
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use euclid::Angle;
use font_kit::font::Font;
@@ -29,7 +29,7 @@ impl Backend for RaqoteBackend {
color.as_raqote().a != 0
}
- fn set_shadow_color(&mut self, color: RGBA, state: &mut CanvasPaintState<'_>) {
+ fn set_shadow_color(&mut self, color: RgbaLegacy, state: &mut CanvasPaintState<'_>) {
state.shadow_color = Color::Raqote(color.to_raqote_style());
}
@@ -880,10 +880,10 @@ pub fn clamp_floor_256_f32(val: f32) -> u8 {
impl ToRaqoteGradientStop for CanvasGradientStop {
fn to_raqote(self) -> raqote::GradientStop {
let color = raqote::Color::new(
- self.color.alpha.map(clamp_unit_f32).unwrap_or(0),
- self.color.red.unwrap_or(0),
- self.color.green.unwrap_or(0),
- self.color.blue.unwrap_or(0),
+ clamp_unit_f32(self.color.alpha),
+ self.color.red,
+ self.color.green,
+ self.color.blue,
);
let position = self.offset as f32;
raqote::GradientStop { position, color }
@@ -897,10 +897,10 @@ impl ToRaqotePattern<'_> for FillOrStrokeStyle {
match self {
Color(color) => Some(Pattern::Color(
- color.alpha.map(clamp_unit_f32).unwrap_or(0),
- color.red.unwrap_or(0),
- color.green.unwrap_or(0),
- color.blue.unwrap_or(0),
+ clamp_unit_f32(color.alpha),
+ color.red,
+ color.green,
+ color.blue,
)),
LinearGradient(style) => {
let start = Point2D::new(style.x0 as f32, style.y0 as f32);
@@ -951,15 +951,15 @@ impl Color {
}
}
-impl ToRaqoteStyle for RGBA {
+impl ToRaqoteStyle for RgbaLegacy {
type Target = raqote::SolidSource;
fn to_raqote_style(self) -> Self::Target {
raqote::SolidSource::from_unpremultiplied_argb(
- self.alpha.map(clamp_unit_f32).unwrap_or(0),
- self.red.unwrap_or(0),
- self.green.unwrap_or(0),
- self.blue.unwrap_or(0),
+ clamp_unit_f32(self.alpha),
+ self.red,
+ self.green,
+ self.blue,
)
}
}
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs
index c2cd9f19c21..d3f19ea1537 100644
--- a/components/layout/display_list/builder.rs
+++ b/components/layout/display_list/builder.rs
@@ -984,7 +984,7 @@ impl Fragment {
ref direction,
ref color_interpolation_method,
ref items,
- ref repeating,
+ ref flags,
compat_mode: _,
} => {
let (gradient, stops) = gradient::linear(
@@ -993,7 +993,7 @@ impl Fragment {
items,
*direction,
color_interpolation_method,
- *repeating,
+ *flags,
);
let item = webrender_api::GradientDisplayItem {
gradient,
@@ -1009,7 +1009,7 @@ impl Fragment {
ref position,
ref color_interpolation_method,
ref items,
- ref repeating,
+ ref flags,
compat_mode: _,
} => {
let (gradient, stops) = gradient::radial(
@@ -1019,7 +1019,7 @@ impl Fragment {
shape,
position,
color_interpolation_method,
- *repeating,
+ *flags,
);
let item = webrender_api::RadialGradientDisplayItem {
gradient,
@@ -1252,7 +1252,7 @@ impl Fragment {
ref direction,
ref color_interpolation_method,
ref items,
- ref repeating,
+ ref flags,
compat_mode: _,
} => {
let (wr_gradient, linear_stops) = gradient::linear(
@@ -1261,7 +1261,7 @@ impl Fragment {
items,
*direction,
color_interpolation_method,
- *repeating,
+ *flags,
);
stops = linear_stops;
NinePatchBorderSource::Gradient(wr_gradient)
@@ -1271,7 +1271,7 @@ impl Fragment {
ref position,
ref color_interpolation_method,
ref items,
- ref repeating,
+ ref flags,
compat_mode: _,
} => {
let (wr_gradient, radial_stops) = gradient::radial(
@@ -1281,7 +1281,7 @@ impl Fragment {
shape,
position,
color_interpolation_method,
- *repeating,
+ *flags,
);
stops = radial_stops;
NinePatchBorderSource::RadialGradient(wr_gradient)
diff --git a/components/layout/display_list/gradient.rs b/components/layout/display_list/gradient.rs
index acc68811786..dc126476a92 100644
--- a/components/layout/display_list/gradient.rs
+++ b/components/layout/display_list/gradient.rs
@@ -8,7 +8,9 @@ use style::color::mix::ColorInterpolationMethod;
use style::properties::ComputedValues;
use style::values::computed::image::{EndingShape, LineDirection};
use style::values::computed::{Angle, Color, LengthPercentage, Percentage, Position};
-use style::values::generics::image::{Circle, ColorStop, Ellipse, GradientItem, ShapeExtent};
+use style::values::generics::image::{
+ Circle, ColorStop, Ellipse, GradientFlags, GradientItem, ShapeExtent,
+};
use webrender_api::{ExtendMode, Gradient, GradientBuilder, GradientStop, RadialGradient};
use crate::display_list::ToLayout;
@@ -242,10 +244,11 @@ pub fn linear(
stops: &[GradientItem<Color, LengthPercentage>],
direction: LineDirection,
_color_interpolation_method: &ColorInterpolationMethod,
- repeating: bool,
+ flags: GradientFlags,
) -> (Gradient, Vec<GradientStop>) {
use style::values::specified::position::HorizontalPositionKeyword::*;
use style::values::specified::position::VerticalPositionKeyword::*;
+ let repeating = flags.contains(GradientFlags::REPEATING);
let angle = match direction {
LineDirection::Angle(angle) => angle.radians(),
LineDirection::Horizontal(x) => match x {
@@ -310,8 +313,9 @@ pub fn radial(
shape: &EndingShape,
center: &Position,
_color_interpolation_method: &ColorInterpolationMethod,
- repeating: bool,
+ flags: GradientFlags,
) -> (RadialGradient, Vec<GradientStop>) {
+ let repeating = flags.contains(GradientFlags::REPEATING);
let center = Point2D::new(
center.horizontal.to_used_value(size.width),
center.vertical.to_used_value(size.height),
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index fbc441055da..d8ecda844eb 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -771,7 +771,7 @@ impl CollapsedBorder {
CollapsedBorder {
style: BorderStyle::None,
width: Au(0),
- color: Color::transparent(),
+ color: Color::TRANSPARENT,
provenance: CollapsedBorderFrom::Table,
}
}
diff --git a/components/layout_2020/display_list/gradient.rs b/components/layout_2020/display_list/gradient.rs
index f088ee91faa..582b7ea19de 100644
--- a/components/layout_2020/display_list/gradient.rs
+++ b/components/layout_2020/display_list/gradient.rs
@@ -8,7 +8,9 @@ use style::values::computed::image::{EndingShape, Gradient, LineDirection};
use style::values::computed::{
Angle, AngleOrPercentage, Color, Length, LengthPercentage, Position,
};
-use style::values::generics::image::{Circle, ColorStop, Ellipse, GradientItem, ShapeExtent};
+use style::values::generics::image::{
+ Circle, ColorStop, Ellipse, GradientFlags, GradientItem, ShapeExtent,
+};
use webrender_api::{self as wr, units};
use wr::ColorF;
@@ -23,18 +25,14 @@ pub(super) fn build(
ref items,
ref direction,
ref color_interpolation_method,
- ref repeating,
+ ref flags,
compat_mode: _,
} => build_linear(
style,
items,
direction,
color_interpolation_method,
- if *repeating {
- wr::ExtendMode::Repeat
- } else {
- wr::ExtendMode::Clamp
- },
+ *flags,
layer,
builder,
),
@@ -43,7 +41,7 @@ pub(super) fn build(
ref position,
ref color_interpolation_method,
ref items,
- ref repeating,
+ ref flags,
compat_mode: _,
} => build_radial(
style,
@@ -51,11 +49,7 @@ pub(super) fn build(
shape,
position,
color_interpolation_method,
- if *repeating {
- wr::ExtendMode::Repeat
- } else {
- wr::ExtendMode::Clamp
- },
+ *flags,
layer,
builder,
),
@@ -64,18 +58,14 @@ pub(super) fn build(
position,
color_interpolation_method,
items,
- repeating,
+ flags,
} => build_conic(
style,
*angle,
position,
*color_interpolation_method,
items,
- if *repeating {
- wr::ExtendMode::Repeat
- } else {
- wr::ExtendMode::Clamp
- },
+ *flags,
layer,
builder,
),
@@ -88,7 +78,7 @@ pub(super) fn build_linear(
items: &[GradientItem<Color, LengthPercentage>],
line_direction: &LineDirection,
_color_interpolation_method: &ColorInterpolationMethod,
- extend_mode: wr::ExtendMode,
+ flags: GradientFlags,
layer: &super::background::BackgroundLayer,
builder: &mut super::DisplayListBuilder,
) {
@@ -173,6 +163,11 @@ pub(super) fn build_linear(
let mut color_stops =
gradient_items_to_color_stops(style, items, Length::new(gradient_line_length));
let stops = fixup_stops(&mut color_stops);
+ let extend_mode = if flags.contains(GradientFlags::REPEATING) {
+ wr::ExtendMode::Repeat
+ } else {
+ wr::ExtendMode::Clamp
+ };
let linear_gradient = builder
.wr()
.create_gradient(start_point, end_point, stops, extend_mode);
@@ -193,7 +188,7 @@ pub(super) fn build_radial(
shape: &EndingShape,
center: &Position,
_color_interpolation_method: &ColorInterpolationMethod,
- extend_mode: wr::ExtendMode,
+ flags: GradientFlags,
layer: &super::background::BackgroundLayer,
builder: &mut super::DisplayListBuilder,
) {
@@ -277,6 +272,11 @@ pub(super) fn build_radial(
let mut color_stops =
gradient_items_to_color_stops(style, items, Length::new(gradient_line_length));
let stops = fixup_stops(&mut color_stops);
+ let extend_mode = if flags.contains(GradientFlags::REPEATING) {
+ wr::ExtendMode::Repeat
+ } else {
+ wr::ExtendMode::Clamp
+ };
let radial_gradient = builder
.wr()
.create_radial_gradient(center, radii, stops, extend_mode);
@@ -297,7 +297,7 @@ fn build_conic(
center: &Position,
_color_interpolation_method: ColorInterpolationMethod,
items: &[GradientItem<Color, AngleOrPercentage>],
- extend_mode: wr::ExtendMode,
+ flags: GradientFlags,
layer: &super::background::BackgroundLayer,
builder: &mut super::DisplayListBuilder<'_>,
) {
@@ -314,6 +314,11 @@ fn build_conic(
);
let mut color_stops = conic_gradient_items_to_color_stops(style, items);
let stops = fixup_stops(&mut color_stops);
+ let extend_mode = if flags.contains(GradientFlags::REPEATING) {
+ wr::ExtendMode::Repeat
+ } else {
+ wr::ExtendMode::Clamp
+ };
let conic_gradient =
builder
.wr()
diff --git a/components/script/canvas_state.rs b/components/script/canvas_state.rs
index 0658153739b..03e1fcc7568 100644
--- a/components/script/canvas_state.rs
+++ b/components/script/canvas_state.rs
@@ -12,7 +12,7 @@ use canvas_traits::canvas::{
FillRule, LineCapStyle, LineJoinStyle, LinearGradientStyle, RadialGradientStyle,
RepetitionStyle, TextAlign, TextBaseline,
};
-use cssparser::{Parser, ParserInput, RGBA};
+use cssparser::{Parser, ParserInput, RgbaLegacy};
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
use euclid::vec2;
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
@@ -62,7 +62,7 @@ use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
#[derive(Clone, JSTraceable, MallocSizeOf)]
#[allow(dead_code)]
pub(crate) enum CanvasFillOrStrokeStyle {
- Color(#[no_trace] RGBA),
+ Color(#[no_trace] RgbaLegacy),
Gradient(Dom<CanvasGradient>),
Pattern(Dom<CanvasPattern>),
}
@@ -98,7 +98,7 @@ pub(crate) struct CanvasContextState {
shadow_offset_y: f64,
shadow_blur: f64,
#[no_trace]
- shadow_color: RGBA,
+ shadow_color: RgbaLegacy,
#[no_trace]
font_style: Option<Font>,
#[no_trace]
@@ -113,7 +113,7 @@ impl CanvasContextState {
const DEFAULT_FONT_STYLE: &'static str = "10px sans-serif";
pub(crate) fn new() -> CanvasContextState {
- let black = RGBA::new(Some(0), Some(0), Some(0), Some(1.0));
+ let black = RgbaLegacy::new(0, 0, 0, 1.0);
CanvasContextState {
global_alpha: 1.0,
global_composition: CompositionOrBlending::default(),
@@ -128,7 +128,7 @@ impl CanvasContextState {
shadow_offset_x: 0.0,
shadow_offset_y: 0.0,
shadow_blur: 0.0,
- shadow_color: RGBA::new(Some(0), Some(0), Some(0), Some(0.0)),
+ shadow_color: RgbaLegacy::new(0, 0, 0, 0.0),
font_style: None,
text_align: Default::default(),
text_baseline: Default::default(),
@@ -1679,7 +1679,7 @@ impl CanvasState {
}
}
-pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<RGBA, ()> {
+pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<RgbaLegacy, ()> {
let mut input = ParserInput::new(string);
let mut parser = Parser::new(&mut input);
let url = Url::parse("about:blank").unwrap().into();
@@ -1704,14 +1704,14 @@ pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<R
// https://drafts.css-houdini.org/css-paint-api/#2d-rendering-context
// Whenever "currentColor" is used as a color in the PaintRenderingContext2D API,
// it is treated as opaque black.
- None => AbsoluteColor::black(),
+ None => AbsoluteColor::BLACK,
Some(ref canvas) => {
let canvas_element = canvas.upcast::<Element>();
match canvas_element.style() {
Some(ref s) if canvas_element.has_css_layout_box() => {
s.get_inherited_text().color
},
- _ => AbsoluteColor::black(),
+ _ => AbsoluteColor::BLACK,
}
},
};
@@ -1719,11 +1719,11 @@ pub fn parse_color(canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<R
let rgba = color
.resolve_to_absolute(&current_color)
.to_color_space(ColorSpace::Srgb);
- Ok(RGBA::from_floats(
- Some(rgba.components.0),
- Some(rgba.components.1),
- Some(rgba.components.2),
- Some(rgba.alpha),
+ Ok(RgbaLegacy::from_floats(
+ rgba.components.0,
+ rgba.components.1,
+ rgba.components.2,
+ rgba.alpha,
))
},
None => Err(()),
@@ -1737,16 +1737,17 @@ pub fn is_rect_valid(rect: Rect<f64>) -> bool {
}
// https://html.spec.whatwg.org/multipage/#serialisation-of-a-color
-pub fn serialize<W>(color: &RGBA, dest: &mut W) -> fmt::Result
+pub fn serialize<W>(color: &RgbaLegacy, dest: &mut W) -> fmt::Result
where
W: fmt::Write,
{
- let red = color.red.unwrap_or(0);
- let green = color.green.unwrap_or(0);
- let blue = color.blue.unwrap_or(0);
- let alpha = color.alpha.unwrap_or(0.0);
-
- if alpha == 1.0 {
+ let RgbaLegacy {
+ red,
+ green,
+ blue,
+ alpha,
+ } = color;
+ if *alpha == 1.0 {
write!(
dest,
"#{:x}{:x}{:x}{:x}{:x}{:x}",
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index da0ad78d91e..9ddde5d0d86 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -30,6 +30,7 @@ use net_traits::request::CorsSettings;
use net_traits::ReferrerPolicy;
use script_layout_interface::message::ReflowGoal;
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
+use selectors::bloom::{BloomFilter, BLOOM_HASH_MASK};
use selectors::matching::{ElementSelectorFlags, MatchingContext};
use selectors::sink::Push;
use selectors::Element as SelectorsElement;
@@ -3393,6 +3394,34 @@ impl<'a> SelectorsElement for DomRoot<Element> {
}
}
}
+
+ fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool {
+ let mut f = |hash| filter.insert_hash(hash & BLOOM_HASH_MASK);
+
+ // We can't use style::bloom::each_relevant_element_hash(*self, f)
+ // since DomRoot<Element> doesn't have the TElement trait.
+ f(Element::local_name(self).get_hash());
+ f(Element::namespace(self).get_hash());
+
+ if let Some(ref id) = *self.id_attribute.borrow() {
+ f(id.get_hash());
+ }
+
+ if let Some(attr) = self.get_attribute(&ns!(), &local_name!("class")) {
+ for class in attr.value().as_tokens() {
+ f(AtomIdent::cast(class).get_hash());
+ }
+ }
+
+ for attr in self.attrs.borrow().iter() {
+ let name = style::values::GenericAtomIdent::cast(attr.local_name());
+ if !style::bloom::is_attr_name_excluded_from_filter(name) {
+ f(name.get_hash());
+ }
+ }
+
+ true
+ }
}
impl Element {
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index 0ecd130914f..64f482f054c 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
@@ -100,20 +100,20 @@ impl HTMLBodyElementMethods for HTMLBodyElement {
}
pub trait HTMLBodyElementLayoutHelpers {
- fn get_background_color(self) -> Option<RGBA>;
- fn get_color(self) -> Option<RGBA>;
+ fn get_background_color(self) -> Option<RgbaLegacy>;
+ fn get_color(self) -> Option<RgbaLegacy>;
fn get_background(self) -> Option<ServoUrl>;
}
impl HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement> {
- fn get_background_color(self) -> Option<RGBA> {
+ fn get_background_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
.and_then(AttrValue::as_color)
.cloned()
}
- fn get_color(self) -> Option<RGBA> {
+ fn get_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("text"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index fb1fa3f53a9..9bdd32bb5c4 100644
--- a/components/script/dom/htmlfontelement.rs
+++ b/components/script/dom/htmlfontelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
@@ -105,13 +105,13 @@ impl VirtualMethods for HTMLFontElement {
}
pub trait HTMLFontElementLayoutHelpers {
- fn get_color(self) -> Option<RGBA>;
+ fn get_color(self) -> Option<RgbaLegacy>;
fn get_face(self) -> Option<Atom>;
fn get_size(self) -> Option<u32>;
}
impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement> {
- fn get_color(self) -> Option<RGBA> {
+ fn get_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("color"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs
index f28a592000b..1a63747aa57 100644
--- a/components/script/dom/htmlhrelement.rs
+++ b/components/script/dom/htmlhrelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
@@ -70,12 +70,12 @@ impl HTMLHRElementMethods for HTMLHRElement {
}
pub trait HTMLHRLayoutHelpers {
- fn get_color(self) -> Option<RGBA>;
+ fn get_color(self) -> Option<RgbaLegacy>;
fn get_width(self) -> LengthOrPercentageOrAuto;
}
impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement> {
- fn get_color(self) -> Option<RGBA> {
+ fn get_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("color"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index a42355167e9..c298db7398e 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -126,7 +126,6 @@ impl HTMLStyleElement {
Some(&loader),
css_error_reporter,
doc.quirks_mode(),
- self.line_number as u32,
AllowImportRules::Yes,
);
diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs
index c2cb14afb34..2b4406feb95 100644
--- a/components/script/dom/htmltablecellelement.rs
+++ b/components/script/dom/htmltablecellelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
@@ -106,7 +106,7 @@ impl HTMLTableCellElementMethods for HTMLTableCellElement {
}
pub trait HTMLTableCellElementLayoutHelpers<'dom> {
- fn get_background_color(self) -> Option<RGBA>;
+ fn get_background_color(self) -> Option<RgbaLegacy>;
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<RGBA> {
+ fn get_background_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs
index 4c50349cf70..93c40a5e930 100644
--- a/components/script/dom/htmltableelement.rs
+++ b/components/script/dom/htmltableelement.rs
@@ -4,7 +4,7 @@
use std::cell::Cell;
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
@@ -425,7 +425,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
}
pub trait HTMLTableElementLayoutHelpers {
- fn get_background_color(self) -> Option<RGBA>;
+ fn get_background_color(self) -> Option<RgbaLegacy>;
fn get_border(self) -> Option<u32>;
fn get_cellpadding(self) -> Option<u32>;
fn get_cellspacing(self) -> Option<u32>;
@@ -433,7 +433,7 @@ pub trait HTMLTableElementLayoutHelpers {
}
impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement> {
- fn get_background_color(self) -> Option<RGBA> {
+ fn get_background_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs
index a5fe4e2fec6..c400ac8011a 100644
--- a/components/script/dom/htmltablerowelement.rs
+++ b/components/script/dom/htmltablerowelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
@@ -153,11 +153,11 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
}
pub trait HTMLTableRowElementLayoutHelpers {
- fn get_background_color(self) -> Option<RGBA>;
+ fn get_background_color(self) -> Option<RgbaLegacy>;
}
impl HTMLTableRowElementLayoutHelpers for LayoutDom<'_, HTMLTableRowElement> {
- fn get_background_color(self) -> Option<RGBA> {
+ fn get_background_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs
index 9daf6393154..6dd042a0187 100644
--- a/components/script/dom/htmltablesectionelement.rs
+++ b/components/script/dom/htmltablesectionelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
@@ -91,11 +91,11 @@ impl HTMLTableSectionElementMethods for HTMLTableSectionElement {
}
pub trait HTMLTableSectionElementLayoutHelpers {
- fn get_background_color(self) -> Option<RGBA>;
+ fn get_background_color(self) -> Option<RgbaLegacy>;
}
impl HTMLTableSectionElementLayoutHelpers for LayoutDom<'_, HTMLTableSectionElement> {
- fn get_background_color(self) -> Option<RGBA> {
+ fn get_background_color(self) -> Option<RgbaLegacy> {
self.upcast::<Element>()
.get_attr_for_layout(&ns!(), &local_name!("bgcolor"))
.and_then(AttrValue::as_color)
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 9e6f4feeee9..ee1e563ef1d 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -31,7 +31,7 @@ use script_layout_interface::{
};
use script_traits::{DocumentActivity, UntrustedNodeAddress};
use selectors::matching::{
- matches_selector_list, IgnoreNthChildForInvalidation, MatchingContext, MatchingMode,
+ matches_selector_list, MatchingContext, MatchingForInvalidation, MatchingMode,
NeedsSelectorFlags,
};
use selectors::parser::SelectorList;
@@ -481,7 +481,7 @@ impl<'a> Iterator for QuerySelectorIterator {
&mut nth_index_cache,
node.owner_doc().quirks_mode(),
NeedsSelectorFlags::No,
- IgnoreNthChildForInvalidation::No,
+ MatchingForInvalidation::No,
);
if let Some(element) = DomRoot::downcast(node) {
if matches_selector_list(selectors, &element, &mut ctx) {
@@ -978,7 +978,7 @@ impl Node {
&mut nth_index_cache,
doc.quirks_mode(),
NeedsSelectorFlags::No,
- IgnoreNthChildForInvalidation::No,
+ MatchingForInvalidation::No,
);
Ok(self
.traverse_preorder(ShadowIncluding::No)
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index 40d7f0a8aa3..ab2a2f52c7c 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -15,6 +15,7 @@ use script_layout_interface::wrapper_traits::{
};
use script_layout_interface::{LayoutNodeType, StyleAndOpaqueLayoutData, StyleData};
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
+use selectors::bloom::{BloomFilter, BLOOM_HASH_MASK};
use selectors::matching::{ElementSelectorFlags, MatchingContext, VisitedHandlingMode};
use selectors::sink::Push;
use servo_arc::{Arc, ArcBorrow};
@@ -22,6 +23,7 @@ use servo_atoms::Atom;
use style::animation::AnimationSetKey;
use style::applicable_declarations::ApplicableDeclarationBlock;
use style::attr::AttrValue;
+use style::bloom::each_relevant_element_hash;
use style::context::SharedStyleContext;
use style::data::ElementData;
use style::dom::{DomChildren, LayoutIterator, TDocument, TElement, TNode, TShadowRoot};
@@ -682,6 +684,11 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
}
}
}
+
+ fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool {
+ each_relevant_element_hash(*self, |hash| filter.insert_hash(hash & BLOOM_HASH_MASK));
+ true
+ }
}
/// A wrapper around elements that ensures layout can only
@@ -941,6 +948,13 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
}
}
}
+
+ fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool {
+ each_relevant_element_hash(self.element, |hash| {
+ filter.insert_hash(hash & BLOOM_HASH_MASK)
+ });
+ true
+ }
}
impl<'dom, LayoutDataType: LayoutDataTrait> GetStyleAndOpaqueLayoutData<'dom>
diff --git a/components/shared/canvas/canvas.rs b/components/shared/canvas/canvas.rs
index f656b5dc92d..aaea3969bb8 100644
--- a/components/shared/canvas/canvas.rs
+++ b/components/shared/canvas/canvas.rs
@@ -5,7 +5,7 @@
use std::default::Default;
use std::str::FromStr;
-use cssparser::RGBA;
+use cssparser::RgbaLegacy;
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
use malloc_size_of_derive::MallocSizeOf;
@@ -75,7 +75,7 @@ pub enum Canvas2dMsg {
SetShadowOffsetX(f64),
SetShadowOffsetY(f64),
SetShadowBlur(f64),
- SetShadowColor(RGBA),
+ SetShadowColor(RgbaLegacy),
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: RGBA,
+ pub color: RgbaLegacy,
}
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
@@ -183,7 +183,7 @@ impl SurfaceStyle {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FillOrStrokeStyle {
- Color(RGBA),
+ Color(RgbaLegacy),
LinearGradient(LinearGradientStyle),
RadialGradient(RadialGradientStyle),
Surface(SurfaceStyle),