Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport several style changes from Gecko (5) #30099

Merged
merged 87 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift click to select a range
2f93c84
style: Simplify selector flag setting now that flag setting is atomic
emilio Jun 18, 2023
a1c8341
Further changes required by Servo
Loirooriol Jun 18, 2023
a7fd3c3
style: Support media queries for dynamic-range and video-dynamic-range
bradwerth Jun 18, 2023
36c15d5
style: Remove :-moz-lwtheme-{brighttext,darktext}
emilio Jun 18, 2023
84b25a8
style: layout.css.moz-locale-dir.content.enabled
emilio Jun 18, 2023
97945ee
style: Really honor background-color: transparent in HCM even for for…
emilio Jun 18, 2023
794f69e
style: Ignore unchanged property for scroll-linked effect detector
emilio Jun 18, 2023
f399f52
style: Allow to derive Parse/ToCss/SpecifiedValueInfo on bitflags
emilio Jun 18, 2023
a9afa00
Further changes required by Servo
Loirooriol Jun 18, 2023
5623255
style: Implement parsing / serialization for container{,-type,-name} …
emilio Jun 18, 2023
0613343
style: Remove assert that doesn't hold for text-decorations because o…
emilio Jun 18, 2023
e1695f7
style: Migrate `<th>` `text-align` behaviour from presentation hint t…
dshin-moz Jun 18, 2023
e63b68a
style: Deduplicate TokenList values faster
emilio Jun 18, 2023
73f3b17
style: Inherit used color-scheme from embedder <browser> elements
emilio Jun 18, 2023
01e1801
Further changes required by Servo
Loirooriol Jun 18, 2023
f789b26
style: Add basic @container rule parsing and boilerplate
emilio Jun 18, 2023
312ace6
Further changes required by Servo
Loirooriol Jun 18, 2023
6108471
style: Tweak cascade priority to split writing-mode and font properties
emilio Jun 18, 2023
7f203f5
style: Implement new {small,large,dynamic} viewport units
hiikezoe Jun 19, 2023
e2dc8c8
Further changes required by Servo
Loirooriol Aug 10, 2023
77982b7
style: Implement new *vi and *vb units
hiikezoe Jun 19, 2023
7304624
style: Implement prefers-contrast: custom and let prefers-contrast ri…
emilio Aug 10, 2023
1398f4b
style: Join servo style threads during shutdown
mystor Aug 10, 2023
81a5f34
Further changes required by Servo
Loirooriol Aug 10, 2023
7859ac3
style: Fix visited handling after bug 1763750
emilio Aug 10, 2023
fc8fa07
style: Clean-up viewport unit resolution a bit
emilio Aug 10, 2023
1a58ea3
style: Implement `contain: inline-size`
dshin-moz Aug 10, 2023
af87128
style: Simplify media query evaluation code a bit
emilio Aug 10, 2023
913edb3
Further changes required by Servo
Loirooriol Aug 10, 2023
a9e9174
style: Move transitions and animations to nsStyleUIReset
emilio Aug 10, 2023
6faef7f
Further changes required by Servo
Loirooriol Aug 11, 2023
4b1b748
style: Make media feature evaluation take a computed::Context
emilio Aug 11, 2023
a1bb844
Further changes required by Servo
Loirooriol Aug 11, 2023
4ca0a49
style: Add scroll() to animation-timeline for style system
BorisChiou Aug 11, 2023
24aa581
style: Tweak contain bitflag definition order to avoid static constru…
emilio Aug 11, 2023
e8c9b16
style: Move some of the media query code to a more generic queries mo…
emilio Aug 11, 2023
90bc74d
Further changes required by Servo
Loirooriol Aug 11, 2023
93a217a
style: cleanup animation-name
emilio Aug 11, 2023
8325a56
Further changes required by Servo
Loirooriol Aug 11, 2023
f8a7f88
style: Add support for parsing container-query-specific features
emilio Aug 11, 2023
3edc295
Further changes required by Servo
Loirooriol Aug 11, 2023
62f1776
style: Introduce Optional<T> to represent optional values in the styl…
emilio Aug 11, 2023
eab1292
style: Fix insertRule with layer statements before imports
emilio Aug 11, 2023
6551c59
style: Factor out parsing the query feature name
emilio Aug 11, 2023
fb1b918
style: Refactor media feature expression representation in preparatio…
emilio Aug 11, 2023
91a4c5d
style: Implement media feature expression multi-range syntax
emilio Aug 11, 2023
843a33e
style: Remove proton places tooltip code
emilio Aug 11, 2023
d7b65e5
style: Simplify selector flags setup even more
emilio Aug 11, 2023
42d82e8
Further changes required by Servo
Loirooriol Aug 11, 2023
a1aab08
style: Track @container condition id in style rules
emilio Aug 11, 2023
2d40b8f
Further changes required by Servo
Loirooriol Aug 14, 2023
0da9a8f
style: Fix layer statement rules with multiple layer names
emilio Aug 12, 2023
6b769f0
style: Implement piecewise linear function
dshin-moz Aug 12, 2023
6a4a80a
style: Convert specified value tests to compile-time tests
emilio Aug 14, 2023
9384831
Further changes required by Servo
Loirooriol Aug 15, 2023
16ceb76
style: Move size of tests to compile-time tests in the style crate
emilio Aug 14, 2023
0142678
Further changes required by Servo
Loirooriol Aug 14, 2023
49cb97b
style: Lint and 32-bit build fix.
emilio Aug 14, 2023
2c0cb1e
style: Implement 'update' media feature
autumnontape Aug 14, 2023
ccac12c
style: Clean up unused -moz-window-shadow values
emilio Aug 14, 2023
b781a51
style: More container queries plumbing
emilio Aug 14, 2023
b9e40d7
Further changes required by Servo
Loirooriol Aug 14, 2023
3e47dfc
style: Ensure options in listbox selects are not stacking contexts by…
emilio Aug 14, 2023
b3a2972
style: Implement overflow-clip-margin: <length>
emilio Aug 14, 2023
be2274d
style: Change order of container shorthand
Loirooriol Aug 14, 2023
c50b687
style: Make modal dialog code more generic, and make it apply to full…
emilio Aug 14, 2023
376dd69
style: Cache computed styles objects display: none subtrees
emilio Aug 14, 2023
e3e5123
Further changes required by Servo
Loirooriol Aug 14, 2023
e1afd4e
style: Parse scroll-snap-stop style and propagate it to APZ side
hiikezoe Aug 14, 2023
93dc9d5
style: Update color-mix() syntax to match the current spec
emilio Aug 14, 2023
4cfcfff
Further changes required by Servo
Loirooriol Aug 14, 2023
a091dbb
style: Make the color interpolation code more generic
emilio Aug 14, 2023
a1180de
style: Implement more color-mix() color-spaces
emilio Aug 14, 2023
8b60fbb
style: Fix color-mix() percentage normalization
emilio Aug 14, 2023
2506fe4
style: Fix hue adjustment to match the spec
emilio Aug 14, 2023
bea136c
style: Do hue interpolations in degrees rather than radians. r=barret
emilio Aug 14, 2023
479cc92
style: Improve Percentage -> LengthPercentage conversion
emilio Aug 14, 2023
f5f76a5
style: Remove some dead vibrancy code
emilio Aug 14, 2023
0f28c2e
style: Fix warnings about whitelist/blocklist functions being depreca…
glandium Aug 14, 2023
3b27c92
style: Update style to arrayvec 0.7
glandium Aug 14, 2023
c3b460b
style: Update style to uluru 3.0
glandium Aug 14, 2023
1e93d5e
style: Remove -moz-scrollbar-thumb-proportional
emilio Aug 14, 2023
e8fe491
style: Use ColorMix for interpolated colors in the computed style rat…
emilio Aug 14, 2023
2c74184
Further changes required by Servo
Loirooriol Aug 15, 2023
87a0162
style: Add an input-region-margin to widgets, and implement it on Linux
emilio Aug 14, 2023
09f9486
Avoid complaints from ./mach test-tidy
Loirooriol Aug 15, 2023
0e8f59d
Update test expectations
Loirooriol Aug 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions components/atoms/static_atoms.txt
Original file line number Diff line number Diff line change
@@ -1,3 1,4 @@
-moz-content-preferred-color-scheme
-moz-gtk-csd-close-button-position
-moz-gtk-csd-maximize-button-position
-moz-gtk-csd-menu-radius
Expand All @@ -12,7 13,9 @@ animationcancel
animationend
animationiteration
animationstart
aspect-ratio
beforeunload
block-size
button
canplay
canplaythrough
Expand Down Expand Up @@ -50,11 53,13 @@ fullscreenchange
fullscreenerror
gattserverdisconnected
hashchange
height
hidden
icecandidate
iceconnectionstatechange
icegatheringstatechange
image
inline-size
input
inputsourceschange
invalid
Expand Down Expand Up @@ -82,6 87,7 @@ none
number
onchange
open
orientation
pagehide
pageshow
password
Expand Down
5 changes: 5 additions & 0 deletions components/derive_common/cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 373,11 @@ pub fn to_css_identifier(mut camel_case: &str) -> String {
result
}

