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

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

Issue 715733002: [Android] Show autofill popup after animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make this Android CL independent from the ChromeOS CL. Created 5 years, 11 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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1410
1411 Send(new InputHostMsg_MoveCaret_ACK(routing_id_)); 1411 Send(new InputHostMsg_MoveCaret_ACK(routing_id_));
1412 1412
1413 webview()->focusedFrame()->moveCaretSelection(point); 1413 webview()->focusedFrame()->moveCaretSelection(point);
1414 } 1414 }
1415 1415
1416 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect( 1416 void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect(
1417 const gfx::Rect& rect) { 1417 const gfx::Rect& rect) {
1418 if (has_scrolled_focused_editable_node_into_rect_ && 1418 if (has_scrolled_focused_editable_node_into_rect_ &&
1419 rect == rect_for_scrolled_focused_editable_node_) { 1419 rect == rect_for_scrolled_focused_editable_node_) {
1420 FocusChangeComplete();
1420 return; 1421 return;
1421 } 1422 }
1422 1423
1423 blink::WebElement element = GetFocusedElement(); 1424 blink::WebElement element = GetFocusedElement();
1425 bool will_animate = false;
1424 if (!element.isNull() && IsEditableNode(element)) { 1426 if (!element.isNull() && IsEditableNode(element)) {
1425 rect_for_scrolled_focused_editable_node_ = rect; 1427 rect_for_scrolled_focused_editable_node_ = rect;
1426 has_scrolled_focused_editable_node_into_rect_ = true; 1428 has_scrolled_focused_editable_node_into_rect_ = true;
1427 webview()->scrollFocusedNodeIntoRect(rect); 1429 will_animate = webview()->scrollFocusedNodeIntoRect(rect);
1428 } 1430 }
1431
1432 if (!will_animate)
1433 FocusChangeComplete();
1429 } 1434 }
1430 1435
1431 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( 1436 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent(
1432 const EditCommands& edit_commands) { 1437 const EditCommands& edit_commands) {
1433 edit_commands_ = edit_commands; 1438 edit_commands_ = edit_commands;
1434 } 1439 }
1435 1440
1436 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, 1441 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset,
1437 int history_length) { 1442 int history_length) {
1438 DCHECK_GE(history_offset, -1); 1443 DCHECK_GE(history_offset, -1);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 WebNode web_node = const_cast<WebNode&>(node); 1918 WebNode web_node = const_cast<WebNode&>(node);
1914 node_bounds = gfx::Rect(web_node.to<WebElement>().boundsInViewportSpace()); 1919 node_bounds = gfx::Rect(web_node.to<WebElement>().boundsInViewportSpace());
1915 } 1920 }
1916 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node), 1921 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node),
1917 node_bounds)); 1922 node_bounds));
1918 1923
1919 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); 1924 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node));
1920 1925
1921 // TODO(dmazzoni): this should be part of RenderFrameObserver. 1926 // TODO(dmazzoni): this should be part of RenderFrameObserver.
1922 GetMainRenderFrame()->FocusedNodeChanged(node); 1927 GetMainRenderFrame()->FocusedNodeChanged(node);
1928
1929 focused_element_bounds_ = node_bounds;
1923 } 1930 }
1924 1931
1925 void RenderViewImpl::didUpdateLayout() { 1932 void RenderViewImpl::didUpdateLayout() {
1926 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout()); 1933 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout());
1927 1934
1928 // We don't always want to set up a timer, only if we've been put in that 1935 // We don't always want to set up a timer, only if we've been put in that
1929 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| 1936 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode|
1930 // message. 1937 // message.
1931 if (!send_preferred_size_changes_ || !webview()) 1938 if (!send_preferred_size_changes_ || !webview())
1932 return; 1939 return;
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 } 3199 }
3193 } 3200 }
3194 3201
3195 gfx::Size old_visible_viewport_size = visible_viewport_size_; 3202 gfx::Size old_visible_viewport_size = visible_viewport_size_;
3196 3203
3197 RenderWidget::OnResize(params); 3204 RenderWidget::OnResize(params);
3198 3205
3199 if (old_visible_viewport_size != visible_viewport_size_) 3206 if (old_visible_viewport_size != visible_viewport_size_)
3200 has_scrolled_focused_editable_node_into_rect_ = false; 3207 has_scrolled_focused_editable_node_into_rect_ = false;
3201 3208
3202 FOR_EACH_OBSERVER(RenderViewObserver, 3209 blink::WebElement focused_element = GetFocusedElement();
3203 observers_, 3210 blink::WebRect bounds = focused_element.isNull()
3204 Resized()); 3211 ? blink::WebRect()
3212 : focused_element.boundsInViewportSpace();
3213 if (bounds != focused_element_bounds_) {
3214 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
3215 FocusedElementMovedOnResize());
3216 }
3217
3218 focused_element_bounds_ = bounds;
3205 } 3219 }
3206 3220
3207 void RenderViewImpl::DidInitiatePaint() { 3221 void RenderViewImpl::DidInitiatePaint() {
3208 #if defined(ENABLE_PLUGINS) 3222 #if defined(ENABLE_PLUGINS)
3209 // Notify all instances that we painted. The same caveats apply as for 3223 // Notify all instances that we painted. The same caveats apply as for
3210 // ViewFlushedPaint regarding instances closing themselves, so we take 3224 // ViewFlushedPaint regarding instances closing themselves, so we take
3211 // similar precautions. 3225 // similar precautions.
3212 PepperPluginSet plugins = active_pepper_instances_; 3226 PepperPluginSet plugins = active_pepper_instances_;
3213 for (PepperPluginSet::iterator i = plugins.begin(); i != plugins.end(); ++i) { 3227 for (PepperPluginSet::iterator i = plugins.begin(); i != plugins.end(); ++i) {
3214 if (active_pepper_instances_.find(*i) != active_pepper_instances_.end()) 3228 if (active_pepper_instances_.find(*i) != active_pepper_instances_.end())
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 // after Pepper API equips features related to surrounding text retrieval. 3634 // after Pepper API equips features related to surrounding text retrieval.
3621 gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds(); 3635 gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds();
3622 *start = caret; 3636 *start = caret;
3623 *end = caret; 3637 *end = caret;
3624 return; 3638 return;
3625 } 3639 }
3626 #endif 3640 #endif
3627 RenderWidget::GetSelectionBounds(start, end); 3641 RenderWidget::GetSelectionBounds(start, end);
3628 } 3642 }
3629 3643
3644 void RenderViewImpl::FocusChangeComplete() {
3645 RenderWidget::FocusChangeComplete();
3646 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusChangeComplete());
3647 }
3648
3630 void RenderViewImpl::GetCompositionCharacterBounds( 3649 void RenderViewImpl::GetCompositionCharacterBounds(
3631 std::vector<gfx::Rect>* bounds) { 3650 std::vector<gfx::Rect>* bounds) {
3632 DCHECK(bounds); 3651 DCHECK(bounds);
3633 bounds->clear(); 3652 bounds->clear();
3634 3653
3635 #if defined(ENABLE_PLUGINS) 3654 #if defined(ENABLE_PLUGINS)
3636 if (focused_pepper_plugin_) { 3655 if (focused_pepper_plugin_) {
3637 return; 3656 return;
3638 } 3657 }
3639 #endif 3658 #endif
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3706 } 3725 }
3707 3726
3708 void RenderViewImpl::InstrumentWillComposite() { 3727 void RenderViewImpl::InstrumentWillComposite() {
3709 if (!webview()) 3728 if (!webview())
3710 return; 3729 return;
3711 if (!webview()->devToolsAgent()) 3730 if (!webview()->devToolsAgent())
3712 return; 3731 return;
3713 webview()->devToolsAgent()->willComposite(); 3732 webview()->devToolsAgent()->willComposite();
3714 } 3733 }
3715 3734
3735 void RenderViewImpl::DidCompletePageScaleAnimation() {
3736 FocusChangeComplete();
3737 }
3738
3716 void RenderViewImpl::SetScreenMetricsEmulationParameters( 3739 void RenderViewImpl::SetScreenMetricsEmulationParameters(
3717 float device_scale_factor, 3740 float device_scale_factor,
3718 const gfx::Point& root_layer_offset, 3741 const gfx::Point& root_layer_offset,
3719 float root_layer_scale) { 3742 float root_layer_scale) {
3720 if (webview() && compositor()) { 3743 if (webview() && compositor()) {
3721 webview()->setCompositorDeviceScaleFactorOverride(device_scale_factor); 3744 webview()->setCompositorDeviceScaleFactorOverride(device_scale_factor);
3722 webview()->setRootLayerTransform( 3745 webview()->setRootLayerTransform(
3723 blink::WebSize(root_layer_offset.x(), root_layer_offset.y()), 3746 blink::WebSize(root_layer_offset.x(), root_layer_offset.y()),
3724 root_layer_scale); 3747 root_layer_scale);
3725 } 3748 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
4097 std::vector<gfx::Size> sizes; 4120 std::vector<gfx::Size> sizes;
4098 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4121 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4099 if (!url.isEmpty()) 4122 if (!url.isEmpty())
4100 urls.push_back( 4123 urls.push_back(
4101 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4124 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4102 } 4125 }
4103 SendUpdateFaviconURL(urls); 4126 SendUpdateFaviconURL(urls);
4104 } 4127 }
4105 4128
4106 } // namespace content 4129 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698