Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Cherry-picking into M41 branch 2272.
Browse files Browse the repository at this point in the history
Update guest zoom when it differs from the embedder's.

In some cases, for example deleting a zoom level via Content Settings,
the generated ZoomChangeEventData does not know the old zoom level and
just sets it to be the same as the new level, even though it did change.

GuestViewBase::OnZoomChanged() should therefore compare the new zoom
level against the guest's zoom level when deciding if it should early-
out.

BUG=447542

Review URL: https://codereview.chromium.org/819613003

Cr-Commit-Position: refs/heads/master@{#311722}
(cherry picked from commit 4b1d3a8)

Review URL: https://codereview.chromium.org/800913006

Cr-Commit-Position: refs/branch-heads/2272@{#39}
Cr-Branched-From: 827a380-refs/heads/master@{#310958}
  • Loading branch information
Penny MacNeil committed Jan 16, 2015
1 parent c6669eb commit 642f5df
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions extensions/browser/guest_view/guest_view_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,15 @@ GuestViewBase::~GuestViewBase() {

void GuestViewBase::OnZoomChanged(
const ui_zoom::ZoomController::ZoomChangedEventData& data) {
if (content::ZoomValuesEqual(data.old_zoom_level, data.new_zoom_level))
auto guest_zoom_controller =
ui_zoom::ZoomController::FromWebContents(web_contents());
if (content::ZoomValuesEqual(data.new_zoom_level,
guest_zoom_controller->GetZoomLevel())) {
return;
// When the embedder's zoom level is changed, then we also update the
}
// When the embedder's zoom level doesn't match the guest's, then update the
// guest's zoom level to match.
ui_zoom::ZoomController::FromWebContents(web_contents())
->SetZoomLevel(data.new_zoom_level);
guest_zoom_controller->SetZoomLevel(data.new_zoom_level);
}

void GuestViewBase::DispatchEventToEmbedder(Event* event) {
Expand Down

0 comments on commit 642f5df

Please sign in to comment.