/// Transforms foo-bar to FOO_BAR.
pub fn to_scream_case(css_case: &str) -> String {
css_case.to_uppercase().replace('-', "_")
}

/// Given "FooBar", returns "Foo" and sets `camel_case` to "Bar".
fn split_camel_segment<'input>(camel_case: &mut &'input str) -> Option<&'input str> {
let index = match camel_case.chars().next() {
Expand Down
4 changes: 1 addition & 3 deletions components/layout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 44,7 @@ servo_atoms = { path = "../atoms" }
servo_config = { path = "../config" }
servo_geometry = { path = "../geometry" }
servo_url = { path = "../url" }
size_of_test = { path = "../size_of_test" }
smallvec = { workspace = true, features = ["union"] }
style = { path = "../style", features = ["servo"] }
style_traits = { path = "../style_traits" }
Expand All @@ -52,6 53,3 @@ unicode-script = { workspace = true }
webrender_api = { workspace = true }
xi-unicode = { workspace = true }

[dev-dependencies]
size_of_test = { path = "../size_of_test" }

21 changes: 12 additions & 9 deletions components/layout/display_list/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 653,7 @@ impl Fragment {
absolute_bounds: Rect<Au>,
) {
let background = style.get_background();
let background_color = style.resolve_color(background.background_color);
let background_color = style.resolve_color(background.background_color.clone());
// XXXManishearth the below method should ideally use an iterator over
// backgrounds
self.build_display_list_for_background_if_applicable_with_background(
Expand Down Expand Up @@ -1037,7 1037,9 @@ impl Fragment {
webrender_api::BoxShadowDisplayItem {
common: items::empty_common_item_properties(),
box_bounds: absolute_bounds.to_layout(),
color: style.resolve_color(box_shadow.base.color).to_layout(),
color: style
.resolve_color(box_shadow.base.color.clone())
.to_layout(),
offset: LayoutVector2D::new(
box_shadow.base.horizontal.px(),
box_shadow.base.vertical.px(),
Expand Down Expand Up @@ -1083,10 1085,10 @@ impl Fragment {

let border_style_struct = style.get_border();
let mut colors = SideOffsets2D::new(
border_style_struct.border_top_color,
border_style_struct.border_right_color,
border_style_struct.border_bottom_color,
border_style_struct.border_left_color,
border_style_struct.border_top_color.clone(),
border_style_struct.border_right_color.clone(),
border_style_struct.border_bottom_color.clone(),
border_style_struct.border_left_color.clone(),
);
let mut border_style = SideOffsets2D::new(
border_style_struct.border_top_style,
Expand Down Expand Up @@ -1316,7 1318,7 @@ impl Fragment {

// Append the outline to the display list.
let color = style
.resolve_color(style.get_outline().outline_color)
.resolve_color(style.get_outline().outline_color.clone())
.to_layout();
let base = state.create_base_display_item(
clip,
Expand Down Expand Up @@ -1451,7 1453,8 @@ impl Fragment {
// TODO: Allow non-text fragments to be selected too.
if scanned_text_fragment_info.selected() {
let style = self.selected_style();
let background_color = style.resolve_color(style.get_background().background_color);
let background_color =
style.resolve_color(style.get_background().background_color.clone());
let base = state.create_base_display_item(
stacking_relative_border_box,
self.node,
Expand Down Expand Up @@ -2055,7 2058,7 @@ impl Fragment {
base: base.clone(),
shadow: webrender_api::Shadow {
offset: LayoutVector2D::new(shadow.horizontal.px(), shadow.vertical.px()),
color: self.style.resolve_color(shadow.color).to_layout(),
color: self.style.resolve_color(shadow.color.clone()).to_layout(),
blur_radius: shadow.blur.px(),
},
},
Expand Down
4 changes: 2 additions & 2 deletions components/layout/display_list/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 86,7 @@ fn convert_gradient_stops(
// Only keep the color stops, discard the color interpolation hints.
let mut stop_items = gradient_items
.iter()
.filter_map(|item| match *item {
.filter_map(|item| match item {
GradientItem::SimpleColorStop(color) => Some(ColorStop {
color,
position: None,
Expand Down Expand Up @@ -191,7 191,7 @@ fn convert_gradient_stops(
assert!(offset.is_finite());
stops.push(GradientStop {
offset: offset,
color: style.resolve_color(stop.color).to_layout(),
color: style.resolve_color(stop.color.clone()).to_layout(),
})
}
stops
Expand Down
7 changes: 7 additions & 0 deletions components/layout/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 158,11 @@ pub struct Fragment {
pub established_reference_frame: Option<ClipScrollNodeIndex>,
}

#[cfg(debug_assertions)]
size_of_test!(Fragment, 176);
#[cfg(not(debug_assertions))]
size_of_test!(Fragment, 152);

impl Serialize for Fragment {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut serializer = serializer.serialize_struct("fragment", 3)?;
Expand Down Expand Up @@ -212,6 217,8 @@ pub enum SpecificFragmentInfo {
TruncatedFragment(Box<TruncatedFragmentInfo>),
}

size_of_test!(SpecificFragmentInfo, 24);

impl SpecificFragmentInfo {
fn restyle_damage(&self) -> RestyleDamage {
let flow = match *self {
Expand Down
2 changes: 2 additions & 0 deletions components/layout/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,8 @@ extern crate log;
extern crate range;
#[macro_use]
extern crate serde;
#[macro_use]
extern crate size_of_test;

#[macro_use]
pub mod layout_debug;
Expand Down
10 changes: 8 additions & 2 deletions components/layout/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 860,7 @@ where
shared: &context.style_context,
thread_local: &mut tlc,
};
let styles = resolve_style(&mut context, element, RuleInclusion::All, None);
let styles = resolve_style(&mut context, element, RuleInclusion::All, None, None);
styles.primary().clone()
}
} else {
Expand Down Expand Up @@ -916,7 916,13 @@ pub fn process_resolved_style_request<'dom>(
thread_local: &mut tlc,
};

let styles = resolve_style(&mut context, element, RuleInclusion::All, pseudo.as_ref());
let styles = resolve_style(
&mut context,
element,
RuleInclusion::All,
pseudo.as_ref(),
None,
);
let style = styles.primary();
let longhand_id = match *property {
PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id,
Expand Down
8 changes: 4 additions & 4 deletions components/layout/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 794,7 @@ fn perform_border_collapse_for_row(
child_table_row
.final_collapsed_borders
.inline
.push_or_set(i, *this_inline_border);
.push_or_set(i, this_inline_border.clone());
if i == 0 {
child_table_row.final_collapsed_borders.inline[i].combine(&table_inline_borders.start);
} else if i 1 == number_of_borders_inline_direction {
Expand All @@ -821,7 821,7 @@ fn perform_border_collapse_for_row(
this_border.combine(&previous_block_borders[i]);
}
},
PreviousBlockCollapsedBorders::FromTable(table_border) => {
PreviousBlockCollapsedBorders::FromTable(ref table_border) => {
this_border.combine(&table_border);
},
}
Expand All @@ -837,7 837,7 @@ fn perform_border_collapse_for_row(
.iter()
.enumerate()
{
let next_block = next_block.push_or_set(i, *this_block_border);
let next_block = next_block.push_or_set(i, this_block_border.clone());
match next_block_borders {
NextBlockCollapsedBorders::FromNextRow(next_block_borders) => {
if next_block_borders.len() > i {
Expand Down Expand Up @@ -1358,7 1358,7 @@ impl<'table> TableCellStyleInfo<'table> {
if background as *const Background == initial.get_background() as *const _ {
return;
}
let background_color = sty.resolve_color(background.background_color);
let background_color = sty.resolve_color(background.background_color.clone());
cell_flow.build_display_list_for_background_if_applicable_with_background(
state,
background,
Expand Down
10 changes: 5 additions & 5 deletions components/layout/table_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 375,7 @@ impl fmt::Debug for TableCellFlow {
}
}

#[derive(Clone, Copy, Debug, Serialize)]
#[derive(Clone, Debug, Serialize)]
pub struct CollapsedBordersForCell {
pub inline_start_border: CollapsedBorder,
pub inline_end_border: CollapsedBorder,
Expand Down Expand Up @@ -494,10 494,10 @@ impl CollapsedBordersForCell {
) {
let logical_border_colors = LogicalMargin::new(
writing_mode,
self.block_start_border.color,
self.inline_end_border.color,
self.block_end_border.color,
self.inline_start_border.color,
self.block_start_border.color.clone(),
self.inline_end_border.color.clone(),
self.block_end_border.color.clone(),
self.inline_start_border.color.clone(),
);
*border_colors = logical_border_colors.to_physical(writing_mode);

Expand Down
Loading