summaryrefslogtreecommitdiffstats
path: root/servo/components/style/properties/cascade.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /servo/components/style/properties/cascade.rs
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/properties/cascade.rs')
-rw-r--r--servo/components/style/properties/cascade.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/servo/components/style/properties/cascade.rs b/servo/components/style/properties/cascade.rs
index d4d48eaeb8..0f264a9249 100644
--- a/servo/components/style/properties/cascade.rs
+++ b/servo/components/style/properties/cascade.rs
@@ -297,7 +297,7 @@ where
context.style().add_flags(cascade_input_flags);
let using_cached_reset_properties;
- let ignore_colors = !context.builder.device.use_document_colors();
+ let ignore_colors = context.builder.device.forced_colors().is_active();
let mut cascade = Cascade::new(first_line_reparenting, ignore_colors);
let mut declarations = Default::default();
let mut shorthand_cache = ShorthandsWithPropertyReferencesCache::default();
@@ -763,6 +763,11 @@ impl<'b> Cascade<'b> {
if apply!(Zoom) {
self.compute_zoom(context);
+ // NOTE(emilio): This is a bit of a hack, but matches the shipped WebKit and Blink
+ // behavior for now. Ideally, in the future, we have a pass over all
+ // implicitly-or-explicitly-inherited properties that can contain lengths and
+ // re-compute them properly, see https://github.com/w3c/csswg-drafts/issues/9397.
+ self.recompute_font_size_for_zoom_change(&mut context.builder);
}
// Compute font-family.
@@ -1226,8 +1231,6 @@ impl<'b> Cascade<'b> {
/// <svg:text> is not affected by text zoom, and it uses a preshint to disable it. We fix up
/// the struct when this happens by unzooming its contained font values, which will have been
/// zoomed in the parent.
- ///
- /// FIXME(emilio): Why doing this _before_ handling font-size? That sounds wrong.
#[cfg(feature = "gecko")]
fn unzoom_fonts_if_needed(&self, builder: &mut StyleBuilder) {
debug_assert!(self.seen.contains(LonghandId::XTextScale));
@@ -1250,6 +1253,19 @@ impl<'b> Cascade<'b> {
builder.mutate_font().unzoom_fonts(device);
}
+ fn recompute_font_size_for_zoom_change(&self, builder: &mut StyleBuilder) {
+ debug_assert!(self.seen.contains(LonghandId::Zoom));
+ // NOTE(emilio): Intentionally not using the effective zoom here, since all the inherited
+ // zooms are already applied.
+ let zoom = builder.get_box().clone_zoom();
+ let old_size = builder.get_font().clone_font_size();
+ let new_size = old_size.zoom(zoom);
+ if old_size == new_size {
+ return;
+ }
+ builder.mutate_font().set_font_size(new_size);
+ }
+
/// Special handling of font-size: math (used for MathML).
/// https://w3c.github.io/mathml-core/#the-math-script-level-property
/// TODO: Bug: 1548471: MathML Core also does not specify a script min size