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

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

Issue 1804023002: Fix page zoom to be frame-centric for out-of-process frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't use WeakPtr for PostTask on UI thread. Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1425 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1426 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1426 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1427 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1427 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1428 OnGetSavableResourceLinks) 1428 OnGetSavableResourceLinks)
1429 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1429 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1430 OnGetSerializedHtmlWithLocalLinks) 1430 OnGetSerializedHtmlWithLocalLinks)
1431 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1431 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1432 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1432 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1433 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1433 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1434 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1434 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1435 IPC_MESSAGE_HANDLER(FrameMsg_SetTemporaryZoomLevel, OnSetTemporaryZoomLevel)
1436 IPC_MESSAGE_HANDLER(FrameMsg_SetZoomLevelFromWebContents,
alexmos 2016/04/05 18:00:54 "FromWebContents" sounded a bit weird in the name.
wjmaclean 2016/04/05 20:22:00 Sure, I'm OK with that. Done.
1437 OnSetZoomLevelFromWebContents)
1435 #if defined(OS_ANDROID) 1438 #if defined(OS_ANDROID)
1436 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1439 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1437 OnActivateNearestFindResult) 1440 OnActivateNearestFindResult)
1438 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) 1441 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects)
1439 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1442 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1440 #elif defined(OS_MACOSX) 1443 #elif defined(OS_MACOSX)
1441 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1444 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1442 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) 1445 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard)
1443 #endif 1446 #endif
1444 IPC_END_MESSAGE_MAP() 1447 IPC_END_MESSAGE_MAP()
(...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after
5096 } 5099 }
5097 } 5100 }
5098 } 5101 }
5099 5102
5100 void RenderFrameImpl::OnEnableViewSourceMode() { 5103 void RenderFrameImpl::OnEnableViewSourceMode() {
5101 DCHECK(frame_); 5104 DCHECK(frame_);
5102 DCHECK(!frame_->parent()); 5105 DCHECK(!frame_->parent());
5103 frame_->enableViewSourceMode(true); 5106 frame_->enableViewSourceMode(true);
5104 } 5107 }
5105 5108
5109 void RenderFrameImpl::OnSetTemporaryZoomLevel(double zoom_level,
5110 bool is_temporary) {
5111 // Store the temporary status on render_view_ so it is immediately available
5112 // to all frames using the same render_view_.
5113 render_view_->set_uses_temporary_zoom_level(is_temporary);
5114
5115 WebView* webview = render_view_->GetWebView();
5116 webview->hidePopups();
5117 webview->setZoomLevelForFrame(frame_, zoom_level);
5118 }
5119
5120 void RenderFrameImpl::OnSetZoomLevelFromWebContents(double zoom_level) {
5121 WebView* webview = render_view_->GetWebView();
5122
5123 if (render_view_->uses_temporary_zoom_level())
5124 return;
5125
5126 // We don't apply if our RenderView is hosting a full-page plugin, since the
5127 // plugin doesn't use the same zoom settings.
5128 if (webview->mainFrame()->isWebLocalFrame() &&
5129 webview->mainFrame()->document().isPluginDocument()) {
5130 return;
5131 }
5132
5133 // Force sending notification to observers.
5134 render_view_->SetZoomLevel(zoom_level);
5135
5136 webview->hidePopups();
5137 webview->setZoomLevelForFrame(frame_, zoom_level);
5138 }
5139
5106 #if defined(OS_ANDROID) 5140 #if defined(OS_ANDROID)
5107 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, 5141 void RenderFrameImpl::OnActivateNearestFindResult(int request_id,
5108 float x, 5142 float x,
5109 float y) { 5143 float y) {
5110 WebRect selection_rect; 5144 WebRect selection_rect;
5111 int ordinal = 5145 int ordinal =
5112 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); 5146 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect);
5113 if (ordinal == -1) { 5147 if (ordinal == -1) {
5114 // Something went wrong, so send a no-op reply (force the frame to report 5148 // Something went wrong, so send a no-op reply (force the frame to report
5115 // the current match count) in case the host is waiting for a response due 5149 // the current match count) in case the host is waiting for a response due
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
6011 int match_count, 6045 int match_count,
6012 int ordinal, 6046 int ordinal,
6013 const WebRect& selection_rect, 6047 const WebRect& selection_rect,
6014 bool final_status_update) { 6048 bool final_status_update) {
6015 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6049 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6016 selection_rect, ordinal, 6050 selection_rect, ordinal,
6017 final_status_update)); 6051 final_status_update));
6018 } 6052 }
6019 6053
6020 } // namespace content 6054 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698