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

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

Issue 1990553002: Remove RenderViewImpl::GetFocusedElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really works now. Created 4 years, 7 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 (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 #include <memory> 9 #include <memory>
10 10
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 } 1401 }
1402 1402
1403 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( 1403 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect(
1404 const gfx::Rect& rect) { 1404 const gfx::Rect& rect) {
1405 if (has_scrolled_focused_editable_node_into_rect_ && 1405 if (has_scrolled_focused_editable_node_into_rect_ &&
1406 rect == rect_for_scrolled_focused_editable_node_) { 1406 rect == rect_for_scrolled_focused_editable_node_) {
1407 GetWidget()->FocusChangeComplete(); 1407 GetWidget()->FocusChangeComplete();
1408 return; 1408 return;
1409 } 1409 }
1410 1410
1411 blink::WebElement element = GetFocusedElement(); 1411 if (!webview()->scrollFocusedEditableElementIntoRect(rect))
1412 bool will_animate = false; 1412 return;
1413 if (!element.isNull() && element.isEditable()) {
1414 rect_for_scrolled_focused_editable_node_ = rect;
1415 has_scrolled_focused_editable_node_into_rect_ = true;
1416 will_animate = webview()->scrollFocusedNodeIntoRect(rect);
1417 }
1418 1413
1419 if (!will_animate) 1414 rect_for_scrolled_focused_editable_node_ = rect;
1415 has_scrolled_focused_editable_node_into_rect_ = true;
1416 if (!compositor()->hasPendingPageScaleAnimation())
enne (OOO) 2016/05/18 19:30:29 I don't know this code at all, but what's the goal
dglazkov 2016/05/18 19:50:34 I am hoping not to make any functional changes --
dglazkov 2016/05/19 04:12:31 Oh, I think you meant the code that was there befo
1420 GetWidget()->FocusChangeComplete(); 1417 GetWidget()->FocusChangeComplete();
1421 } 1418 }
1422 1419
1423 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( 1420 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent(
1424 const EditCommands& edit_commands) { 1421 const EditCommands& edit_commands) {
1425 edit_commands_ = edit_commands; 1422 edit_commands_ = edit_commands;
1426 } 1423 }
1427 1424
1428 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, 1425 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset,
1429 int history_length) { 1426 int history_length) {
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 } 2315 }
2319 2316
2320 void RenderViewImpl::DidStartLoading() { 2317 void RenderViewImpl::DidStartLoading() {
2321 main_render_frame_->didStartLoading(true); 2318 main_render_frame_->didStartLoading(true);
2322 } 2319 }
2323 2320
2324 void RenderViewImpl::DidStopLoading() { 2321 void RenderViewImpl::DidStopLoading() {
2325 main_render_frame_->didStopLoading(); 2322 main_render_frame_->didStopLoading();
2326 } 2323 }
2327 2324
2328 blink::WebElement RenderViewImpl::GetFocusedElement() const {
2329 if (!webview())
2330 return WebElement();
2331 WebFrame* focused_frame = webview()->focusedFrame();
2332 if (focused_frame) {
2333 WebDocument doc = focused_frame->document();
2334 if (!doc.isNull())
2335 return doc.focusedElement();
2336 }
2337
2338 return WebElement();
2339 }
2340
2341 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { 2325 void RenderViewImpl::OnSetPageScale(float page_scale_factor) {
2342 if (!webview()) 2326 if (!webview())
2343 return; 2327 return;
2344 webview()->setPageScaleFactor(page_scale_factor); 2328 webview()->setPageScaleFactor(page_scale_factor);
2345 } 2329 }
2346 2330
2347 void RenderViewImpl::OnZoom(PageZoom zoom) { 2331 void RenderViewImpl::OnZoom(PageZoom zoom) {
2348 if (!webview()) // Not sure if this can happen, but no harm in being safe. 2332 if (!webview()) // Not sure if this can happen, but no harm in being safe.
2349 return; 2333 return;
2350 2334
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
3403 return render_frame->focused_pepper_plugin(); 3387 return render_frame->focused_pepper_plugin();
3404 } 3388 }
3405 frame = frame->traverseNext(false); 3389 frame = frame->traverseNext(false);
3406 } 3390 }
3407 3391
3408 return nullptr; 3392 return nullptr;
3409 } 3393 }
3410 #endif 3394 #endif
3411 3395
3412 } // namespace content 3396 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698