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

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: Give OnPageScaleFactorChanged suitable behaviour upon navigation 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 #endif 651 #endif
652 #if defined(OS_WIN) 652 #if defined(OS_WIN)
653 focused_plugin_id_(-1), 653 focused_plugin_id_(-1),
654 #endif 654 #endif
655 #if defined(ENABLE_PLUGINS) 655 #if defined(ENABLE_PLUGINS)
656 plugin_find_handler_(NULL), 656 plugin_find_handler_(NULL),
657 focused_pepper_plugin_(NULL), 657 focused_pepper_plugin_(NULL),
658 pepper_last_mouse_event_target_(NULL), 658 pepper_last_mouse_event_target_(NULL),
659 #endif 659 #endif
660 enumeration_completion_id_(0), 660 enumeration_completion_id_(0),
661 session_storage_namespace_id_(params.session_storage_namespace_id), 661 session_storage_namespace_id_(params.session_storage_namespace_id) {
662 page_scale_factor_is_one_(true) {
663 } 662 }
664 663
665 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, 664 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params,
666 bool was_created_by_renderer) { 665 bool was_created_by_renderer) {
667 routing_id_ = params.view_id; 666 routing_id_ = params.view_id;
668 667
669 int opener_view_routing_id; 668 int opener_view_routing_id;
670 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( 669 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener(
671 params.opener_frame_route_id, &opener_view_routing_id); 670 params.opener_frame_route_id, &opener_view_routing_id);
672 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) 671 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer)
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1290 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1292 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1291 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1293 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1292 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1294 OnScrollFocusedEditableNodeIntoRect) 1293 OnScrollFocusedEditableNodeIntoRect)
1295 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, 1294 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1296 OnSetEditCommandsForNextKeyEvent) 1295 OnSetEditCommandsForNextKeyEvent)
1297 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 1296 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1298 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) 1297 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
1299 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 1298 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
1300 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 1299 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
1301 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale) 1300 IPC_MESSAGE_HANDLER(ViewMsg_GetPageScale, OnGetPageScale)
1301 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale)
1302 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1302 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1303 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1303 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1304 OnSetZoomLevelForLoadingURL) 1304 OnSetZoomLevelForLoadingURL)
1305 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, 1305 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView,
1306 OnSetZoomLevelForView) 1306 OnSetZoomLevelForView)
1307 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 1307 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
1308 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 1308 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
1309 OnResetPageEncodingToDefault) 1309 OnResetPageEncodingToDefault)
1310 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) 1310 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter)
1311 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) 1311 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver)
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 } 2449 }
2450 2450
2451 gfx::RectF active_rect = main_frame->activeFindMatchRect(); 2451 gfx::RectF active_rect = main_frame->activeFindMatchRect();
2452 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_, 2452 Send(new ViewHostMsg_FindMatchRects_Reply(routing_id_,
2453 rects_version, 2453 rects_version,
2454 match_rects, 2454 match_rects,
2455 active_rect)); 2455 active_rect));
2456 } 2456 }
2457 #endif 2457 #endif
2458 2458
2459 void RenderViewImpl::OnResetPageScale() { 2459 void RenderViewImpl::OnGetPageScale() {
2460 // Update the browser with the current page scale factor
2461 // by sending an extra notification.
2462 pageScaleFactorChanged();
2463 }
2464
2465 void RenderViewImpl::OnSetPageScale(float page_scale_factor) {
2460 if (!webview()) 2466 if (!webview())
2461 return; 2467 return;
2462 webview()->setPageScaleFactor(1); 2468 webview()->setPageScaleFactor(page_scale_factor);
2463 } 2469 }
2464 2470
2465 void RenderViewImpl::OnZoom(PageZoom zoom) { 2471 void RenderViewImpl::OnZoom(PageZoom zoom) {
2466 if (!webview()) // Not sure if this can happen, but no harm in being safe. 2472 if (!webview()) // Not sure if this can happen, but no harm in being safe.
2467 return; 2473 return;
2468 2474
2469 webview()->hidePopups(); 2475 webview()->hidePopups();
2470 2476
2471 double old_zoom_level = webview()->zoomLevel(); 2477 double old_zoom_level = webview()->zoomLevel();
2472 double zoom_level; 2478 double zoom_level;
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 // saved values if necessary 3371 // saved values if necessary
3366 Send(new ViewHostMsg_DidZoomURL( 3372 Send(new ViewHostMsg_DidZoomURL(
3367 routing_id_, zoom_level, 3373 routing_id_, zoom_level,
3368 GURL(webview()->mainFrame()->document().url()))); 3374 GURL(webview()->mainFrame()->document().url())));
3369 } 3375 }
3370 } 3376 }
3371 3377
3372 void RenderViewImpl::pageScaleFactorChanged() { 3378 void RenderViewImpl::pageScaleFactorChanged() {
3373 if (!webview()) 3379 if (!webview())
3374 return; 3380 return;
3375 bool page_scale_factor_is_one = webview()->pageScaleFactor() == 1; 3381
3376 if (page_scale_factor_is_one == page_scale_factor_is_one_) 3382 Send(new ViewHostMsg_PageScaleFactorChanged(routing_id_,
3377 return; 3383 webview()->pageScaleFactor()));
3378 page_scale_factor_is_one_ = page_scale_factor_is_one;
3379 Send(new ViewHostMsg_PageScaleFactorIsOneChanged(routing_id_,
3380 page_scale_factor_is_one_));
3381 } 3384 }
3382 3385
3383 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const { 3386 double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const {
3384 return ZoomLevelToZoomFactor(zoom_level); 3387 return ZoomLevelToZoomFactor(zoom_level);
3385 } 3388 }
3386 3389
3387 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { 3390 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const {
3388 return ZoomFactorToZoomLevel(factor); 3391 return ZoomFactorToZoomLevel(factor);
3389 } 3392 }
3390 3393
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3686 std::vector<gfx::Size> sizes; 3689 std::vector<gfx::Size> sizes;
3687 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3690 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3688 if (!url.isEmpty()) 3691 if (!url.isEmpty())
3689 urls.push_back( 3692 urls.push_back(
3690 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3693 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3691 } 3694 }
3692 SendUpdateFaviconURL(urls); 3695 SendUpdateFaviconURL(urls);
3693 } 3696 }
3694 3697
3695 } // namespace content 3698 } // 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