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

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

Issue 1408393003: Propagate pageScaleFactor to GuestViews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant initialization of AwLayoutSizer's page scale factor in tests Created 5 years, 1 month 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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 #endif 652 #endif
653 #if defined(OS_WIN) 653 #if defined(OS_WIN)
654 focused_plugin_id_(-1), 654 focused_plugin_id_(-1),
655 #endif 655 #endif
656 #if defined(ENABLE_PLUGINS) 656 #if defined(ENABLE_PLUGINS)
657 plugin_find_handler_(NULL), 657 plugin_find_handler_(NULL),
658 focused_pepper_plugin_(NULL), 658 focused_pepper_plugin_(NULL),
659 pepper_last_mouse_event_target_(NULL), 659 pepper_last_mouse_event_target_(NULL),
660 #endif 660 #endif
661 enumeration_completion_id_(0), 661 enumeration_completion_id_(0),
662 session_storage_namespace_id_(params.session_storage_namespace_id), 662 session_storage_namespace_id_(params.session_storage_namespace_id) {
663 page_scale_factor_is_one_(true) {
664 } 663 }
665 664
666 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, 665 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params,
667 bool was_created_by_renderer) { 666 bool was_created_by_renderer) {
668 routing_id_ = params.view_id; 667 routing_id_ = params.view_id;
669 668
670 int opener_view_routing_id; 669 int opener_view_routing_id;
671 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( 670 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener(
672 params.opener_frame_route_id, &opener_view_routing_id); 671 params.opener_frame_route_id, &opener_view_routing_id);
673 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) 672 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer)
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1294 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1296 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1295 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1297 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1296 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1298 OnScrollFocusedEditableNodeIntoRect) 1297 OnScrollFocusedEditableNodeIntoRect)
1299 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, 1298 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1300 OnSetEditCommandsForNextKeyEvent) 1299 OnSetEditCommandsForNextKeyEvent)
1301 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 1300 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1302 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) 1301 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
1303 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 1302 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
1304 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 1303 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
1305 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale) 1304 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale)
1306 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1305 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1307 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1306 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1308 OnSetZoomLevelForLoadingURL) 1307 OnSetZoomLevelForLoadingURL)
1309 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, 1308 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView,
1310 OnSetZoomLevelForView) 1309 OnSetZoomLevelForView)
1311 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 1310 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
1312 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 1311 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
1313 OnResetPageEncodingToDefault) 1312 OnResetPageEncodingToDefault)
1314 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) 1313 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter)
1315 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) 1314 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver)
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 } 2453 }
2455 2454
2456 gfx::RectF active_rect = main_frame->activeFindMatchRect(); 2455 gfx::RectF active_rect = main_frame->activeFindMatchRect();
2457 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, 2456 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_,
2458 rects_version, 2457 rects_version,
2459 match_rects, 2458 match_rects,
2460 active_rect)); 2459 active_rect));
2461 } 2460 }
2462 #endif 2461 #endif
2463 2462
2464 void RenderViewImpl::OnResetPageScale() { 2463 void RenderViewImpl::OnSetPageScale(float page_scale_factor) {
2465 if (!webview()) 2464 if (!webview())
2466 return; 2465 return;
2467 webview()->setPageScaleFactor(1); 2466 webview()->setPageScaleFactor(page_scale_factor);
2468 } 2467 }
2469 2468
2470 void RenderViewImpl::OnZoom(PageZoom zoom) { 2469 void RenderViewImpl::OnZoom(PageZoom zoom) {
2471 if (!webview()) // Not sure if this can happen, but no harm in being safe. 2470 if (!webview()) // Not sure if this can happen, but no harm in being safe.
2472 return; 2471 return;
2473 2472
2474 webview()->hidePopups(); 2473 webview()->hidePopups();
2475 2474
2476 double old_zoom_level = webview()->zoomLevel(); 2475 double old_zoom_level = webview()->zoomLevel();
2477 double zoom_level; 2476 double zoom_level;
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 // saved values if necessary 3375 // saved values if necessary
3377 Send(new ViewHostMsg_DidZoomURL( 3376 Send(new ViewHostMsg_DidZoomURL(
3378 routing_id_, zoom_level, 3377 routing_id_, zoom_level,
3379 GURL(webview()->mainFrame()->document().url()))); 3378 GURL(webview()->mainFrame()->document().url())));
3380 } 3379 }
3381 } 3380 }
3382 3381
3383 void RenderViewImpl::pageScaleFactorChanged() { 3382 void RenderViewImpl::pageScaleFactorChanged() {
3384 if (!webview()) 3383 if (!webview())
3385 return; 3384 return;
3386 bool page_scale_factor_is_one = webview()->pageScaleFactor() == 1; 3385
wjmaclean 2015/11/18 16:37:37 I notice that AwRenderViewExt always checks to see
Kevin McNee - google account 2015/11/18 19:41:34 AwRenderViewExt was polling for changes to the pag
3387 if (page_scale_factor_is_one == page_scale_factor_is_one_) 3386 Send(new ViewHostMsg_PageScaleFactorChanged(routing_id_,
3388 return; 3387 webview()->pageScaleFactor()));
wjmaclean 2015/11/18 16:37:37 Is this only meant to catch the case when the page
Kevin McNee - google account 2015/11/18 19:41:34 The former. Previously the browser only cared abou
3389 page_scale_factor_is_one_ = page_scale_factor_is_one;
3390 Send(new ViewHostMsg_PageScaleFactorIsOneChanged(routing_id_,
3391 page_scale_factor_is_one_));
3392 } 3388 }
3393 3389
3394 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { 3390 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const {
3395 return ZoomLevelToZoomFactor(zoom_level); 3391 return ZoomLevelToZoomFactor(zoom_level);
3396 } 3392 }
3397 3393
3398 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { 3394 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const {
3399 return ZoomFactorToZoomLevel(factor); 3395 return ZoomFactorToZoomLevel(factor);
3400 } 3396 }
3401 3397
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3697 std::vector<gfx::Size> sizes; 3693 std::vector<gfx::Size> sizes;
3698 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3694 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3699 if (!url.isEmpty()) 3695 if (!url.isEmpty())
3700 urls.push_back( 3696 urls.push_back(
3701 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3697 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3702 } 3698 }
3703 SendUpdateFaviconURL(urls); 3699 SendUpdateFaviconURL(urls);
3704 } 3700 }
3705 3701
3706 } // namespace content 3702 } // namespace content
OLDNEW
« content/browser/web_contents/web_contents_impl.cc ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698