Commit c4db0322 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Fix raster-scale regression in child widgets

This CL fixes a regression introduced in https://crrev.com/f888178b082f.
In that CL, we enabled the "external" page scale factor propagation from
the top level frame, that previously occurred only for OOPIFs, to also
propagate to nested widgets like GuestViews and Portals. When an
UpdateVisualProperties call is made on a child frame, we now update the
external scale factor on these widgets. For the top level frame, we
added a step to reset the external page scale factor; a top-level frame
should never have an external scale (since it's top level, it has no
parent which could scale it).

However, the CL above made a mistake by also resetting the "from
mainframe" page_scale_factor and is_pinch_gesture_active for the top-
level frame. This is a mistake because these values are not exclusive to
child frames like the external PSF. These values are used to decide to
whether to propagate the PSF to child frames after a visual update; by
resetting it to 1, when the PSF really was reset to 1, we'd avoid
propagating that fact to the child frames, leaving them rastered at the
previous scale.

This CL removes the reset of these members to fix the issue. We also add
comments and rename them to make their operation clearer.

Bug: 1115900
Change-Id: I055abbe37cb3432ff85ef597ce89248023cd9be7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363810Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800186}
parent c39a19d3
...@@ -653,14 +653,12 @@ void WebFrameWidgetBase::UpdateVisualProperties( ...@@ -653,14 +653,12 @@ void WebFrameWidgetBase::UpdateVisualProperties(
NotifyPageScaleFactorChanged(visual_properties.page_scale_factor, NotifyPageScaleFactorChanged(visual_properties.page_scale_factor,
visual_properties.is_pinch_gesture_active); visual_properties.is_pinch_gesture_active);
} else { } else {
// Ensure scale factors used in nested widgets are reset to their default // Ensure the external scale factor in top-level widgets is reset as it may
// values, they may be leftover from when a widget was nested and was // be leftover from when a widget was nested and was promoted to top level
// promoted to top level (e.g. portal activation). // (e.g. portal activation).
widget_base_->LayerTreeHost()->SetExternalPageScaleFactor( widget_base_->LayerTreeHost()->SetExternalPageScaleFactor(
1.f, 1.f,
/*is_pinch_gesture_active=*/false); /*is_pinch_gesture_active=*/false);
page_scale_factor_from_mainframe_ = 1.f;
is_pinch_gesture_active_from_mainframe_ = false;
} }
} }
...@@ -1041,11 +1039,11 @@ bool WebFrameWidgetBase::IsFullscreenGranted() { ...@@ -1041,11 +1039,11 @@ bool WebFrameWidgetBase::IsFullscreenGranted() {
} }
bool WebFrameWidgetBase::PinchGestureActiveInMainFrame() { bool WebFrameWidgetBase::PinchGestureActiveInMainFrame() {
return is_pinch_gesture_active_from_mainframe_; return is_pinch_gesture_active_in_mainframe_;
} }
float WebFrameWidgetBase::PageScaleInMainFrame() { float WebFrameWidgetBase::PageScaleInMainFrame() {
return page_scale_factor_from_mainframe_; return page_scale_factor_in_mainframe_;
} }
void WebFrameWidgetBase::UpdateSurfaceAndScreenInfo( void WebFrameWidgetBase::UpdateSurfaceAndScreenInfo(
...@@ -1992,8 +1990,8 @@ void WebFrameWidgetBase::NotifyPageScaleFactorChanged( ...@@ -1992,8 +1990,8 @@ void WebFrameWidgetBase::NotifyPageScaleFactorChanged(
bool is_pinch_gesture_active) { bool is_pinch_gesture_active) {
// Store the value to give to any new RemoteFrame that will be created as a // Store the value to give to any new RemoteFrame that will be created as a
// descendant of this widget. // descendant of this widget.
page_scale_factor_from_mainframe_ = page_scale_factor; page_scale_factor_in_mainframe_ = page_scale_factor;
is_pinch_gesture_active_from_mainframe_ = is_pinch_gesture_active; is_pinch_gesture_active_in_mainframe_ = is_pinch_gesture_active;
// Push the page scale factor down to any child RemoteFrames. // Push the page scale factor down to any child RemoteFrames.
// TODO(danakj): This ends up setting the page scale factor in the // TODO(danakj): This ends up setting the page scale factor in the
// RenderWidgetHost of the child WebFrameWidgetBase, so that it can bounce // RenderWidgetHost of the child WebFrameWidgetBase, so that it can bounce
......
...@@ -582,11 +582,11 @@ class CORE_EXPORT WebFrameWidgetBase ...@@ -582,11 +582,11 @@ class CORE_EXPORT WebFrameWidgetBase
// complicated inheritance structures. // complicated inheritance structures.
std::unique_ptr<WidgetBase> widget_base_; std::unique_ptr<WidgetBase> widget_base_;
// The last seen page scale state, which comes from the main frame and is // The last seen page scale state, which comes from the main frame if we're
// propagated through the RenderWidget tree. This state is passed to any new // in a child frame. This state is propagated through the RenderWidget tree
// child RenderWidget. // passed to any new child RenderWidget.
float page_scale_factor_from_mainframe_ = 1.f; float page_scale_factor_in_mainframe_ = 1.f;
bool is_pinch_gesture_active_from_mainframe_ = false; bool is_pinch_gesture_active_in_mainframe_ = false;
private: private:
void CancelDrag(); void CancelDrag();
......
...@@ -318,8 +318,8 @@ void WebViewFrameWidget::SetPageScaleStateAndLimits( ...@@ -318,8 +318,8 @@ void WebViewFrameWidget::SetPageScaleStateAndLimits(
// If page scale hasn't changed, then just return without notifying // If page scale hasn't changed, then just return without notifying
// the remote frames. // the remote frames.
if (page_scale_factor == page_scale_factor_from_mainframe_ && if (page_scale_factor == page_scale_factor_in_mainframe_ &&
is_pinch_gesture_active == is_pinch_gesture_active_from_mainframe_) { is_pinch_gesture_active == is_pinch_gesture_active_in_mainframe_) {
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment