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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 | 1416 |
1417 Send(new InputHostMsg_MoveCaret_ACK(routing_id_)); | 1417 Send(new InputHostMsg_MoveCaret_ACK(routing_id_)); |
1418 | 1418 |
1419 webview()->focusedFrame()->moveCaretSelection(point); | 1419 webview()->focusedFrame()->moveCaretSelection(point); |
1420 } | 1420 } |
1421 | 1421 |
1422 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( | 1422 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( |
1423 const gfx::Rect& rect) { | 1423 const gfx::Rect& rect) { |
1424 if (has_scrolled_focused_editable_node_into_rect_ && | 1424 if (has_scrolled_focused_editable_node_into_rect_ && |
1425 rect == rect_for_scrolled_focused_editable_node_) { | 1425 rect == rect_for_scrolled_focused_editable_node_) { |
| 1426 FocusChangeComplete(); |
1426 return; | 1427 return; |
1427 } | 1428 } |
1428 | 1429 |
1429 blink::WebElement element = GetFocusedElement(); | 1430 blink::WebElement element = GetFocusedElement(); |
| 1431 bool will_animate = false; |
1430 if (!element.isNull() && IsEditableNode(element)) { | 1432 if (!element.isNull() && IsEditableNode(element)) { |
1431 rect_for_scrolled_focused_editable_node_ = rect; | 1433 rect_for_scrolled_focused_editable_node_ = rect; |
1432 has_scrolled_focused_editable_node_into_rect_ = true; | 1434 has_scrolled_focused_editable_node_into_rect_ = true; |
1433 webview()->scrollFocusedNodeIntoRect(rect); | 1435 will_animate = webview()->scrollFocusedNodeIntoRect(rect); |
1434 } | 1436 } |
| 1437 |
| 1438 if (!will_animate) |
| 1439 FocusChangeComplete(); |
1435 } | 1440 } |
1436 | 1441 |
1437 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( | 1442 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( |
1438 const EditCommands& edit_commands) { | 1443 const EditCommands& edit_commands) { |
1439 edit_commands_ = edit_commands; | 1444 edit_commands_ = edit_commands; |
1440 } | 1445 } |
1441 | 1446 |
1442 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, | 1447 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, |
1443 int history_length) { | 1448 int history_length) { |
1444 DCHECK_GE(history_offset, -1); | 1449 DCHECK_GE(history_offset, -1); |
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 // after Pepper API equips features related to surrounding text retrieval. | 3599 // after Pepper API equips features related to surrounding text retrieval. |
3595 gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds(); | 3600 gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds(); |
3596 *start = caret; | 3601 *start = caret; |
3597 *end = caret; | 3602 *end = caret; |
3598 return; | 3603 return; |
3599 } | 3604 } |
3600 #endif | 3605 #endif |
3601 RenderWidget::GetSelectionBounds(start, end); | 3606 RenderWidget::GetSelectionBounds(start, end); |
3602 } | 3607 } |
3603 | 3608 |
| 3609 void RenderViewImpl::FocusChangeComplete() { |
| 3610 RenderWidget::FocusChangeComplete(); |
| 3611 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusChangeComplete()); |
| 3612 } |
| 3613 |
3604 void RenderViewImpl::GetCompositionCharacterBounds( | 3614 void RenderViewImpl::GetCompositionCharacterBounds( |
3605 std::vector<gfx::Rect>* bounds) { | 3615 std::vector<gfx::Rect>* bounds) { |
3606 DCHECK(bounds); | 3616 DCHECK(bounds); |
3607 bounds->clear(); | 3617 bounds->clear(); |
3608 | 3618 |
3609 #if defined(ENABLE_PLUGINS) | 3619 #if defined(ENABLE_PLUGINS) |
3610 if (focused_pepper_plugin_) { | 3620 if (focused_pepper_plugin_) { |
3611 return; | 3621 return; |
3612 } | 3622 } |
3613 #endif | 3623 #endif |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3680 } | 3690 } |
3681 | 3691 |
3682 void RenderViewImpl::InstrumentWillComposite() { | 3692 void RenderViewImpl::InstrumentWillComposite() { |
3683 if (!webview()) | 3693 if (!webview()) |
3684 return; | 3694 return; |
3685 if (!webview()->devToolsAgent()) | 3695 if (!webview()->devToolsAgent()) |
3686 return; | 3696 return; |
3687 webview()->devToolsAgent()->willComposite(); | 3697 webview()->devToolsAgent()->willComposite(); |
3688 } | 3698 } |
3689 | 3699 |
| 3700 void RenderViewImpl::DidCompletePageScaleAnimation() { |
| 3701 FocusChangeComplete(); |
| 3702 } |
| 3703 |
3690 void RenderViewImpl::SetScreenMetricsEmulationParameters( | 3704 void RenderViewImpl::SetScreenMetricsEmulationParameters( |
3691 float device_scale_factor, | 3705 float device_scale_factor, |
3692 const gfx::Point& root_layer_offset, | 3706 const gfx::Point& root_layer_offset, |
3693 float root_layer_scale) { | 3707 float root_layer_scale) { |
3694 if (webview() && compositor()) { | 3708 if (webview() && compositor()) { |
3695 webview()->setCompositorDeviceScaleFactorOverride(device_scale_factor); | 3709 webview()->setCompositorDeviceScaleFactorOverride(device_scale_factor); |
3696 webview()->setRootLayerTransform( | 3710 webview()->setRootLayerTransform( |
3697 blink::WebSize(root_layer_offset.x(), root_layer_offset.y()), | 3711 blink::WebSize(root_layer_offset.x(), root_layer_offset.y()), |
3698 root_layer_scale); | 3712 root_layer_scale); |
3699 } | 3713 } |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4071 std::vector<gfx::Size> sizes; | 4085 std::vector<gfx::Size> sizes; |
4072 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4086 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4073 if (!url.isEmpty()) | 4087 if (!url.isEmpty()) |
4074 urls.push_back( | 4088 urls.push_back( |
4075 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4089 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4076 } | 4090 } |
4077 SendUpdateFaviconURL(urls); | 4091 SendUpdateFaviconURL(urls); |
4078 } | 4092 } |
4079 | 4093 |
4080 } // namespace content | 4094 } // namespace content |
OLD | NEW |