Reland: Move page zoom level responsibility into RenderViewImpl.
This is a reland of https://chromium-review.googlesource.com/c/chromium/src/+/1799386
Page zoom level is a page/view concept, but the code to manage it is
currently in RenderFrameImpl, though only run when it is the root frame.
This doesn't dramatically change ownership of responsibility but moves
the code up into RenderViewImpl. RenderWidget still goes through
RenderFrameImpl (though more explicitly) to set the zoom level on the
RenderView. And RenderWidget takes responsibility for closing the page
popup instead of having multiple "set page zoom" methods on
RenderViewImpl.
This uncovered some spooky action-at-a-distance and makes it more
explicit and documented, though no less unfortunate. A local root
LocalFrame does not initialize with the correct page zoom value because
it has no parent to read it from. We (accidentally?) worked around that
by setting the RenderView's page zoom to its current value when
navigating a (new) LocalFrame, which would call into blink's WebView
and walk through the entire frame tree setting the value on everything,
eventually also on the new LocalFrame.
Now on navigation, for a local root, we call RenderWidget's
UpdateWebViewWithDeviceScaleFactor() which does the same thing by
re-setting the WebView's page zoom factor. This was done when making
a new main frame in multiple places (RenderView and RenderFrame both
called it in the same CreateFrame() callstack). Now it is consolidated
to a single place on navigation for the main frame and child frames
giving them more consistent behaviour, and going explicitly through
this method that should go away if things were well designed, rather
than re-setting the RenderView to its own value.
Remove calls to UpdateWebViewWithDeviceScaleFactor() scattered
throughout RenderViewImpl and RenderFrameImpl. What we need is for
1) The Page to be updated with PreferCompositingToLCDText when the
device scale factor changes.
2) The WebView to be updated when the device scale factor changes.
3) The LocalFrame of a local root needs its page zoom set by poking
the WebViewImpl to walk through all frames and set it.
Web tests also have 2 places to set the page zoom factor: One is on the
WebView, and one is on a LocalFrame directly. Both of these skip past content.
When setting the zoom factor on WebViewImpl directly, content believes the zoom
factor is still at the default. When SynchronizeVisualProperties events come in
it sees the content value hasn't changed, so it does not set a zoom on blink. This
allows the web tests to override the value secretly behind content's back and not
have content fix it.
This patch changed web tests via eventSender to set the value in content so that
they agree. This means content receiving SynchronizeVisualProperties IPC will race
with the test setting the page zoom and we need to prevent the IPC from overwriting
the zoom set from the test. A test-override-zoom-level is added to RenderWidget to
support this, similar to device scale factor.
Secondly, the path to set page zoom factor on LocalFrame directly takes things a
step further and changes the zoom behind the back of WebViewImpl also. This means
the zoom factor has no chance to combine with the device scale factor, as
WebViewImpl combines these 2 to set a zoom on the LocalFrame. That resulted in
incorrect test results. It also continues to prevent content and blink from agreeing
and causes SynchronizeVisualProperties updates to race with the test.
This patch drops this second method for setting the zoom factor via internals,
leaving just the eventSender path, which goes to the main frame RenderWidget.
Web tests were also resetting the zoom level on the WebViewImpl directly from
the TestRunnerForSpecificView::Reset(). Instead, we have EventSender reset the
zoom back to 0 (the default) on the RenderWidget.
R=avi@chromium.org, dcheng@chromium.org
Bug: 419087
Change-Id: I1c59f78c194410302fc9d95c549b7cfaa08b3784
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1811859
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698490}
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index f094a0a..e13a1c9 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -953,6 +953,7 @@
EXPECT_EQ(expected_dip_scale, GetFrameDeviceScaleFactor(web_contents()));
FrameTreeNode* root = web_contents()->GetFrameTree()->root();
+ EXPECT_EQ(expected_dip_scale, GetFrameDeviceScaleFactor(root));
ASSERT_EQ(1U, root->child_count());
FrameTreeNode* child = root->child_at(0);
diff --git a/content/public/renderer/render_frame.h b/content/public/renderer/render_frame.h
index 188d1ef..eeb36546 100644
--- a/content/public/renderer/render_frame.h
+++ b/content/public/renderer/render_frame.h
@@ -244,12 +244,6 @@
size_t offset,
const gfx::Range& range) = 0;
- // Notifies the frame's RenderView that the zoom has changed.
- virtual void SetZoomLevel(double zoom_level) = 0;
-
- // Returns the page's zoom level from the frame's RenderView.
- virtual double GetZoomLevel() = 0;
-
// Adds |message| to the DevTools console.
virtual void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
const std::string& message) = 0;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index cf5a4951..fc24b7f 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1480,11 +1480,6 @@
render_widget->InitForMainFrame(std::move(show_callback), web_frame_widget);
render_view->AttachWebFrameWidget(web_frame_widget);
- // This call makes sure the page zoom is propagated to the provisional frame
- // since it has to go through the WebViewImpl, and it may not be be changed
- // in OnSynchronizeVisualProperties(), which would pass it along if it did
- // change.
- render_widget->UpdateWebViewWithDeviceScaleFactor();
render_widget->SynchronizeVisualPropertiesFromRenderView(
params->visual_properties);
@@ -1654,12 +1649,6 @@
// WebFrameWidget since that would be part of creating the RenderWidget).
render_widget->SetIsUndead(false);
- // TODO(crbug.com/419087): This was added in 6ccadf770766e89c3 to prevent
- // an empty ScreenInfo, but the WebView has already been created and
- // initialized by RenderViewImpl, so this is surely redundant? It will be
- // pulling the device scale factor off the WebView itself.
- render_widget->UpdateWebViewWithDeviceScaleFactor();
-
// Note that we do *not* call WebViewImpl's DidAttachLocalMainFrame() here
// yet because this frame is provisional and not attached to the Page yet.
// We will tell WebViewImpl about it once it is swapped in.
@@ -1699,11 +1688,6 @@
// will not be destroyed by scoped_refptr unless Close() has been called
// and run.
render_widget->InitForChildLocalRoot(web_frame_widget);
- // TODO(crbug.com/419087): This was added in 6ccadf770766e89c3 to prevent
- // an empty ScreenInfo, but the WebView has already been created and
- // initialized by RenderViewImpl, so this is surely redundant? It will be
- // pulling the device scale factor off the WebView itself.
- render_widget->UpdateWebViewWithDeviceScaleFactor();
render_frame->render_widget_ = render_widget.get();
render_frame->owned_render_widget_ = std::move(render_widget);
@@ -3283,12 +3267,19 @@
static_cast<uint32_t>(offset), range));
}
-void RenderFrameImpl::SetZoomLevel(double zoom_level) {
- render_view_->UpdateZoomLevel(zoom_level);
+bool RenderFrameImpl::SetZoomLevelOnRenderView(double zoom_level) {
+ return render_view_->SetZoomLevel(zoom_level);
}
-double RenderFrameImpl::GetZoomLevel() {
- return render_view_->page_zoom_level();
+void RenderFrameImpl::SetPreferCompositingToLCDTextEnabledOnRenderView(
+ bool prefer) {
+ render_view_->SetPreferCompositingToLCDTextEnabled(prefer);
+}
+
+void RenderFrameImpl::SetDeviceScaleFactorOnRenderView(
+ bool use_zoom_for_dsf,
+ float device_scale_factor) {
+ render_view_->SetDeviceScaleFactor(use_zoom_for_dsf, device_scale_factor);
}
void RenderFrameImpl::AddMessageToConsole(
@@ -4071,17 +4062,8 @@
// mojom::HostZoom implementation ----------------------------------------------
void RenderFrameImpl::SetHostZoomLevel(const GURL& url, double zoom_level) {
- // TODO(wjmaclean): We should see if this restriction is really necessary,
- // since it isn't enforced in other parts of the page zoom system (e.g.
- // when a users changes the zoom of a currently displayed page). Android
- // has no UI for this, so in theory the following code would normally just use
- // the default zoom anyways.
-#if !defined(OS_ANDROID)
- // On Android, page zoom isn't used, and in case of WebView, text zoom is used
- // for legacy WebView text scaling emulation. Thus, the code that resets
- // the zoom level from this map will be effectively resetting text zoom level.
- host_zoom_levels_[url] = zoom_level;
-#endif
+ DCHECK(is_main_frame_);
+ render_view_->SetHostZoomLevel(url, zoom_level);
}
// blink::WebLocalFrameClient implementation
@@ -6095,45 +6077,6 @@
return params;
}
-void RenderFrameImpl::UpdateZoomLevel() {
- if (!frame_->Parent()) {
- // Reset the zoom limits in case a plugin had changed them previously. This
- // will also call us back which will cause us to send a message to
- // update WebContentsImpl.
- render_view_->webview()->ZoomLimitsChanged(
- ZoomFactorToZoomLevel(kMinimumZoomFactor),
- ZoomFactorToZoomLevel(kMaximumZoomFactor));
-
- // Set zoom level, but don't do it for full-page plugin since they don't use
- // the same zoom settings.
- auto host_zoom = host_zoom_levels_.find(GetLoadingUrl());
- if (render_view_->webview()->MainFrame()->IsWebLocalFrame() &&
- render_view_->webview()
- ->MainFrame()
- ->ToWebLocalFrame()
- ->GetDocument()
- .IsPluginDocument()) {
- // Reset the zoom levels for plugins.
- render_view_->SetZoomLevel(0);
- } else {
- // If the zoom level is not found, then do nothing. In-page navigation
- // relies on not changing the zoom level in this case.
- if (host_zoom != host_zoom_levels_.end())
- render_view_->SetZoomLevel(host_zoom->second);
- }
-
- if (host_zoom != host_zoom_levels_.end()) {
- // This zoom level was merely recorded transiently for this load. We can
- // erase it now. If at some point we reload this page, the browser will
- // send us a new, up-to-date zoom level.
- host_zoom_levels_.erase(host_zoom);
- }
- } else {
- // Subframes should match the zoom level of the main frame.
- render_view_->SetZoomLevel(render_view_->page_zoom_level());
- }
-}
-
bool RenderFrameImpl::UpdateNavigationHistory(
const blink::WebHistoryItem& item,
blink::WebHistoryCommitType commit_type) {
@@ -6205,9 +6148,12 @@
render_view_->webview()->ResetScrollAndScaleState();
internal_data->set_must_reset_scroll_and_scale_state(false);
}
- UpdateZoomLevel();
-
if (!frame_->Parent()) { // Only for top frames.
+ // TODO(danakj): This seems redundant, the RenderWidget has the zoom set
+ // already via VisualProperties. Remove it.
+ render_view_->UpdateZoomLevelForNavigationCommitOfMainFrame(
+ GetLoadingUrl());
+
RenderThreadImpl* render_thread_impl = RenderThreadImpl::current();
if (render_thread_impl) { // Can be NULL in tests.
render_thread_impl->histogram_customizer()->RenderViewNavigatedToHost(
@@ -6215,6 +6161,26 @@
}
}
+ if (render_widget_) {
+ // This goes to WebViewImpl and sets the zoom factor which will be
+ // propagated down to this RenderFrameImpl's LocalFrame in blink.
+ // Non-local-roots are able to grab the value off their parents but local
+ // roots can not and this is a huge action-at-a-distance to make up for that
+ // flaw in how LocalFrame determines the zoom factor.
+ // TODO(danakj): This should not be needed if the zoom factor/device scale
+ // factor did not need to be propagated to each frame. Since they are a
+ // global that should be okay?? The test that fails without this, for
+ // child frames, is in content_browsertests:
+ // SitePerProcessHighDPIBrowserTest.
+ // SubframeLoadsWithCorrectDeviceScaleFactor
+ // And when UseZoomForDSF is disabled, in content_browsertests:
+ // IFrameZoomBrowserTest.SubframesDontZoomIndependently (and the whole
+ // suite).
+ render_view_->PropagatePageZoomToNewlyAttachedFrame(
+ render_widget_->compositor_deps()->IsUseZoomForDSFEnabled(),
+ render_view_->page_properties()->GetDeviceScaleFactor());
+ }
+
// Remember that we've already processed this request, so we don't update
// the session history again. We do this regardless of whether this is
// a session history navigation, because if we attempted a session history
@@ -6385,11 +6351,6 @@
CHECK(!render_view_->main_render_frame_);
render_view_->main_render_frame_ = this;
- // TODO(danakj): This was added in 02dffc89d823832ac8 due to the zoom factor
- // not being scaled by DSF when the frame was provisional. We should
- // properly scale the zoom factor all along.
- render_view_->GetWidget()->UpdateWebViewWithDeviceScaleFactor();
-
// The WebFrame being swapped in here has now been attached to the Page as
// its main frame, and the WebFrameWidget was previously initialized when
// the frame was created, so we can call WebViewImpl's
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 044ae01..a44ce7a7 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -492,8 +492,6 @@
void SetSelectedText(const base::string16& selection_text,
size_t offset,
const gfx::Range& range) override;
- void SetZoomLevel(double zoom_level) override;
- double GetZoomLevel() override;
void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
const std::string& message) override;
void SetPreviewsState(PreviewsState previews_state) override;
@@ -918,6 +916,16 @@
media::MediaPermission* GetMediaPermission();
+ // Proxies the call to set the zoom level over to the RenderViewImpl and
+ // returns its result.
+ bool SetZoomLevelOnRenderView(double zoom_level);
+ // Proxies the call to set the prefer compositing flag over to the
+ // RenderViewImpl.
+ void SetPreferCompositingToLCDTextEnabledOnRenderView(bool prefer);
+ // Proxies the call to set the device scale factor over to the RenderViewImpl.
+ void SetDeviceScaleFactorOnRenderView(bool use_zoom_for_dsf,
+ float device_scale_factor);
+
// Sends the current frame's navigation state to the browser.
void SendUpdateState();
@@ -1084,8 +1092,6 @@
class FrameURLLoaderFactory;
- typedef std::map<GURL, double> HostZoomLevels;
-
// Creates a new RenderFrame. |render_view| is the RenderView object that this
// frame belongs to, |interface_provider| is the RenderFrameHost's
// InterfaceProvider through which services are exposed to the RenderFrame,
@@ -1351,9 +1357,6 @@
MakeDidCommitProvisionalLoadParams(blink::WebHistoryCommitType commit_type,
ui::PageTransition transition);
- // Updates the Zoom level of the render view to match current content.
- void UpdateZoomLevel();
-
// Updates the navigation history depending on the passed parameters.
// This could result either in the creation of a new entry or a modification
// of the current entry or nothing. If a new entry was created,
@@ -1679,8 +1682,6 @@
PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
#endif
- HostZoomLevels host_zoom_levels_;
-
using AutoplayOriginAndFlags = std::pair<url::Origin, int32_t>;
AutoplayOriginAndFlags autoplay_flags_;
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 3b5eb28f..fc07d157 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -425,10 +425,6 @@
return view()->preferred_size_;
}
- void SetZoomLevel(double level) { view()->UpdateZoomLevel(level); }
-
- double GetZoomLevel() { return view()->page_zoom_level(); }
-
int GetScrollbarWidth() {
blink::WebView* webview = view()->webview();
return webview->MainFrameWidget()->Size().width -
@@ -2350,7 +2346,7 @@
gfx::Size size = GetPreferredSize();
EXPECT_EQ(gfx::Size(400 + scrollbar_width, 400), size);
- SetZoomLevel(ZoomFactorToZoomLevel(2.0));
+ EXPECT_TRUE(view()->SetZoomLevel(ZoomFactorToZoomLevel(2.0)));
size = GetPreferredSize();
EXPECT_EQ(gfx::Size(800 + scrollbar_width, 800), size);
}
@@ -2731,13 +2727,12 @@
}
TEST_F(RenderViewImplTest, ZoomLevelUpdate) {
- // 0 is the default zoom level, nothing will change.
- SetZoomLevel(0);
- EXPECT_NEAR(0.0, GetZoomLevel(), 0.01);
+ // 0 will use the minimum zoom level, which is the default, nothing will
+ // change.
+ EXPECT_FALSE(view()->SetZoomLevel(0));
// Change the zoom level to 25% and check if the view gets the change.
- SetZoomLevel(content::ZoomFactorToZoomLevel(0.25));
- EXPECT_NEAR(content::ZoomFactorToZoomLevel(0.25), GetZoomLevel(), 0.01);
+ EXPECT_TRUE(view()->SetZoomLevel(content::ZoomFactorToZoomLevel(0.25)));
}
#endif
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 5d28fce..939ec033 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1569,14 +1569,79 @@
render_widget_->SetWebWidgetInternal(nullptr);
}
-void RenderViewImpl::SetZoomLevel(double zoom_level) {
+void RenderViewImpl::SetHostZoomLevel(const GURL& url, double zoom_level) {
+ // TODO(wjmaclean): We should see if this restriction is really necessary,
+ // since it isn't enforced in other parts of the page zoom system (e.g.
+ // when a users changes the zoom of a currently displayed page). Android
+ // has no UI for this, so in theory the following code would normally just use
+ // the default zoom anyways.
+#if !defined(OS_ANDROID)
+ // On Android, page zoom isn't used, and in case of WebView, text zoom is used
+ // for legacy WebView text scaling emulation. Thus, the code that resets
+ // the zoom level from this map will be effectively resetting text zoom level.
+ host_zoom_levels_[url] = zoom_level;
+#endif
+}
+
+void RenderViewImpl::UpdateZoomLevelForNavigationCommitOfMainFrame(
+ const GURL& loading_url) {
+ // Reset the zoom limits in case a plugin had changed them previously. This
+ // will also call us back via ZoomLimitsChanged() which will cause us to send
+ // a message to update WebContentsImpl.
+ webview()->ZoomLimitsChanged(ZoomFactorToZoomLevel(kMinimumZoomFactor),
+ ZoomFactorToZoomLevel(kMaximumZoomFactor));
+
+ auto host_zoom_it = host_zoom_levels_.find(loading_url);
+
+ // Full-page plugin documents always use the default zoom level. Otherwise,
+ // apply the zoom level specified by the browser in the |host_zoom_levels_|
+ // map, if present.
+ WebFrame* main_frame = webview()->MainFrame();
+ if (main_frame->IsWebLocalFrame() &&
+ main_frame->ToWebLocalFrame()->GetDocument().IsPluginDocument()) {
+ SetZoomLevel(0);
+ } else if (host_zoom_it != host_zoom_levels_.end()) {
+ SetZoomLevel(host_zoom_it->second);
+ }
+
+ // This zoom level was merely recorded transiently for a single navigation.
+ // We can erase it now. On another navigation/reload, the browser will another
+ // zoom level.
+ host_zoom_levels_.clear();
+}
+
+bool RenderViewImpl::SetZoomLevel(double zoom_level) {
+ if (zoom_level == page_zoom_level_)
+ return false;
+
// If we change the zoom level for the view, make sure any subsequent subframe
// loads reflect the current zoom level.
page_zoom_level_ = zoom_level;
-
webview()->SetZoomLevel(zoom_level);
for (auto& observer : observers_)
observer.OnZoomLevelChanged();
+ return true;
+}
+
+void RenderViewImpl::SetPreferCompositingToLCDTextEnabled(bool prefer) {
+ webview()->GetSettings()->SetPreferCompositingToLCDTextEnabled(prefer);
+}
+
+void RenderViewImpl::SetDeviceScaleFactor(bool use_zoom_for_dsf,
+ float device_scale_factor) {
+ if (use_zoom_for_dsf)
+ webview()->SetZoomFactorForDeviceScaleFactor(device_scale_factor);
+ else
+ webview()->SetDeviceScaleFactor(device_scale_factor);
+}
+
+void RenderViewImpl::PropagatePageZoomToNewlyAttachedFrame(
+ bool use_zoom_for_dsf,
+ float device_scale_factor) {
+ if (use_zoom_for_dsf)
+ webview()->SetZoomFactorForDeviceScaleFactor(device_scale_factor);
+ else
+ webview()->SetZoomLevel(page_zoom_level_);
}
void RenderViewImpl::SetValidationMessageDirection(
@@ -1903,11 +1968,6 @@
webview()->SetPageScaleFactor(page_scale_factor);
}
-void RenderViewImpl::UpdateZoomLevel(double zoom_level) {
- webview()->CancelPagePopup();
- SetZoomLevel(zoom_level);
-}
-
void RenderViewImpl::ApplyPageHidden(bool hidden, bool initial_setting) {
webview()->SetIsHidden(hidden, initial_setting);
// Note: RenderWidget visibility is separately set from the IPC handlers, and
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 32f2abd..20347f5a 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -14,6 +14,7 @@
#include <string>
#include <vector>
+#include "base/containers/flat_map.h"
#include "base/containers/id_map.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
@@ -166,10 +167,26 @@
void AddObserver(RenderViewObserver* observer);
void RemoveObserver(RenderViewObserver* observer);
- // Sets the zoom level and notifies observers.
- void SetZoomLevel(double zoom_level);
+ // Stores a map of url to zoom level, specified by the browser.
+ void SetHostZoomLevel(const GURL& url, double zoom_level);
- double page_zoom_level() { return page_zoom_level_; }
+ // When the main frame commits, the zoom level may need to be changed.
+ void UpdateZoomLevelForNavigationCommitOfMainFrame(const GURL& loading_url);
+
+ // Sets the zoom level and notifies observers. Returns true if the zoom level
+ // changed. A value of 0 means the default zoom level.
+ bool SetZoomLevel(double zoom_level);
+
+ // Passes along the prefer compositing preference to the WebView's settings.
+ void SetPreferCompositingToLCDTextEnabled(bool prefer);
+
+ // Passes along the device scale factor to the WebView.
+ void SetDeviceScaleFactor(bool use_zoom_for_dsf, float device_scale_factor);
+
+ // Passes along the page zoom to the WebView to set it on a newly attached
+ // LocalFrame.
+ void PropagatePageZoomToNewlyAttachedFrame(bool use_zoom_for_dsf,
+ float device_scale_factor);
// Sets page-level focus in this view and notifies plugins and Blink's
// FocusController.
@@ -300,7 +317,6 @@
bool renderer_wide_named_frame_lookup() {
return renderer_wide_named_frame_lookup_;
}
- void UpdateZoomLevel(double zoom_level);
protected:
RenderViewImpl(CompositorDependencies* compositor_deps,
@@ -647,6 +663,9 @@
// they should match page zoom level.
double page_zoom_level_ = 0;
+ // A map of urls to zoom levels specified by the browser.
+ base::flat_map<GURL, double> host_zoom_levels_;
+
// Helper objects ------------------------------------------------------------
RenderFrameImpl* main_render_frame_ = nullptr;
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 808c2c3..282aeb4 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -392,8 +392,9 @@
#endif
}
-static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps,
- float device_scale_factor) {
+static bool ComputePreferCompositingToLCDText(
+ CompositorDependencies* compositor_deps,
+ float device_scale_factor) {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText))
@@ -776,6 +777,9 @@
visual_properties.new_size,
visual_properties.screen_info.device_scale_factor));
}
+ // Web tests can override the zoom level in the renderer.
+ if (zoom_level_for_testing_ != -INFINITY)
+ visual_properties.zoom_level = zoom_level_for_testing_;
// Inform the rendering thread of the color space indicating the presence of
// HDR capabilities. The HDR bit happens to be globally true/false for all
@@ -795,6 +799,9 @@
if (delegate()) {
if (size_ != visual_properties.new_size) {
// Only hide popups when the size changes. Eg https://crbug.com/761908.
+ // TODO(danakj): If OnSynchronizeVisualProperties doesn't happen on an
+ // undead widget then this can go through the WebFrameWidget->WebView
+ // instead of through the delegate, letting us delete that delegate API.
delegate()->CancelPagePopupForWidget();
}
@@ -814,24 +821,9 @@
bottom_controls_height_ = visual_properties.bottom_controls_height;
}
- bool ignore_resize_ipc = false;
- if (synchronous_resize_mode_for_testing_) {
- // We can ignore browser-initialized resizing during synchronous
- // (renderer-controlled) mode, unless it is switching us to/from
- // fullsreen mode or changing the device scale factor.
- // TODO(danakj): Does the browser actually change DSF inside a web test??
- // TODO(danakj): Isn't the display mode check redundant with the fullscreen
- // one?
- if (visual_properties.is_fullscreen_granted == is_fullscreen_granted_ &&
- visual_properties.display_mode == display_mode_ &&
- visual_properties.screen_info.device_scale_factor ==
- page_properties_->GetDeviceScaleFactor())
- ignore_resize_ipc = true;
- }
-
- UpdateZoom(visual_properties.zoom_level);
-
if (for_frame()) {
+ SetZoomLevel(visual_properties.zoom_level);
+
bool capture_sequence_number_changed =
visual_properties.capture_sequence_number !=
last_capture_sequence_number_;
@@ -868,6 +860,21 @@
gfx::Size old_visible_viewport_size = visible_viewport_size_;
+ bool ignore_resize_ipc = false;
+ if (synchronous_resize_mode_for_testing_) {
+ // We can ignore browser-initialized resizing during synchronous
+ // (renderer-controlled) mode, unless it is switching us to/from
+ // fullsreen mode or changing the device scale factor.
+ // TODO(danakj): Does the browser actually change DSF inside a web test??
+ // TODO(danakj): Isn't the display mode check redundant with the fullscreen
+ // one?
+ if (visual_properties.is_fullscreen_granted == is_fullscreen_granted_ &&
+ visual_properties.display_mode == display_mode_ &&
+ visual_properties.screen_info.device_scale_factor ==
+ page_properties_->GetDeviceScaleFactor())
+ ignore_resize_ipc = true;
+ }
+
// When controlling the size in the renderer, we should ignore sizes given by
// the browser IPC here.
// TODO(danakj): There are many things also being ignored that aren't the
@@ -990,6 +997,29 @@
}
}
+void RenderWidget::SetZoomLevel(double zoom_level) {
+ // TODO(danakj): This should not need to go through RenderFrame to set
+ // Page-level properties.
+ blink::WebFrameWidget* frame_widget = GetFrameWidget();
+ DCHECK(frame_widget);
+ RenderFrameImpl* render_frame =
+ RenderFrameImpl::FromWebFrame(frame_widget->LocalRoot());
+
+ bool zoom_level_changed = render_frame->SetZoomLevelOnRenderView(zoom_level);
+ if (zoom_level_changed) {
+ // Hide popups when the zoom changes.
+ blink::WebView* web_view = frame_widget->LocalRoot()->View();
+ web_view->CancelPagePopup();
+
+ // Propagate changes down to child local root RenderWidgets and
+ // BrowserPlugins in other frame trees/processes.
+ for (auto& observer : render_frame_proxies_)
+ observer.OnZoomLevelChanged(zoom_level);
+ for (auto& plugin : browser_plugins_)
+ plugin.OnZoomLevelChanged(zoom_level);
+ }
+}
+
void RenderWidget::OnDisableDeviceEmulation() {
screen_metrics_emulator_.reset();
}
@@ -1693,27 +1723,6 @@
return layer_tree_host_->device_viewport_rect();
}
-void RenderWidget::UpdateZoom(double zoom_level) {
- DCHECK(!is_undead_);
- blink::WebFrameWidget* frame_widget = GetFrameWidget();
- if (!frame_widget)
- return;
- RenderFrameImpl* render_frame =
- RenderFrameImpl::FromWebFrame(frame_widget->LocalRoot());
-
- // Return early if zoom level is unchanged.
- if (render_frame->GetZoomLevel() == zoom_level) {
- return;
- }
-
- render_frame->SetZoomLevel(zoom_level);
-
- for (auto& observer : render_frame_proxies_)
- observer.OnZoomLevelChanged(zoom_level);
- for (auto& plugin : browser_plugins_)
- plugin.OnZoomLevelChanged(zoom_level);
-}
-
void RenderWidget::SynchronizeVisualProperties(
const VisualProperties& visual_properties) {
// This method needs to handle changes to the screen_info, new_size, and
@@ -1731,6 +1740,27 @@
viz::LocalSurfaceIdAllocation()),
new_compositor_viewport_pixel_rect, visual_properties.screen_info);
+ if (for_frame()) {
+ // TODO(danakj): This should not need to go through RenderFrame to set
+ // Page-level properties.
+ blink::WebFrameWidget* frame_widget = GetFrameWidget();
+ // TODO(danakj): Stop doing SynchronizeVisualProperties() (due to emulation)
+ // while undead, and change this to a DCHECK.
+ if (frame_widget) {
+ RenderFrameImpl* render_frame =
+ RenderFrameImpl::FromWebFrame(frame_widget->LocalRoot());
+
+ // This causes compositing state to be modified which dirties the document
+ // lifecycle. Android Webview relies on the document lifecycle being clean
+ // after the RenderWidget is initialized, in order to send IPCs that query
+ // and change compositing state. So ResizeWebWidget() must come after this
+ // call, as it runs the entire document lifecycle.
+ render_frame->SetPreferCompositingToLCDTextEnabledOnRenderView(
+ ComputePreferCompositingToLCDText(
+ compositor_deps_, page_properties_->GetDeviceScaleFactor()));
+ }
+ }
+
if (!auto_resize_mode_) {
visible_viewport_size_ = visual_properties.visible_viewport_size;
display_mode_ = visual_properties.display_mode;
@@ -2029,24 +2059,6 @@
close_weak_ptr_factory_.InvalidateWeakPtrs();
}
-void RenderWidget::UpdateWebViewWithDeviceScaleFactor() {
- blink::WebFrameWidget* frame_widget = GetFrameWidget();
- blink::WebFrame* current_frame =
- frame_widget ? frame_widget->LocalRoot() : nullptr;
- blink::WebView* webview = current_frame ? current_frame->View() : nullptr;
- if (webview) {
- if (compositor_deps_->IsUseZoomForDSFEnabled())
- webview->SetZoomFactorForDeviceScaleFactor(
- page_properties_->GetDeviceScaleFactor());
- else
- webview->SetDeviceScaleFactor(page_properties_->GetDeviceScaleFactor());
-
- webview->GetSettings()->SetPreferCompositingToLCDTextEnabled(
- PreferCompositingToLCDText(compositor_deps_,
- page_properties_->GetDeviceScaleFactor()));
- }
-}
-
blink::WebFrameWidget* RenderWidget::GetFrameWidget() const {
// TODO(danakj): Remove this check and don't call this method for non-frames.
if (!for_frame())
@@ -2274,9 +2286,6 @@
new_screen_info.orientation_angle ||
page_properties_->GetScreenInfo().orientation_type !=
new_screen_info.orientation_type;
- bool web_device_scale_factor_changed =
- page_properties_->GetScreenInfo().device_scale_factor !=
- new_screen_info.device_scale_factor;
ScreenInfo previous_original_screen_info = GetOriginalScreenInfo();
local_surface_id_allocation_from_parent_ = new_local_surface_id_allocation;
@@ -2298,19 +2307,37 @@
if (orientation_changed)
OnOrientationChange();
+ if (for_frame()) {
+ // TODO(danakj): This should not need to go through RenderFrame to set
+ // Page-level properties.
+ blink::WebFrameWidget* frame_widget = GetFrameWidget();
+ // TODO(danakj): Stop sending/receiving visual properties while undead, and
+ // change this to a DCHECK.
+ if (frame_widget) {
+ RenderFrameImpl* render_frame =
+ RenderFrameImpl::FromWebFrame(frame_widget->LocalRoot());
+ // TODO(danakj): RenderWidget knows the DSF and could avoid calling into
+ // blink when it hasn't changed, but it sets an initial |screen_info_|
+ // during construction, so it is hard to tell if the value is not the
+ // default value once we get to OnSynchronizeVisualProperties. Thus we
+ // call into blink unconditionally and let it early out if it's already
+ // set.
+ render_frame->SetDeviceScaleFactorOnRenderView(
+ compositor_deps_->IsUseZoomForDSFEnabled(),
+ page_properties_->GetDeviceScaleFactor());
+ }
+ }
+
+ // Propagate changes down to child local root RenderWidgets and BrowserPlugins
+ // in other frame trees/processes.
if (previous_original_screen_info != GetOriginalScreenInfo()) {
for (auto& observer : render_frame_proxies_) {
if (!is_undead_)
observer.OnScreenInfoChanged(GetOriginalScreenInfo());
}
-
- // Notify all embedded BrowserPlugins of the updated ScreenInfo.
for (auto& observer : browser_plugins_)
observer.ScreenInfoChanged(GetOriginalScreenInfo());
}
-
- if (web_device_scale_factor_changed)
- UpdateWebViewWithDeviceScaleFactor();
}
void RenderWidget::SetWindowRectSynchronously(
@@ -3802,12 +3829,32 @@
"must be done via the RenderView.";
delegate()->ResizeVisualViewportForWidget(visible_viewport_size);
- // Make sure the DSF override stays for future VisualProperties updates, and
- // that includes overriding the VisualProperties'
- // compositor_viewport_pixel_rect with size * this for-testing DSF.
+ // TODO(danakj): This should not need to go through RenderFrame to set
+ // Page-level properties.
+ blink::WebFrameWidget* frame_widget = GetFrameWidget();
+ RenderFrameImpl* render_frame =
+ RenderFrameImpl::FromWebFrame(frame_widget->LocalRoot());
+ render_frame->SetPreferCompositingToLCDTextEnabledOnRenderView(
+ ComputePreferCompositingToLCDText(
+ compositor_deps_, page_properties_->GetDeviceScaleFactor()));
+
+ // Make sure to override any future OnSynchronizeVisualProperties IPCs.
device_scale_factor_for_testing_ = factor;
}
+void RenderWidget::SetZoomLevelForTesting(double zoom_level) {
+ DCHECK_NE(zoom_level, -INFINITY);
+ SetZoomLevel(zoom_level);
+
+ // Make sure to override any future OnSynchronizeVisualProperties IPCs.
+ zoom_level_for_testing_ = zoom_level;
+}
+
+void RenderWidget::ResetZoomLevelForTesting() {
+ zoom_level_for_testing_ = -INFINITY;
+ SetZoomLevel(0);
+}
+
void RenderWidget::SetDeviceColorSpaceForTesting(
const gfx::ColorSpace& color_space) {
// We are changing the device color space from the renderer, so allocate a
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 531255d7..89ab09ed 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -675,16 +675,15 @@
void UseSynchronousResizeModeForTesting(bool enable);
void SetDeviceScaleFactorForTesting(float factor);
+ void SetZoomLevelForTesting(double zoom_level);
+ void ResetZoomLevelForTesting();
void SetDeviceColorSpaceForTesting(const gfx::ColorSpace& color_space);
+ void SetPageZoomLevelForTesting(double zoom_level);
void SetWindowRectSynchronouslyForTesting(const gfx::Rect& new_window_rect);
void EnableAutoResizeForTesting(const gfx::Size& min_size,
const gfx::Size& max_size);
void DisableAutoResizeForTesting(const gfx::Size& new_size);
- // Update the WebView's device scale factor.
- // TODO(ajwong): This should be moved into RenderView.
- void UpdateWebViewWithDeviceScaleFactor();
-
// Forces a redraw and invokes the callback once the frame's been displayed
// to the user.
using PresentationTimeCallback =
@@ -763,6 +762,10 @@
const gfx::Size& max_size_before_dsf,
float device_scale_factor);
+ // Sets the zoom level on the RenderView. This is part of
+ // OnSynchronizeVisualProperties though tests may call to it more directly.
+ void SetZoomLevel(double zoom_level);
+
// Helper method to get the device_viewport_rect() from the compositor, which
// is always in physical pixels.
gfx::Rect CompositorViewportRect() const;
@@ -909,8 +912,6 @@
gfx::ColorSpace GetRasterColorSpace() const;
- void UpdateZoom(double zoom_level);
-
#if BUILDFLAG(ENABLE_PLUGINS)
// Returns the focused pepper plugin, if any, inside the WebWidget. That is
// the pepper plugin which is focused inside a frame which belongs to the
@@ -965,7 +966,11 @@
// Web tests override the device scale factor in the renderer with this. We
// store it to keep the override if the browser passes along VisualProperties
// with the real device scale factor. A value of 0.f means this is ignored.
- float device_scale_factor_for_testing_ = 0.f;
+ float device_scale_factor_for_testing_ = 0;
+ // Web tests override the zoom factor in the renderer with this. We store it
+ // to keep the override if the browser passes along VisualProperties with the
+ // real device scale factor. A value of -INFINITY means this is ignored.
+ double zoom_level_for_testing_ = -INFINITY;
// The size of the RenderWidget in DIPs. This may differ from the viewport
// set in the compositor, as the viewport can be a subset of the RenderWidget
diff --git a/content/shell/test_runner/event_sender.cc b/content/shell/test_runner/event_sender.cc
index 36e4ca3..99331de 100644
--- a/content/shell/test_runner/event_sender.cc
+++ b/content/shell/test_runner/event_sender.cc
@@ -23,6 +23,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/common/input/web_mouse_wheel_event_traits.h"
+#include "content/renderer/render_widget.h"
#include "content/shell/test_runner/mock_spell_check.h"
#include "content/shell/test_runner/test_interfaces.h"
#include "content/shell/test_runner/web_test_delegate.h"
@@ -1312,6 +1313,11 @@
is_drag_mode_ = true;
force_layout_on_events_ = true;
+ // Disable the zoom level override. Reset() also happens during creation of
+ // the RenderWidget, which we can detect by checking for the WebWidget.
+ if (web_widget_test_proxy_->GetWebWidget())
+ web_widget_test_proxy_->ResetZoomLevelForTesting();
+
#if defined(OS_WIN)
wm_key_down_ = WM_KEYDOWN;
wm_key_up_ = WM_KEYUP;
@@ -1811,32 +1817,23 @@
}
void EventSender::ZoomPageIn() {
- const std::vector<WebViewTestProxy*>& window_list =
- interfaces()->GetWindowList();
-
- for (size_t i = 0; i < window_list.size(); ++i) {
- window_list.at(i)->webview()->SetZoomLevel(
- window_list.at(i)->webview()->ZoomLevel() + 1);
+ for (WebViewTestProxy* view_proxy : interfaces()->GetWindowList()) {
+ view_proxy->GetWidget()->SetZoomLevelForTesting(
+ view_proxy->webview()->ZoomLevel() + 1);
}
}
void EventSender::ZoomPageOut() {
- const std::vector<WebViewTestProxy*>& window_list =
- interfaces()->GetWindowList();
-
- for (size_t i = 0; i < window_list.size(); ++i) {
- window_list.at(i)->webview()->SetZoomLevel(
- window_list.at(i)->webview()->ZoomLevel() - 1);
+ for (WebViewTestProxy* view_proxy : interfaces()->GetWindowList()) {
+ view_proxy->GetWidget()->SetZoomLevelForTesting(
+ view_proxy->webview()->ZoomLevel() - 1);
}
}
void EventSender::SetPageZoomFactor(double zoom_factor) {
- const std::vector<WebViewTestProxy*>& window_list =
- interfaces()->GetWindowList();
-
- for (size_t i = 0; i < window_list.size(); ++i) {
- window_list.at(i)->webview()->SetZoomLevel(std::log(zoom_factor) /
- std::log(1.2));
+ for (WebViewTestProxy* view_proxy : interfaces()->GetWindowList()) {
+ view_proxy->GetWidget()->SetZoomLevelForTesting(std::log(zoom_factor) /
+ std::log(1.2));
}
}
diff --git a/content/shell/test_runner/test_runner_for_specific_view.cc b/content/shell/test_runner/test_runner_for_specific_view.cc
index 9e4aa2f..60f753f 100644
--- a/content/shell/test_runner/test_runner_for_specific_view.cc
+++ b/content/shell/test_runner/test_runner_for_specific_view.cc
@@ -97,7 +97,6 @@
if (web_view()->MainFrame()->IsWebLocalFrame()) {
web_view()->MainFrame()->ToWebLocalFrame()->EnableViewSourceMode(false);
web_view()->SetTextZoomFactor(1);
- web_view()->SetZoomLevel(0);
// As would the browser via IPC, set visibility on the RenderWidget then on
// the Page.
// TODO(danakj): This should set visibility on all RenderWidgets not just
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc
index 3c2beec..175ddac7 100644
--- a/third_party/blink/renderer/core/frame/local_frame_view.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -545,11 +545,6 @@
}
}
-void LocalFrameView::UpdateAcceleratedCompositingSettings() {
- if (auto* layout_view = GetLayoutView())
- layout_view->Compositor()->UpdateAcceleratedCompositingSettings();
-}
-
void LocalFrameView::UpdateCountersAfterStyleChange() {
auto* layout_view = GetLayoutView();
DCHECK(layout_view);
diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc
index 3b148f36..a071c23 100644
--- a/third_party/blink/renderer/core/page/page.cc
+++ b/third_party/blink/renderer/core/page/page.cc
@@ -770,8 +770,8 @@
auto* local_frame = DynamicTo<LocalFrame>(frame);
if (!local_frame)
continue;
- if (LocalFrameView* view = local_frame->View())
- view->UpdateAcceleratedCompositingSettings();
+ LayoutView* layout_view = local_frame->ContentLayoutObject();
+ layout_view->Compositor()->UpdateAcceleratedCompositingSettings();
}
}
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc
index c8388835..75658b0 100644
--- a/third_party/blink/renderer/core/testing/internals.cc
+++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -3017,13 +3017,6 @@
DocumentLifecycle::LifecycleUpdateReason::kTest);
}
-void Internals::setZoomFactor(float factor) {
- if (!GetFrame())
- return;
-
- GetFrame()->SetPageZoomFactor(factor);
-}
-
void Internals::setShouldRevealPassword(Element* element,
bool reveal,
ExceptionState& exception_state) {
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h
index eed62606..9260ce1 100644
--- a/third_party/blink/renderer/core/testing/internals.h
+++ b/third_party/blink/renderer/core/testing/internals.h
@@ -466,8 +466,6 @@
void forceCompositingUpdate(Document*, ExceptionState&);
- void setZoomFactor(float);
-
void setShouldRevealPassword(Element*, bool, ExceptionState&);
ScriptPromise createResolvedPromise(ScriptState*, ScriptValue);
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl
index 6de35f8..c11085d 100644
--- a/third_party/blink/renderer/core/testing/internals.idl
+++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -303,8 +303,6 @@
[RaisesException] void forceCompositingUpdate(Document document);
- void setZoomFactor(float factor);
-
[RaisesException] void setShouldRevealPassword(Element element, boolean reveal);
[CallWith=ScriptState] Promise<any> createResolvedPromise(any value);
diff --git a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom-expected.html b/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom-expected.html
index f2bbcb62..e95eac9 100644
--- a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom-expected.html
+++ b/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom-expected.html
@@ -10,5 +10,5 @@
<div id="target" class="box"></div>
<script>
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
</script>
diff --git a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom.html b/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom.html
index be7db2fd..1017b09 100644
--- a/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom.html
+++ b/third_party/blink/web_tests/animations/animationworklet/worklet-animation-responsive-to-zoom.html
@@ -34,7 +34,7 @@
if (window.testRunner) {
waitTwoAnimationFrames(_ => {
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
waitTwoAnimationFrames(_ => {
testRunner.notifyDone();
});
diff --git a/third_party/blink/web_tests/animations/interpolation/left-zoomed-interpolation.html b/third_party/blink/web_tests/animations/interpolation/left-zoomed-interpolation.html
index 357e3ea..19759dfb 100644
--- a/third_party/blink/web_tests/animations/interpolation/left-zoomed-interpolation.html
+++ b/third_party/blink/web_tests/animations/interpolation/left-zoomed-interpolation.html
@@ -25,8 +25,8 @@
<script src="resources/interpolation-test.js"></script>
<script>
// When viewing this test manually you will need to pass --expose-internals-for-testing to content_shell.
-if (window.internals) {
- internals.setZoomFactor(2);
+if (window.eventSender) {
+ eventSender.setPageZoomFactor(2);
}
assertInterpolation({
diff --git a/third_party/blink/web_tests/animations/responsive/resources/zoom-responsive.js b/third_party/blink/web_tests/animations/responsive/resources/zoom-responsive.js
index 2557f4e..19e2853 100644
--- a/third_party/blink/web_tests/animations/responsive/resources/zoom-responsive.js
+++ b/third_party/blink/web_tests/animations/responsive/resources/zoom-responsive.js
@@ -32,7 +32,7 @@
requestAnimationFrame(() => {
requestAnimationFrame(() => {
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
if (!window.testRunner)
return;
@@ -50,7 +50,7 @@
}
function zoomBeforeAnimation(property, values) {
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
var footer = document.createElement('div');
document.body.appendChild(footer);
diff --git a/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation-expected.html b/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation-expected.html
index 8cbd2baa..8ed4d12 100644
--- a/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation-expected.html
+++ b/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation-expected.html
@@ -17,7 +17,7 @@
<div id="footer"></div>
<script>
'use strict';
-internals.setZoomFactor(2);
+eventSender.setPageZoomFactor(2);
[
'10px 10px 10px',
diff --git a/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation.html b/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation.html
index 3b8b5a31..a610099 100644
--- a/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation.html
+++ b/third_party/blink/web_tests/animations/responsive/zoom-responsive-translate-animation.html
@@ -43,7 +43,7 @@
requestAnimationFrame(() => {
requestAnimationFrame(() => {
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
requestAnimationFrame(() => {
requestAnimationFrame(() => {
waitForCompositor().then(() => {
diff --git a/third_party/blink/web_tests/animations/svg/stroke-width-zoom-factor.html b/third_party/blink/web_tests/animations/svg/stroke-width-zoom-factor.html
index cd138e5..11f8844 100644
--- a/third_party/blink/web_tests/animations/svg/stroke-width-zoom-factor.html
+++ b/third_party/blink/web_tests/animations/svg/stroke-width-zoom-factor.html
@@ -9,7 +9,7 @@
<script>
test(t => {
// Setting the zoom factor should not change the value of strokeWidth.
- internals.setZoomFactor(5);
+ eventSender.setPageZoomFactor(5);
const anim = target.animate([
{ strokeWidth: '10px' },
diff --git a/third_party/blink/web_tests/animations/transition-zoomed-length.html b/third_party/blink/web_tests/animations/transition-zoomed-length.html
index 07ed463..e981a8a 100644
--- a/third_party/blink/web_tests/animations/transition-zoomed-length.html
+++ b/third_party/blink/web_tests/animations/transition-zoomed-length.html
@@ -72,7 +72,7 @@
expected[property] = getComputedStyle(target)[property];
}
target.style.transition = '1s';
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
});
for (var property of lengthProperties) {
diff --git a/third_party/blink/web_tests/css3/filters/backdrop-filter-browser-zoom.html b/third_party/blink/web_tests/css3/filters/backdrop-filter-browser-zoom.html
index 9cb33ebd..13786bc 100644
--- a/third_party/blink/web_tests/css3/filters/backdrop-filter-browser-zoom.html
+++ b/third_party/blink/web_tests/css3/filters/backdrop-filter-browser-zoom.html
@@ -46,6 +46,6 @@
}
</style>
<script>
- internals.setZoomFactor(1.5);
+ eventSender.setPageZoomFactor(1.5);
</script>
</html>
diff --git a/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-custom-scrollbars.html b/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-custom-scrollbars.html
index fde9980..f5be7e6 100644
--- a/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-custom-scrollbars.html
+++ b/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-custom-scrollbars.html
@@ -46,7 +46,7 @@
"Height with pinch-zoom");
// Apply browser zoom.
- internals.setZoomFactor(browserZoomFactor);
+ eventSender.setPageZoomFactor(browserZoomFactor);
// Verify scrollbar exclusion with browser zoom. Custom scrollbars are
// scaled with browser zoom but remain unchanged with pinch zoom.
diff --git a/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-scrollbars.html b/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-scrollbars.html
index 7c96827..987d243f 100644
--- a/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-scrollbars.html
+++ b/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-exclude-scrollbars.html
@@ -34,7 +34,7 @@
"Height with pinch-zoom");
// Apply browser zoom.
- internals.setZoomFactor(browserZoomFactor);
+ eventSender.setPageZoomFactor(browserZoomFactor);
// Since the scrollbars don't change size to the user as we zoom, they're
// actuall smaller in CSS pixels.
diff --git a/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html b/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html
index 1eeeed2f..4182b22 100644
--- a/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html
+++ b/third_party/blink/web_tests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html
@@ -43,7 +43,7 @@
assert_equals(viewport().scale, 2);
// Apply browser zoom.
- internals.setZoomFactor(browserZoomFactor);
+ eventSender.setPageZoomFactor(browserZoomFactor);
requestAnimationFrame(function() {
t.step(function() {
diff --git a/third_party/blink/web_tests/fast/events/mouse-relative-position-zoomed.html b/third_party/blink/web_tests/fast/events/mouse-relative-position-zoomed.html
index 50a84a7..90467e8 100644
--- a/third_party/blink/web_tests/fast/events/mouse-relative-position-zoomed.html
+++ b/third_party/blink/web_tests/fast/events/mouse-relative-position-zoomed.html
@@ -29,7 +29,7 @@
<script>
function run(zoom, scroll) {
- internals.setZoomFactor(zoom);
+ eventSender.setPageZoomFactor(zoom);
scrollTo(0, scroll);
var result;
var target = document.querySelector("#target");
diff --git a/third_party/blink/web_tests/fast/events/pointerevents/pointer-event-properties-in-iframe.html b/third_party/blink/web_tests/fast/events/pointerevents/pointer-event-properties-in-iframe.html
index cc2d658..d578652 100644
--- a/third_party/blink/web_tests/fast/events/pointerevents/pointer-event-properties-in-iframe.html
+++ b/third_party/blink/web_tests/fast/events/pointerevents/pointer-event-properties-in-iframe.html
@@ -47,7 +47,7 @@
debug('===== scrollX=' + scrollX + ', scrollY=' + scrollY + ', zoomFactor=' + zoomFactor);
document.getElementById('target').contentWindow.scrollTo(scrollX, scrollY);
- internals.setZoomFactor(zoomFactor);
+ eventSender.setPageZoomFactor(zoomFactor);
debug(' *** Mouse events inside iframe ***');
// mouse events inside iframe
diff --git a/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-div-zoomed.html b/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-div-zoomed.html
index b68d3359..b731ea8 100644
--- a/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-div-zoomed.html
+++ b/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-div-zoomed.html
@@ -75,7 +75,7 @@
var x = 45;
var y = 12;
function firstGestureScroll() {
- internals.setZoomFactor(0.5);
+ eventSender.setPageZoomFactor(0.5);
return smoothScroll(40, x, y, GestureSourceType.TOUCH_INPUT, "right",
SPEED_INSTANT);
}
@@ -83,7 +83,7 @@
function secondGestureScroll() {
x = 12;
y = 47;
- internals.setZoomFactor(1.25);
+ eventSender.setPageZoomFactor(1.25);
return smoothScroll(40, x, y, GestureSourceType.TOUCH_INPUT, "down",
SPEED_INSTANT);
}
diff --git a/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html b/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html
index c07191a..cce6d99a 100644
--- a/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html
+++ b/third_party/blink/web_tests/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html
@@ -66,7 +66,7 @@
var x = 10;
var y = 72;
function firstGestureScroll() {
- internals.setZoomFactor(0.5);
+ eventSender.setPageZoomFactor(0.5);
return smoothScroll(70, x, y, GestureSourceType.TOUCH_INPUT, "down",
SPEED_INSTANT);
}
@@ -77,7 +77,7 @@
}
function thirdGestureScroll() {
- internals.setZoomFactor(2.0);
+ eventSender.setPageZoomFactor(2.0);
x = 799;
y = 40;
return smoothScroll(80, x, y, GestureSourceType.TOUCH_INPUT, "down",
diff --git a/third_party/blink/web_tests/fast/events/touch/touch-browser-zoom-scales-radius.html b/third_party/blink/web_tests/fast/events/touch/touch-browser-zoom-scales-radius.html
index 39e5aaa7..d4e6648b 100644
--- a/third_party/blink/web_tests/fast/events/touch/touch-browser-zoom-scales-radius.html
+++ b/third_party/blink/web_tests/fast/events/touch/touch-browser-zoom-scales-radius.html
@@ -40,14 +40,14 @@
shouldBe("radiusX", "4");
shouldBe("radiusY", "10");
- internals.setZoomFactor(2.0);
+ eventSender.setPageZoomFactor(2.0);
debug("===Zoom 2X===");
sendTouchStart(100, 100, 4, 10);
shouldBe("radiusX", "2");
shouldBe("radiusY", "5");
- internals.setZoomFactor(0.5);
+ eventSender.setPageZoomFactor(0.5);
debug("===Zoom 0.5X===");
sendTouchStart(100, 100, 4, 10);
diff --git a/third_party/blink/web_tests/fast/scrolling/scrolling-apis-subpixel.html b/third_party/blink/web_tests/fast/scrolling/scrolling-apis-subpixel.html
index bf0c5a5..350ea7d 100644
--- a/third_party/blink/web_tests/fast/scrolling/scrolling-apis-subpixel.html
+++ b/third_party/blink/web_tests/fast/scrolling/scrolling-apis-subpixel.html
@@ -64,7 +64,7 @@
}, "Set fractional scroll offset without zoom");
test( () => {
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
// Zooming provides additional granularity, regardless of the runtimeFlag
// being enabled or not.
@@ -74,7 +74,7 @@
}, "Set fractional scroll offset when zoomed");
test( () => {
- internals.setZoomFactor(2);
+ eventSender.setPageZoomFactor(2);
// Zooming provides additional granularity but we try to set a value beyond the 0.5 increment.
const setOffset = 4.6;
diff --git a/third_party/blink/web_tests/images/crash-when-zoom-factor-changes.html b/third_party/blink/web_tests/images/crash-when-zoom-factor-changes.html
index 73283505..38f9160 100644
--- a/third_party/blink/web_tests/images/crash-when-zoom-factor-changes.html
+++ b/third_party/blink/web_tests/images/crash-when-zoom-factor-changes.html
@@ -4,5 +4,5 @@
<script>
if (window.testRunner)
testRunner.dumpAsText();
- internals.setZoomFactor(0.75);
+ eventSender.setPageZoomFactor(0.75);
</script>
diff --git a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/backdrop-filter-browser-zoom-expected.png b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/backdrop-filter-browser-zoom-expected.png
index e888571d..9bea54c 100644
--- a/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/backdrop-filter-browser-zoom-expected.png
+++ b/third_party/blink/web_tests/platform/win/virtual/scalefactor200/css3/filters/backdrop-filter-browser-zoom-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/scrollbars/sub-pixel-overflow.html b/third_party/blink/web_tests/scrollbars/sub-pixel-overflow.html
index 3a2742aa..a0525282 100644
--- a/third_party/blink/web_tests/scrollbars/sub-pixel-overflow.html
+++ b/third_party/blink/web_tests/scrollbars/sub-pixel-overflow.html
@@ -17,8 +17,8 @@
</div>
<script>
-if (window.internals) {
- internals.setZoomFactor(1.1);
+if (window.eventSender) {
+ eventSender.setPageZoomFactor(1.1);
}
test(() => {
let container = document.getElementById('scroller-container');
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom-ref.html b/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom-ref.html
index 4f4f9b49..8736b34 100644
--- a/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom-ref.html
+++ b/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom-ref.html
@@ -5,4 +5,4 @@
<body style="margin: 0; padding: 0;">
<div style="font-size: 3ex">size should be 3ex</div>
<div style="font-size: 3ch">size should be 3ch</div>
-</body>
\ No newline at end of file
+</body>
diff --git a/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom.html b/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom.html
index 65c0e32..79fb400 100644
--- a/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom.html
+++ b/third_party/blink/web_tests/wpt_internal/css/css-fonts/font-size-ex-ch-with-zoom.html
@@ -12,7 +12,7 @@
</body>
<script>
- if (window.internals) {
- internals.setZoomFactor(3);
+ if (window.eventSender) {
+ eventSender.setPageZoomFactor(3);
}
-</script>
\ No newline at end of file
+</script>