--- original +++ modified @@ -213,6 +213,10 @@ /// Whether accessibility is active in this layout. /// (Note: this is a temporary field which will be replaced with an optional accessibility tree member.) accessibility_active: Cell, + + /// The current page zoom for rendering (used by embedded webviews). + /// When this changes, we need to trigger a new stacking context tree build. + page_zoom_for_rendering: Cell>, } pub struct LayoutFactoryImpl(); @@ -253,12 +257,25 @@ fn set_viewport_details(&mut self, viewport_details: ViewportDetails) -> bool { let device = self.stylist.device_mut(); let device_pixel_ratio = Scale::new(viewport_details.hidpi_scale_factor.get()); - if device.viewport_size() == viewport_details.size && - device.device_pixel_ratio() == device_pixel_ratio - { - return false; + + // Check if page_zoom_for_rendering changed (for embedded webviews) + let zoom_changed = + self.page_zoom_for_rendering.get() != viewport_details.page_zoom_for_rendering; + if zoom_changed { + self.page_zoom_for_rendering + .set(viewport_details.page_zoom_for_rendering); + // Need to rebuild stacking context tree to apply the new zoom transform + self.need_new_stacking_context_tree.set(true); + self.need_new_display_list.set(true); } + let size_changed = device.viewport_size() != viewport_details.size || + device.device_pixel_ratio() != device_pixel_ratio; + + if !size_changed { + return zoom_changed; + } + device.set_viewport_size(viewport_details.size); device.set_device_pixel_ratio(device_pixel_ratio); self.device_has_changed = true; @@ -818,6 +835,7 @@ paint_timing_handler: Default::default(), user_stylesheets: config.user_stylesheets, accessibility_active: Cell::new(config.accessibility_active), + page_zoom_for_rendering: Cell::new(config.viewport_details.page_zoom_for_rendering), } }