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

Unified Diff: content/renderer/render_view_impl.cc

Issue 197873002: [Android] Suppress redundant autozoom for nodes already autozoomed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 7a79a498a90c1ded365840f87357a34a9a808486..bbba8305ecc5393416d79352a0dd3b8e51f00295 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -667,6 +667,7 @@ RenderViewImpl::RenderViewImpl(RenderViewImplParams* params)
cached_is_main_frame_pinned_to_right_(false),
cached_has_main_frame_horizontal_scrollbar_(false),
cached_has_main_frame_vertical_scrollbar_(false),
+ has_scrolled_focused_editable_node_into_rect_(false),
notification_provider_(NULL),
geolocation_dispatcher_(NULL),
input_tag_speech_dispatcher_(NULL),
@@ -1163,8 +1164,6 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
OnActivateNearestFindResult)
IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
- IPC_MESSAGE_HANDLER(ViewMsg_UndoScrollFocusedEditableNodeIntoView,
- OnUndoScrollFocusedEditableNodeIntoRect)
IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
OnUpdateTopControlsState)
IPC_MESSAGE_HANDLER(ViewMsg_PauseVideo, OnPauseVideo)
@@ -1335,12 +1334,16 @@ void RenderViewImpl::OnReplaceMisspelling(const base::string16& text) {
void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect(
const gfx::Rect& rect) {
+ if (has_scrolled_focused_editable_node_into_rect_ &&
+ rect == rect_for_scrolled_focused_editable_node_) {
+ return;
+ }
+
blink::WebElement element = GetFocusedElement();
- if (!element.isNull()) {
- if (IsEditableNode(element)) {
- webview()->saveScrollAndScaleState();
- webview()->scrollFocusedNodeIntoRect(rect);
- }
+ if (!element.isNull() && IsEditableNode(element)) {
+ rect_for_scrolled_focused_editable_node_ = rect;
+ has_scrolled_focused_editable_node_into_rect_ = true;
+ webview()->scrollFocusedNodeIntoRect(rect);
}
}
@@ -1472,12 +1475,6 @@ void RenderViewImpl::OnSetInLiveResize(bool in_live_resize) {
#endif
#if defined(OS_ANDROID)
-void RenderViewImpl::OnUndoScrollFocusedEditableNodeIntoRect() {
- const WebElement element = GetFocusedElement();
- if (!element.isNull() && IsEditableNode(element))
- webview()->restoreScrollAndScaleState();
-}
-
void RenderViewImpl::OnPauseVideo() {
// Inform RendererMediaPlayerManager to release all video player resources.
// If something is in progress the resource will not be freed, it will
@@ -2161,6 +2158,8 @@ void RenderViewImpl::focusPrevious() {
}
void RenderViewImpl::focusedNodeChanged(const WebNode& node) {
+ has_scrolled_focused_editable_node_into_rect_ = false;
+
Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node)));
FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node));
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698