Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(); | |
| 1412 bool will_animate = false; | 1411 bool will_animate = false; |
| 1413 if (!element.isNull() && element.isEditable()) { | 1412 if (!webview()->scrollFocusedEditableElementIntoRect(rect, will_animate)) |
|
esprehn
2016/05/17 22:16:43
This out param is pretty gross, maybe we can know
| |
| 1414 rect_for_scrolled_focused_editable_node_ = rect; | 1413 return; |
| 1415 has_scrolled_focused_editable_node_into_rect_ = true; | |
| 1416 will_animate = webview()->scrollFocusedNodeIntoRect(rect); | |
| 1417 } | |
| 1418 | 1414 |
| 1415 rect_for_scrolled_focused_editable_node_ = rect; | |
| 1416 has_scrolled_focused_editable_node_into_rect_ = true; | |
| 1419 if (!will_animate) | 1417 if (!will_animate) |
| 1420 GetWidget()->FocusChangeComplete(); | 1418 GetWidget()->FocusChangeComplete(); |
| 1421 } | 1419 } |
| 1422 | 1420 |
| 1423 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( | 1421 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( |
| 1424 const EditCommands& edit_commands) { | 1422 const EditCommands& edit_commands) { |
| 1425 edit_commands_ = edit_commands; | 1423 edit_commands_ = edit_commands; |
| 1426 } | 1424 } |
| 1427 | 1425 |
| 1428 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, | 1426 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2318 } | 2316 } |
| 2319 | 2317 |
| 2320 void RenderViewImpl::DidStartLoading() { | 2318 void RenderViewImpl::DidStartLoading() { |
| 2321 main_render_frame_->didStartLoading(true); | 2319 main_render_frame_->didStartLoading(true); |
| 2322 } | 2320 } |
| 2323 | 2321 |
| 2324 void RenderViewImpl::DidStopLoading() { | 2322 void RenderViewImpl::DidStopLoading() { |
| 2325 main_render_frame_->didStopLoading(); | 2323 main_render_frame_->didStopLoading(); |
| 2326 } | 2324 } |
| 2327 | 2325 |
| 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) { | 2326 void RenderViewImpl::OnSetPageScale(float page_scale_factor) { |
| 2342 if (!webview()) | 2327 if (!webview()) |
| 2343 return; | 2328 return; |
| 2344 webview()->setPageScaleFactor(page_scale_factor); | 2329 webview()->setPageScaleFactor(page_scale_factor); |
| 2345 } | 2330 } |
| 2346 | 2331 |
| 2347 void RenderViewImpl::OnZoom(PageZoom zoom) { | 2332 void RenderViewImpl::OnZoom(PageZoom zoom) { |
| 2348 if (!webview()) // Not sure if this can happen, but no harm in being safe. | 2333 if (!webview()) // Not sure if this can happen, but no harm in being safe. |
| 2349 return; | 2334 return; |
| 2350 | 2335 |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3403 return render_frame->focused_pepper_plugin(); | 3388 return render_frame->focused_pepper_plugin(); |
| 3404 } | 3389 } |
| 3405 frame = frame->traverseNext(false); | 3390 frame = frame->traverseNext(false); |
| 3406 } | 3391 } |
| 3407 | 3392 |
| 3408 return nullptr; | 3393 return nullptr; |
| 3409 } | 3394 } |
| 3410 #endif | 3395 #endif |
| 3411 | 3396 |
| 3412 } // namespace content | 3397 } // namespace content |
| OLD | NEW |