forked from
me.webbeef.org/browser.html
Rewild Your Web
1--- original
2+++ modified
3@@ -213,6 +213,10 @@
4 /// Whether accessibility is active in this layout.
5 /// (Note: this is a temporary field which will be replaced with an optional accessibility tree member.)
6 accessibility_active: Cell<bool>,
7+
8+ /// The current page zoom for rendering (used by embedded webviews).
9+ /// When this changes, we need to trigger a new stacking context tree build.
10+ page_zoom_for_rendering: Cell<Option<f32>>,
11 }
12
13 pub struct LayoutFactoryImpl();
14@@ -253,12 +257,25 @@
15 fn set_viewport_details(&mut self, viewport_details: ViewportDetails) -> bool {
16 let device = self.stylist.device_mut();
17 let device_pixel_ratio = Scale::new(viewport_details.hidpi_scale_factor.get());
18- if device.viewport_size() == viewport_details.size &&
19- device.device_pixel_ratio() == device_pixel_ratio
20- {
21- return false;
22+
23+ // Check if page_zoom_for_rendering changed (for embedded webviews)
24+ let zoom_changed =
25+ self.page_zoom_for_rendering.get() != viewport_details.page_zoom_for_rendering;
26+ if zoom_changed {
27+ self.page_zoom_for_rendering
28+ .set(viewport_details.page_zoom_for_rendering);
29+ // Need to rebuild stacking context tree to apply the new zoom transform
30+ self.need_new_stacking_context_tree.set(true);
31+ self.need_new_display_list.set(true);
32 }
33
34+ let size_changed = device.viewport_size() != viewport_details.size ||
35+ device.device_pixel_ratio() != device_pixel_ratio;
36+
37+ if !size_changed {
38+ return zoom_changed;
39+ }
40+
41 device.set_viewport_size(viewport_details.size);
42 device.set_device_pixel_ratio(device_pixel_ratio);
43 self.device_has_changed = true;
44@@ -818,6 +835,7 @@
45 paint_timing_handler: Default::default(),
46 user_stylesheets: config.user_stylesheets,
47 accessibility_active: Cell::new(config.accessibility_active),
48+ page_zoom_for_rendering: Cell::new(config.viewport_details.page_zoom_for_rendering),
49 }
50 }
51