Commit 0a918198 authored by Albert J. Wong's avatar Albert J. Wong Committed by Commit Bot

Use consistent naming for VisualProperties arguments.

This is a simple consistency cleanup that makes it
easier to read through all the functions.

Bug: 998273
Change-Id: I2c45fe1befcf4bc72a3c92f63854e65e13d7aa97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1773215Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Albert J. Wong <ajwong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690969}
parent a2819858
...@@ -726,15 +726,17 @@ void RenderWidget::PrepareForClose() { ...@@ -726,15 +726,17 @@ void RenderWidget::PrepareForClose() {
} }
void RenderWidget::OnSynchronizeVisualProperties( void RenderWidget::OnSynchronizeVisualProperties(
const VisualProperties& original_params) { const VisualProperties& visual_properties_from_browser) {
TRACE_EVENT0("renderer", "RenderWidget::OnSynchronizeVisualProperties"); TRACE_EVENT0("renderer", "RenderWidget::OnSynchronizeVisualProperties");
VisualProperties params = original_params; VisualProperties visual_properties = visual_properties_from_browser;
// Web tests can override the device scale factor in the renderer. // Web tests can override the device scale factor in the renderer.
if (device_scale_factor_for_testing_) { if (device_scale_factor_for_testing_) {
params.screen_info.device_scale_factor = device_scale_factor_for_testing_; visual_properties.screen_info.device_scale_factor =
params.compositor_viewport_pixel_size = gfx::ScaleToCeiledSize( device_scale_factor_for_testing_;
params.new_size, params.screen_info.device_scale_factor); visual_properties.compositor_viewport_pixel_size = gfx::ScaleToCeiledSize(
visual_properties.new_size,
visual_properties.screen_info.device_scale_factor);
} }
// Inform the rendering thread of the color space indicating the presence of // Inform the rendering thread of the color space indicating the presence of
...@@ -748,46 +750,47 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -748,46 +750,47 @@ void RenderWidget::OnSynchronizeVisualProperties(
{ {
RenderThreadImpl* render_thread = RenderThreadImpl::current(); RenderThreadImpl* render_thread = RenderThreadImpl::current();
if (render_thread) if (render_thread)
render_thread->SetRenderingColorSpace(params.screen_info.color_space); render_thread->SetRenderingColorSpace(
visual_properties.screen_info.color_space);
} }
if (delegate()) { if (delegate()) {
if (size_ != params.new_size) { if (size_ != visual_properties.new_size) {
// Only hide popups when the size changes. Eg https://crbug.com/761908. // Only hide popups when the size changes. Eg https://crbug.com/761908.
delegate()->CancelPagePopupForWidget(); delegate()->CancelPagePopupForWidget();
} }
if (display_mode_ != params.display_mode) { if (display_mode_ != visual_properties.display_mode) {
display_mode_ = params.display_mode; display_mode_ = visual_properties.display_mode;
delegate()->ApplyNewDisplayModeForWidget(params.display_mode); delegate()->ApplyNewDisplayModeForWidget(visual_properties.display_mode);
} }
bool auto_resize_mode_changed = bool auto_resize_mode_changed =
auto_resize_mode_ != params.auto_resize_enabled; auto_resize_mode_ != visual_properties.auto_resize_enabled;
auto_resize_mode_ = params.auto_resize_enabled; auto_resize_mode_ = visual_properties.auto_resize_enabled;
min_size_for_auto_resize_ = params.min_size_for_auto_resize; min_size_for_auto_resize_ = visual_properties.min_size_for_auto_resize;
max_size_for_auto_resize_ = params.max_size_for_auto_resize; max_size_for_auto_resize_ = visual_properties.max_size_for_auto_resize;
if (auto_resize_mode_) { if (auto_resize_mode_) {
gfx::Size min_auto_size = min_size_for_auto_resize_; gfx::Size min_auto_size = min_size_for_auto_resize_;
gfx::Size max_auto_size = max_size_for_auto_resize_; gfx::Size max_auto_size = max_size_for_auto_resize_;
if (compositor_deps_->IsUseZoomForDSFEnabled()) { if (compositor_deps_->IsUseZoomForDSFEnabled()) {
min_auto_size = gfx::ScaleToCeiledSize( min_auto_size = gfx::ScaleToCeiledSize(
min_auto_size, params.screen_info.device_scale_factor); min_auto_size, visual_properties.screen_info.device_scale_factor);
max_auto_size = gfx::ScaleToCeiledSize( max_auto_size = gfx::ScaleToCeiledSize(
max_auto_size, params.screen_info.device_scale_factor); max_auto_size, visual_properties.screen_info.device_scale_factor);
} }
delegate()->ApplyAutoResizeLimitsForWidget(min_auto_size, max_auto_size); delegate()->ApplyAutoResizeLimitsForWidget(min_auto_size, max_auto_size);
} else if (auto_resize_mode_changed) { } else if (auto_resize_mode_changed) {
delegate()->DisableAutoResizeForWidget(); delegate()->DisableAutoResizeForWidget();
if (params.new_size.IsEmpty()) if (visual_properties.new_size.IsEmpty())
return; return;
} }
browser_controls_shrink_blink_size_ = browser_controls_shrink_blink_size_ =
params.browser_controls_shrink_blink_size; visual_properties.browser_controls_shrink_blink_size;
top_controls_height_ = params.top_controls_height; top_controls_height_ = visual_properties.top_controls_height;
bottom_controls_height_ = params.bottom_controls_height; bottom_controls_height_ = visual_properties.bottom_controls_height;
} }
bool ignore_resize_ipc = false; bool ignore_resize_ipc = false;
...@@ -798,9 +801,9 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -798,9 +801,9 @@ void RenderWidget::OnSynchronizeVisualProperties(
// TODO(danakj): Does the browser actually change DSF inside a web test?? // TODO(danakj): Does the browser actually change DSF inside a web test??
// TODO(danakj): Isn't the display mode check redundant with the fullscreen // TODO(danakj): Isn't the display mode check redundant with the fullscreen
// one? // one?
if (params.is_fullscreen_granted == is_fullscreen_granted_ && if (visual_properties.is_fullscreen_granted == is_fullscreen_granted_ &&
params.display_mode == display_mode_ && visual_properties.display_mode == display_mode_ &&
params.screen_info.device_scale_factor == visual_properties.screen_info.device_scale_factor ==
screen_info_.device_scale_factor) screen_info_.device_scale_factor)
ignore_resize_ipc = true; ignore_resize_ipc = true;
} }
...@@ -816,7 +819,8 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -816,7 +819,8 @@ void RenderWidget::OnSynchronizeVisualProperties(
// things other than the size if we are in sync resize mode - if the emulator // things other than the size if we are in sync resize mode - if the emulator
// is even used in sync resize tests. It probably isn't though, so either way // is even used in sync resize tests. It probably isn't though, so either way
// it'd be good to get the emulator out of this block (maybe by overwriting // it'd be good to get the emulator out of this block (maybe by overwriting
// some of |params| in sync resize mode instead of just skipping the emulator. // some of |visual_properties| in sync resize mode instead of just
// skipping the emulator.
if (!ignore_resize_ipc) { if (!ignore_resize_ipc) {
if (screen_metrics_emulator_) { if (screen_metrics_emulator_) {
// This will call our SynchronizeVisualProperties() method with a // This will call our SynchronizeVisualProperties() method with a
...@@ -825,7 +829,8 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -825,7 +829,8 @@ void RenderWidget::OnSynchronizeVisualProperties(
// bit unclear to do this with the full structure. Anything it does not // bit unclear to do this with the full structure. Anything it does not
// modify can be consumed directly here instead of in // modify can be consumed directly here instead of in
// SynchronizeVisualProperties(). // SynchronizeVisualProperties().
screen_metrics_emulator_->OnSynchronizeVisualProperties(params); screen_metrics_emulator_->OnSynchronizeVisualProperties(
visual_properties);
} else { } else {
if (!delegate()) { if (!delegate()) {
// The main frame controls the page scale factor, from blink. For other // The main frame controls the page scale factor, from blink. For other
...@@ -834,17 +839,18 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -834,17 +839,18 @@ void RenderWidget::OnSynchronizeVisualProperties(
// page scale factor outside the main frame, the compositor does in // page scale factor outside the main frame, the compositor does in
// order to produce its output at the correct scale. // order to produce its output at the correct scale.
layer_tree_view_->SetExternalPageScaleFactor( layer_tree_view_->SetExternalPageScaleFactor(
params.page_scale_factor, params.is_pinch_gesture_active); visual_properties.page_scale_factor,
visual_properties.is_pinch_gesture_active);
// Store the value to give to any new RenderFrameProxy that is // Store the value to give to any new RenderFrameProxy that is
// registered. // registered.
page_scale_factor_from_mainframe_ = params.page_scale_factor; page_scale_factor_from_mainframe_ = visual_properties.page_scale_factor;
// Similarly, only the main frame knows when a pinch gesture is active, // Similarly, only the main frame knows when a pinch gesture is active,
// but this information is needed in subframes so they can throttle // but this information is needed in subframes so they can throttle
// re-rastering in the same manner as the main frame. // re-rastering in the same manner as the main frame.
// |is_pinch_gesture_active| follows the same path to the subframe // |is_pinch_gesture_active| follows the same path to the subframe
// compositor(s) as |page_scale_factor|. // compositor(s) as |page_scale_factor|.
is_pinch_gesture_active_from_mainframe_ = is_pinch_gesture_active_from_mainframe_ =
params.is_pinch_gesture_active; visual_properties.is_pinch_gesture_active;
// Push the page scale factor down to any child RenderWidgets via our // Push the page scale factor down to any child RenderWidgets via our
// child proxy frames. // child proxy frames.
// TODO(danakj): This ends up setting the page scale factor in the // TODO(danakj): This ends up setting the page scale factor in the
...@@ -854,13 +860,14 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -854,13 +860,14 @@ void RenderWidget::OnSynchronizeVisualProperties(
// (such as in RenderViewHost) and distribute it to each frame-hosted // (such as in RenderViewHost) and distribute it to each frame-hosted
// RenderWidget from there. // RenderWidget from there.
for (auto& child_proxy : render_frame_proxies_) { for (auto& child_proxy : render_frame_proxies_) {
child_proxy.OnPageScaleFactorChanged(params.page_scale_factor, child_proxy.OnPageScaleFactorChanged(
params.is_pinch_gesture_active); visual_properties.page_scale_factor,
visual_properties.is_pinch_gesture_active);
} }
} }
gfx::Size old_visible_viewport_size = visible_viewport_size_; gfx::Size old_visible_viewport_size = visible_viewport_size_;
SynchronizeVisualProperties(params); SynchronizeVisualProperties(visual_properties);
if (old_visible_viewport_size != visible_viewport_size_) { if (old_visible_viewport_size != visible_viewport_size_) {
for (auto& render_frame : render_frames_) for (auto& render_frame : render_frames_)
render_frame.ResetHasScrolledFocusedEditableIntoView(); render_frame.ResetHasScrolledFocusedEditableIntoView();
...@@ -872,7 +879,7 @@ void RenderWidget::OnSynchronizeVisualProperties( ...@@ -872,7 +879,7 @@ void RenderWidget::OnSynchronizeVisualProperties(
// when the focused node is inside an OOPIF. This code path where // when the focused node is inside an OOPIF. This code path where
// scroll_focused_node_into_view is set is used only for WebView, crbug // scroll_focused_node_into_view is set is used only for WebView, crbug
// 939118 tracks fixing webviews to not use scroll_focused_node_into_view. // 939118 tracks fixing webviews to not use scroll_focused_node_into_view.
if (delegate() && params.scroll_focused_node_into_view) if (delegate() && visual_properties.scroll_focused_node_into_view)
delegate()->ScrollFocusedNodeIntoViewForWidget(); delegate()->ScrollFocusedNodeIntoViewForWidget();
} }
...@@ -1617,28 +1624,29 @@ void RenderWidget::UpdateZoom(double zoom_level) { ...@@ -1617,28 +1624,29 @@ void RenderWidget::UpdateZoom(double zoom_level) {
plugin.OnZoomLevelChanged(zoom_level); plugin.OnZoomLevelChanged(zoom_level);
} }
void RenderWidget::SynchronizeVisualProperties(const VisualProperties& params) { void RenderWidget::SynchronizeVisualProperties(
const VisualProperties& visual_properties) {
gfx::Size new_compositor_viewport_pixel_size = gfx::Size new_compositor_viewport_pixel_size =
params.auto_resize_enabled visual_properties.auto_resize_enabled
? gfx::ScaleToCeiledSize(size_, ? gfx::ScaleToCeiledSize(
params.screen_info.device_scale_factor) size_, visual_properties.screen_info.device_scale_factor)
: params.compositor_viewport_pixel_size; : visual_properties.compositor_viewport_pixel_size;
UpdateSurfaceAndScreenInfo(params.local_surface_id_allocation.value_or( UpdateSurfaceAndScreenInfo(
viz::LocalSurfaceIdAllocation()), visual_properties.local_surface_id_allocation.value_or(
new_compositor_viewport_pixel_size, viz::LocalSurfaceIdAllocation()),
params.screen_info); new_compositor_viewport_pixel_size, visual_properties.screen_info);
UpdateCaptureSequenceNumber(params.capture_sequence_number); UpdateCaptureSequenceNumber(visual_properties.capture_sequence_number);
layer_tree_view_->layer_tree_host()->SetBrowserControlsHeight( layer_tree_view_->layer_tree_host()->SetBrowserControlsHeight(
params.top_controls_height, params.bottom_controls_height, visual_properties.top_controls_height,
params.browser_controls_shrink_blink_size); visual_properties.bottom_controls_height,
visual_properties.browser_controls_shrink_blink_size);
UpdateZoom(params.zoom_level); UpdateZoom(visual_properties.zoom_level);
if (!params.auto_resize_enabled) { if (!visual_properties.auto_resize_enabled) {
visible_viewport_size_ = params.visible_viewport_size; visible_viewport_size_ = visual_properties.visible_viewport_size;
display_mode_ = params.display_mode; display_mode_ = visual_properties.display_mode;
size_ = params.new_size; size_ = visual_properties.new_size;
ResizeWebWidget(); ResizeWebWidget();
...@@ -1655,7 +1663,7 @@ void RenderWidget::SynchronizeVisualProperties(const VisualProperties& params) { ...@@ -1655,7 +1663,7 @@ void RenderWidget::SynchronizeVisualProperties(const VisualProperties& params) {
delegate()->ResizeVisualViewportForWidget(visual_viewport_size); delegate()->ResizeVisualViewportForWidget(visual_viewport_size);
// NOTE: We may have entered fullscreen mode without changing our size. // NOTE: We may have entered fullscreen mode without changing our size.
SetIsFullscreen(params.is_fullscreen_granted); SetIsFullscreen(visual_properties.is_fullscreen_granted);
} }
} }
......
...@@ -389,7 +389,7 @@ class CONTENT_EXPORT RenderWidget ...@@ -389,7 +389,7 @@ class CONTENT_EXPORT RenderWidget
// RenderWidgetScreenMetricsEmulatorDelegate // RenderWidgetScreenMetricsEmulatorDelegate
void SynchronizeVisualProperties( void SynchronizeVisualProperties(
const VisualProperties& resize_params) override; const VisualProperties& visual_properties) override;
void SetScreenMetricsEmulationParameters( void SetScreenMetricsEmulationParameters(
bool enabled, bool enabled,
const blink::WebDeviceEmulationParams& params) override; const blink::WebDeviceEmulationParams& params) override;
...@@ -692,7 +692,8 @@ class CONTENT_EXPORT RenderWidget ...@@ -692,7 +692,8 @@ class CONTENT_EXPORT RenderWidget
virtual void RequestPresentation(PresentationTimeCallback callback); virtual void RequestPresentation(PresentationTimeCallback callback);
// RenderWidget IPC message handler that can be overridden by subclasses. // RenderWidget IPC message handler that can be overridden by subclasses.
virtual void OnSynchronizeVisualProperties(const VisualProperties& params); virtual void OnSynchronizeVisualProperties(
const VisualProperties& visual_properties);
bool in_synchronous_composite_for_testing() const { bool in_synchronous_composite_for_testing() const {
return in_synchronous_composite_for_testing_; return in_synchronous_composite_for_testing_;
......
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