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

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: Address alexmos@ comments, run two experiments. 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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1436 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1437 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1437 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1438 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1438 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1439 OnGetSavableResourceLinks) 1439 OnGetSavableResourceLinks)
1440 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1440 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1441 OnGetSerializedHtmlWithLocalLinks) 1441 OnGetSerializedHtmlWithLocalLinks)
1442 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1442 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1443 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1443 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1444 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1444 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1445 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1445 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1446 IPC_MESSAGE_HANDLER(FrameMsg_SetTemporaryZoomLevel, OnSetTemporaryZoomLevel)
1447 IPC_MESSAGE_HANDLER(FrameMsg_SetPageZoomLevel, OnSetPageZoomLevel)
1446 #if defined(OS_ANDROID) 1448 #if defined(OS_ANDROID)
1447 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1449 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1448 OnActivateNearestFindResult) 1450 OnActivateNearestFindResult)
1449 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) 1451 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects)
1450 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1452 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1451 #elif defined(OS_MACOSX) 1453 #elif defined(OS_MACOSX)
1452 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1454 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1453 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) 1455 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard)
1454 #endif 1456 #endif
1455 IPC_END_MESSAGE_MAP() 1457 IPC_END_MESSAGE_MAP()
(...skipping 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after
5116 } 5118 }
5117 } 5119 }
5118 } 5120 }
5119 5121
5120 void RenderFrameImpl::OnEnableViewSourceMode() { 5122 void RenderFrameImpl::OnEnableViewSourceMode() {
5121 DCHECK(frame_); 5123 DCHECK(frame_);
5122 DCHECK(!frame_->parent()); 5124 DCHECK(!frame_->parent());
5123 frame_->enableViewSourceMode(true); 5125 frame_->enableViewSourceMode(true);
5124 } 5126 }
5125 5127
5128 void RenderFrameImpl::OnSetTemporaryZoomLevel(double zoom_level,
5129 bool is_temporary) {
5130 // Store the temporary status on render_view_ so it is immediately available
5131 // to all frames using the same render_view_.
5132 render_view_->set_uses_temporary_zoom_level(is_temporary);
5133
5134 WebView* webview = render_view_->GetWebView();
5135 webview->hidePopups();
5136 webview->setZoomLevelForFrame(frame_, zoom_level);
5137 }
5138
5139 void RenderFrameImpl::OnSetPageZoomLevel(double zoom_level) {
5140 WebView* webview = render_view_->GetWebView();
5141
5142 if (render_view_->uses_temporary_zoom_level())
5143 return;
5144
5145 // We don't apply if our RenderView is hosting a full-page plugin, since the
5146 // plugin doesn't use the same zoom settings.
5147 if (webview->mainFrame()->isWebLocalFrame() &&
5148 webview->mainFrame()->document().isPluginDocument()) {
5149 return;
5150 }
5151
5152 // Force sending notification to observers.
5153 render_view_->SetZoomLevel(zoom_level);
5154
5155 webview->hidePopups();
5156 webview->setZoomLevelForFrame(frame_, zoom_level);
5157 }
5158
5126 #if defined(OS_ANDROID) 5159 #if defined(OS_ANDROID)
5127 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, 5160 void RenderFrameImpl::OnActivateNearestFindResult(int request_id,
5128 float x, 5161 float x,
5129 float y) { 5162 float y) {
5130 WebRect selection_rect; 5163 WebRect selection_rect;
5131 int ordinal = 5164 int ordinal =
5132 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); 5165 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect);
5133 if (ordinal == -1) { 5166 if (ordinal == -1) {
5134 // Something went wrong, so send a no-op reply (force the frame to report 5167 // Something went wrong, so send a no-op reply (force the frame to report
5135 // the current match count) in case the host is waiting for a response due 5168 // the current match count) in case the host is waiting for a response due
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
6032 int match_count, 6065 int match_count,
6033 int ordinal, 6066 int ordinal,
6034 const WebRect& selection_rect, 6067 const WebRect& selection_rect,
6035 bool final_status_update) { 6068 bool final_status_update) {
6036 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6069 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6037 selection_rect, ordinal, 6070 selection_rect, ordinal,
6038 final_status_update)); 6071 final_status_update));
6039 } 6072 }
6040 6073
6041 } // namespace content 6074 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698