Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2652643004: Make PageScaleFactor work for oopif subframes.
Patch Set: Fix patch gardening error: GesturePinch routing tests. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, 1234 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap,
1235 OnReleaseDisambiguationPopupBitmap) 1235 OnReleaseDisambiguationPopupBitmap)
1236 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) 1236 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw)
1237 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1237 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1238 1238
1239 // Page messages. 1239 // Page messages.
1240 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, 1240 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect,
1241 OnUpdateWindowScreenRect) 1241 OnUpdateWindowScreenRect)
1242 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevel) 1242 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevel)
1243 IPC_MESSAGE_HANDLER(PageMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor); 1243 IPC_MESSAGE_HANDLER(PageMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor);
1244 IPC_MESSAGE_HANDLER(PageMsg_SetPageScaleFactor,
1245 OnSetPageScaleFactorForSubframes);
1244 IPC_MESSAGE_HANDLER(PageMsg_WasHidden, OnPageWasHidden) 1246 IPC_MESSAGE_HANDLER(PageMsg_WasHidden, OnPageWasHidden)
1245 IPC_MESSAGE_HANDLER(PageMsg_WasShown, OnPageWasShown) 1247 IPC_MESSAGE_HANDLER(PageMsg_WasShown, OnPageWasShown)
1246 IPC_MESSAGE_HANDLER(PageMsg_SetHistoryOffsetAndLength, 1248 IPC_MESSAGE_HANDLER(PageMsg_SetHistoryOffsetAndLength,
1247 OnSetHistoryOffsetAndLength) 1249 OnSetHistoryOffsetAndLength)
1248 IPC_MESSAGE_HANDLER(PageMsg_AudioStateChanged, OnAudioStateChanged) 1250 IPC_MESSAGE_HANDLER(PageMsg_AudioStateChanged, OnAudioStateChanged)
1249 1251
1250 #if defined(OS_ANDROID) 1252 #if defined(OS_ANDROID)
1251 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserControlsState, 1253 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserControlsState,
1252 OnUpdateBrowserControlsState) 1254 OnUpdateBrowserControlsState)
1253 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) 1255 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 GetWidget()->FocusChangeComplete(); 2371 GetWidget()->FocusChangeComplete();
2370 } 2372 }
2371 2373
2372 void RenderViewImpl::OnDeviceScaleFactorChanged() { 2374 void RenderViewImpl::OnDeviceScaleFactorChanged() {
2373 RenderWidget::OnDeviceScaleFactorChanged(); 2375 RenderWidget::OnDeviceScaleFactorChanged();
2374 UpdateWebViewWithDeviceScaleFactor(); 2376 UpdateWebViewWithDeviceScaleFactor();
2375 if (auto_resize_mode_) 2377 if (auto_resize_mode_)
2376 AutoResizeCompositor(); 2378 AutoResizeCompositor();
2377 } 2379 }
2378 2380
2381 void RenderViewImpl::OnSetPageScaleFactorForSubframes(double page_scale) {
2382 if (webview() && webview()->mainFrame() &&
2383 !webview()->mainFrame()->isWebLocalFrame()) {
kenrb 2017/01/24 17:13:27 It's cleaner to test the inverted conditions, and
wjmaclean 2017/01/24 18:24:26 Done.
2384 // TODO(wjmaclean): Find a better way to identify the local roots in the
2385 // frame tree. Still, this is likely better than sending a separate IPC for
2386 // every frame in a renderer.
kenrb 2017/01/24 17:13:27 That is technically true, but an alternative is to
wjmaclean 2017/01/24 18:24:26 Ok, I didn't know about that ... I'll look into th
kenrb 2017/01/24 18:47:30 Yes. Hypothetically it could go on RenderFrameImpl
2387 for (WebFrame* frame = webview()->mainFrame(); frame;
2388 frame = frame->traverseNext()) {
2389 if (frame->isWebLocalFrame() && !frame->parent()->isWebLocalFrame()) {
2390 RenderFrameImpl* rfi = RenderFrameImpl::FromWebFrame(frame);
2391 RenderWidgetCompositor* widget_compositor =
2392 rfi->GetRenderWidget()->compositor();
2393 widget_compositor->SetPageScaleFactorForSubframe(page_scale);
2394 }
2395 }
2396 }
2397 }
2398
2379 void RenderViewImpl::SetScreenMetricsEmulationParameters( 2399 void RenderViewImpl::SetScreenMetricsEmulationParameters(
2380 bool enabled, 2400 bool enabled,
2381 const blink::WebDeviceEmulationParams& params) { 2401 const blink::WebDeviceEmulationParams& params) {
2382 if (webview() && compositor()) { 2402 if (webview() && compositor()) {
2383 if (enabled) 2403 if (enabled)
2384 webview()->enableDeviceEmulation(params); 2404 webview()->enableDeviceEmulation(params);
2385 else 2405 else
2386 webview()->disableDeviceEmulation(); 2406 webview()->disableDeviceEmulation();
2387 } 2407 }
2388 } 2408 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2747 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2728 } 2748 }
2729 2749
2730 std::unique_ptr<InputEventAck> ack( 2750 std::unique_ptr<InputEventAck> ack(
2731 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), 2751 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(),
2732 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2752 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2733 OnInputEventAck(std::move(ack)); 2753 OnInputEventAck(std::move(ack));
2734 } 2754 }
2735 2755
2736 } // namespace content 2756 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698