mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update Stylo to 2023-07-23 (#31437)
* Update Stylo to 2023-07-23 * to_shmem should be local when working with Stylo * Fixup for https://phabricator.services.mozilla.com/D180769 * Fixup for https://phabricator.services.mozilla.com/D181125 * Fixup for https://phabricator.services.mozilla.com/D181162 * Fixup for https://phabricator.services.mozilla.com/D181798 * Fixup for https://phabricator.services.mozilla.com/D182514 * Fixup for https://phabricator.services.mozilla.com/D182539 * Update test expectations
This commit is contained in:
parent
6eb96290fa
commit
31cfaf290d
41 changed files with 171 additions and 1208 deletions
|
@ -969,12 +969,19 @@ impl Fragment {
|
|||
let display_item = match gradient {
|
||||
Gradient::Linear {
|
||||
ref direction,
|
||||
ref color_interpolation_method,
|
||||
ref items,
|
||||
ref repeating,
|
||||
compat_mode: _,
|
||||
} => {
|
||||
let (gradient, stops) =
|
||||
gradient::linear(style, placement.tile_size, items, *direction, *repeating);
|
||||
let (gradient, stops) = gradient::linear(
|
||||
style,
|
||||
placement.tile_size,
|
||||
items,
|
||||
*direction,
|
||||
color_interpolation_method,
|
||||
*repeating,
|
||||
);
|
||||
let item = webrender_api::GradientDisplayItem {
|
||||
gradient,
|
||||
bounds: placement.bounds.to_f32_px(),
|
||||
|
@ -987,6 +994,7 @@ impl Fragment {
|
|||
Gradient::Radial {
|
||||
ref shape,
|
||||
ref position,
|
||||
ref color_interpolation_method,
|
||||
ref items,
|
||||
ref repeating,
|
||||
compat_mode: _,
|
||||
|
@ -997,6 +1005,7 @@ impl Fragment {
|
|||
items,
|
||||
shape,
|
||||
position,
|
||||
color_interpolation_method,
|
||||
*repeating,
|
||||
);
|
||||
let item = webrender_api::RadialGradientDisplayItem {
|
||||
|
@ -1226,18 +1235,26 @@ impl Fragment {
|
|||
Image::Gradient(ref gradient) => match **gradient {
|
||||
Gradient::Linear {
|
||||
ref direction,
|
||||
ref color_interpolation_method,
|
||||
ref items,
|
||||
ref repeating,
|
||||
compat_mode: _,
|
||||
} => {
|
||||
let (wr_gradient, linear_stops) =
|
||||
gradient::linear(style, border_image_size, items, *direction, *repeating);
|
||||
let (wr_gradient, linear_stops) = gradient::linear(
|
||||
style,
|
||||
border_image_size,
|
||||
items,
|
||||
*direction,
|
||||
color_interpolation_method,
|
||||
*repeating,
|
||||
);
|
||||
stops = linear_stops;
|
||||
NinePatchBorderSource::Gradient(wr_gradient)
|
||||
},
|
||||
Gradient::Radial {
|
||||
ref shape,
|
||||
ref position,
|
||||
ref color_interpolation_method,
|
||||
ref items,
|
||||
ref repeating,
|
||||
compat_mode: _,
|
||||
|
@ -1248,6 +1265,7 @@ impl Fragment {
|
|||
items,
|
||||
shape,
|
||||
position,
|
||||
color_interpolation_method,
|
||||
*repeating,
|
||||
);
|
||||
stops = radial_stops;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use euclid::default::{Point2D, Size2D, Vector2D};
|
||||
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};
|
||||
|
@ -240,6 +241,7 @@ pub fn linear(
|
|||
size: Size2D<Au>,
|
||||
stops: &[GradientItem<Color, LengthPercentage>],
|
||||
direction: LineDirection,
|
||||
_color_interpolation_method: &ColorInterpolationMethod,
|
||||
repeating: bool,
|
||||
) -> (Gradient, Vec<GradientStop>) {
|
||||
use style::values::specified::position::HorizontalPositionKeyword::*;
|
||||
|
@ -307,6 +309,7 @@ pub fn radial(
|
|||
stops: &[GradientItem<Color, LengthPercentage>],
|
||||
shape: &EndingShape,
|
||||
center: &Position,
|
||||
_color_interpolation_method: &ColorInterpolationMethod,
|
||||
repeating: bool,
|
||||
) -> (RadialGradient, Vec<GradientStop>) {
|
||||
let center = Point2D::new(
|
||||
|
|
|
@ -2,6 +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 style::color::mix::ColorInterpolationMethod;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::image::{EndingShape, Gradient, LineDirection};
|
||||
use style::values::computed::{Color, Length, LengthPercentage, Position};
|
||||
|
@ -18,12 +19,14 @@ pub(super) fn build(
|
|||
Gradient::Linear {
|
||||
ref items,
|
||||
ref direction,
|
||||
ref color_interpolation_method,
|
||||
ref repeating,
|
||||
compat_mode: _,
|
||||
} => build_linear(
|
||||
style,
|
||||
items,
|
||||
direction,
|
||||
color_interpolation_method,
|
||||
if *repeating {
|
||||
wr::ExtendMode::Repeat
|
||||
} else {
|
||||
|
@ -35,6 +38,7 @@ pub(super) fn build(
|
|||
Gradient::Radial {
|
||||
ref shape,
|
||||
ref position,
|
||||
ref color_interpolation_method,
|
||||
ref items,
|
||||
ref repeating,
|
||||
compat_mode: _,
|
||||
|
@ -43,6 +47,7 @@ pub(super) fn build(
|
|||
items,
|
||||
shape,
|
||||
position,
|
||||
color_interpolation_method,
|
||||
if *repeating {
|
||||
wr::ExtendMode::Repeat
|
||||
} else {
|
||||
|
@ -60,6 +65,7 @@ pub(super) fn build_linear(
|
|||
style: &ComputedValues,
|
||||
items: &[GradientItem<Color, LengthPercentage>],
|
||||
line_direction: &LineDirection,
|
||||
_color_interpolation_method: &ColorInterpolationMethod,
|
||||
extend_mode: wr::ExtendMode,
|
||||
layer: &super::background::BackgroundLayer,
|
||||
builder: &mut super::DisplayListBuilder,
|
||||
|
@ -161,6 +167,7 @@ pub(super) fn build_radial(
|
|||
items: &[GradientItem<Color, LengthPercentage>],
|
||||
shape: &EndingShape,
|
||||
center: &Position,
|
||||
_color_interpolation_method: &ColorInterpolationMethod,
|
||||
extend_mode: wr::ExtendMode,
|
||||
layer: &super::background::BackgroundLayer,
|
||||
builder: &mut super::DisplayListBuilder,
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
use dom_struct::dom_struct;
|
||||
use servo_arc::Arc;
|
||||
use style::shared_lock::{Locked, SharedRwLock};
|
||||
use style::stylesheets::CssRules as StyleCssRules;
|
||||
use style::stylesheets::{CssRuleTypes, CssRules as StyleCssRules};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRule_Binding::CSSRuleMethods;
|
||||
use crate::dom::bindings::error::{ErrorResult, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
|
@ -67,7 +68,10 @@ impl CSSGroupingRuleMethods for CSSGroupingRule {
|
|||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-insertrule
|
||||
fn InsertRule(&self, rule: DOMString, index: u32) -> Fallible<u32> {
|
||||
self.rulelist().insert_rule(&rule, index, /* nested */ true)
|
||||
// TODO: this should accumulate the rule types of all ancestors.
|
||||
let containing_rule_types = CssRuleTypes::from_bits(self.cssrule.Type().into());
|
||||
self.rulelist()
|
||||
.insert_rule(&rule, index, containing_rule_types)
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-deleterule
|
||||
|
|
|
@ -8,7 +8,7 @@ use dom_struct::dom_struct;
|
|||
use servo_arc::Arc;
|
||||
use style::shared_lock::Locked;
|
||||
use style::stylesheets::{
|
||||
AllowImportRules, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
|
||||
AllowImportRules, CssRuleTypes, CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError,
|
||||
StylesheetLoader as StyleStylesheetLoader,
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,12 @@ impl CSSRuleList {
|
|||
|
||||
/// Should only be called for CssRules-backed rules. Use append_lazy_rule
|
||||
/// for keyframes-backed rules.
|
||||
pub fn insert_rule(&self, rule: &str, idx: u32, nested: bool) -> Fallible<u32> {
|
||||
pub fn insert_rule(
|
||||
&self,
|
||||
rule: &str,
|
||||
idx: u32,
|
||||
containing_rule_types: CssRuleTypes,
|
||||
) -> Fallible<u32> {
|
||||
let css_rules = if let RulesSource::Rules(ref rules) = self.rules {
|
||||
rules
|
||||
} else {
|
||||
|
@ -117,7 +122,7 @@ impl CSSRuleList {
|
|||
rule,
|
||||
&parent_stylesheet.contents,
|
||||
index,
|
||||
nested,
|
||||
containing_rule_types,
|
||||
loader.as_ref().map(|l| l as &dyn StyleStylesheetLoader),
|
||||
AllowImportRules::Yes,
|
||||
)?;
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::mem;
|
|||
|
||||
use cssparser::{Parser as CssParser, ParserInput as CssParserInput, ToCss};
|
||||
use dom_struct::dom_struct;
|
||||
use selectors::parser::SelectorList;
|
||||
use selectors::parser::{ParseRelative, SelectorList};
|
||||
use servo_arc::Arc;
|
||||
use style::selector_parser::SelectorParser;
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
|
@ -111,7 +111,9 @@ impl CSSStyleRuleMethods for CSSStyleRule {
|
|||
};
|
||||
let mut css_parser = CssParserInput::new(&*value);
|
||||
let mut css_parser = CssParser::new(&mut css_parser);
|
||||
if let Ok(mut s) = SelectorList::parse(&parser, &mut css_parser) {
|
||||
// TODO: Maybe allow setting relative selectors from the OM, if we're in a nested style
|
||||
// rule?
|
||||
if let Ok(mut s) = SelectorList::parse(&parser, &mut css_parser, ParseRelative::No) {
|
||||
// This mirrors what we do in CSSStyleOwner::mutate_associated_block.
|
||||
let mut guard = self.cssrule.shared_lock().write();
|
||||
let stylerule = self.stylerule.write_with(&mut guard);
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::cell::Cell;
|
|||
use dom_struct::dom_struct;
|
||||
use servo_arc::Arc;
|
||||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::Stylesheet as StyleStyleSheet;
|
||||
use style::stylesheets::{CssRuleTypes, Stylesheet as StyleStyleSheet};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods;
|
||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
|
@ -129,7 +129,7 @@ impl CSSStyleSheetMethods for CSSStyleSheet {
|
|||
return Err(Error::Security);
|
||||
}
|
||||
self.rulelist()
|
||||
.insert_rule(&rule, index, /* nested */ false)
|
||||
.insert_rule(&rule, index, CssRuleTypes::default())
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-deleterule
|
||||
|
|
|
@ -31,7 +31,8 @@ use script_layout_interface::{
|
|||
};
|
||||
use script_traits::{DocumentActivity, UntrustedNodeAddress};
|
||||
use selectors::matching::{
|
||||
matches_selector_list, MatchingContext, MatchingMode, NeedsSelectorFlags,
|
||||
matches_selector_list, IgnoreNthChildForInvalidation, MatchingContext, MatchingMode,
|
||||
NeedsSelectorFlags,
|
||||
};
|
||||
use selectors::parser::SelectorList;
|
||||
use servo_arc::Arc;
|
||||
|
@ -480,6 +481,7 @@ impl<'a> Iterator for QuerySelectorIterator {
|
|||
&mut nth_index_cache,
|
||||
node.owner_doc().quirks_mode(),
|
||||
NeedsSelectorFlags::No,
|
||||
IgnoreNthChildForInvalidation::No,
|
||||
);
|
||||
if let Some(element) = DomRoot::downcast(node) {
|
||||
if matches_selector_list(selectors, &element, &mut ctx) {
|
||||
|
@ -976,6 +978,7 @@ impl Node {
|
|||
&mut nth_index_cache,
|
||||
doc.quirks_mode(),
|
||||
NeedsSelectorFlags::No,
|
||||
IgnoreNthChildForInvalidation::No,
|
||||
);
|
||||
Ok(self
|
||||
.traverse_preorder(ShadowIncluding::No)
|
||||
|
|
|
@ -18,7 +18,7 @@ keyboard-types = { workspace = true }
|
|||
lazy_static = { workspace = true }
|
||||
log = { workspace = true }
|
||||
msg = { workspace = true }
|
||||
num-derive = "0.3"
|
||||
num-derive = "0.4"
|
||||
num-traits = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
servo_url = { path = "../../url" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue