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

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: UI thread where needed. 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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 WebNode web_node = const_cast<WebNode&>(node); 1924 WebNode web_node = const_cast<WebNode&>(node);
1920 node_bounds = gfx::Rect(web_node.to<WebElement>().boundsInViewportSpace()); 1925 node_bounds = gfx::Rect(web_node.to<WebElement>().boundsInViewportSpace());
1921 } 1926 }
1922 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node), 1927 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node),
1923 node_bounds)); 1928 node_bounds));
1924 1929
1925 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); 1930 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node));
1926 1931
1927 // TODO(dmazzoni): this should be part of RenderFrameObserver. 1932 // TODO(dmazzoni): this should be part of RenderFrameObserver.
1928 GetMainRenderFrame()->FocusedNodeChanged(node); 1933 GetMainRenderFrame()->FocusedNodeChanged(node);
1934
1935 focused_element_bounds_ = node_bounds;
1929 } 1936 }
1930 1937
1931 void RenderViewImpl::didUpdateLayout() { 1938 void RenderViewImpl::didUpdateLayout() {
1932 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout()); 1939 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout());
1933 1940
1934 // We don't always want to set up a timer, only if we've been put in that 1941 // We don't always want to set up a timer, only if we've been put in that
1935 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| 1942 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode|
1936 // message. 1943 // message.
1937 if (!send_preferred_size_changes_ || !webview()) 1944 if (!send_preferred_size_changes_ || !webview())
1938 return; 1945 return;
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 } 3177 }
3171 } 3178 }
3172 3179
3173 gfx::Size old_visible_viewport_size = visible_viewport_size_; 3180 gfx::Size old_visible_viewport_size = visible_viewport_size_;
3174 3181
3175 RenderWidget::OnResize(params); 3182 RenderWidget::OnResize(params);
3176 3183
3177 if (old_visible_viewport_size != visible_viewport_size_) 3184 if (old_visible_viewport_size != visible_viewport_size_)
3178 has_scrolled_focused_editable_node_into_rect_ = false; 3185 has_scrolled_focused_editable_node_into_rect_ = false;
3179 3186
3180 FOR_EACH_OBSERVER(RenderViewObserver, 3187 blink::WebElement focused_element = GetFocusedElement();
3181 observers_, 3188 blink::WebRect bounds = focused_element.isNull()
3182 Resized()); 3189 ? blink::WebRect()
3190 : focused_element.boundsInViewportSpace();
3191 if (bounds != focused_element_bounds_) {
3192 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
3193 FocusedElementMovedOnResize());
3194 }
3195
3196 focused_element_bounds_ = bounds;
3183 } 3197 }
3184 3198
3185 void RenderViewImpl::DidInitiatePaint() { 3199 void RenderViewImpl::DidInitiatePaint() {
3186 #if defined(ENABLE_PLUGINS) 3200 #if defined(ENABLE_PLUGINS)
3187 // Notify all instances that we painted. The same caveats apply as for 3201 // Notify all instances that we painted. The same caveats apply as for
3188 // ViewFlushedPaint regarding instances closing themselves, so we take 3202 // ViewFlushedPaint regarding instances closing themselves, so we take
3189 // similar precautions. 3203 // similar precautions.
3190 PepperPluginSet plugins = active_pepper_instances_; 3204 PepperPluginSet plugins = active_pepper_instances_;
3191 for (PepperPluginSet::iterator i = plugins.begin(); i != plugins.end(); ++i) { 3205 for (PepperPluginSet::iterator i = plugins.begin(); i != plugins.end(); ++i) {
3192 if (active_pepper_instances_.find(*i) != active_pepper_instances_.end()) 3206 if (active_pepper_instances_.find(*i) != active_pepper_instances_.end())
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 // after Pepper API equips features related to surrounding text retrieval. 3612 // after Pepper API equips features related to surrounding text retrieval.
3599 gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds(); 3613 gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds();
3600 *start = caret; 3614 *start = caret;
3601 *end = caret; 3615 *end = caret;
3602 return; 3616 return;
3603 } 3617 }
3604 #endif 3618 #endif
3605 RenderWidget::GetSelectionBounds(start, end); 3619 RenderWidget::GetSelectionBounds(start, end);
3606 } 3620 }
3607 3621
3622 void RenderViewImpl::FocusChangeComplete() {
3623 RenderWidget::FocusChangeComplete();
3624 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusChangeComplete());
3625 }
3626
3608 void RenderViewImpl::GetCompositionCharacterBounds( 3627 void RenderViewImpl::GetCompositionCharacterBounds(
3609 std::vector<gfx::Rect>* bounds) { 3628 std::vector<gfx::Rect>* bounds) {
3610 DCHECK(bounds); 3629 DCHECK(bounds);
3611 bounds->clear(); 3630 bounds->clear();
3612 3631
3613 #if defined(ENABLE_PLUGINS) 3632 #if defined(ENABLE_PLUGINS)
3614 if (focused_pepper_plugin_) { 3633 if (focused_pepper_plugin_) {
3615 return; 3634 return;
3616 } 3635 }
3617 #endif 3636 #endif
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 } 3703 }
3685 3704
3686 void RenderViewImpl::InstrumentWillComposite() { 3705 void RenderViewImpl::InstrumentWillComposite() {
3687 if (!webview()) 3706 if (!webview())
3688 return; 3707 return;
3689 if (!webview()->devToolsAgent()) 3708 if (!webview()->devToolsAgent())
3690 return; 3709 return;
3691 webview()->devToolsAgent()->willComposite(); 3710 webview()->devToolsAgent()->willComposite();
3692 } 3711 }
3693 3712
3713 void RenderViewImpl::DidCompletePageScaleAnimation() {
3714 FocusChangeComplete();
3715 }
3716
3694 void RenderViewImpl::SetScreenMetricsEmulationParameters( 3717 void RenderViewImpl::SetScreenMetricsEmulationParameters(
3695 float device_scale_factor, 3718 float device_scale_factor,
3696 const gfx::Point& root_layer_offset, 3719 const gfx::Point& root_layer_offset,
3697 float root_layer_scale) { 3720 float root_layer_scale) {
3698 if (webview() && compositor()) { 3721 if (webview() && compositor()) {
3699 webview()->setCompositorDeviceScaleFactorOverride(device_scale_factor); 3722 webview()->setCompositorDeviceScaleFactorOverride(device_scale_factor);
3700 webview()->setRootLayerTransform( 3723 webview()->setRootLayerTransform(
3701 blink::WebSize(root_layer_offset.x(), root_layer_offset.y()), 3724 blink::WebSize(root_layer_offset.x(), root_layer_offset.y()),
3702 root_layer_scale); 3725 root_layer_scale);
3703 } 3726 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
4075 std::vector<gfx::Size> sizes; 4098 std::vector<gfx::Size> sizes;
4076 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4099 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4077 if (!url.isEmpty()) 4100 if (!url.isEmpty())
4078 urls.push_back( 4101 urls.push_back(
4079 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4102 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4080 } 4103 }
4081 SendUpdateFaviconURL(urls); 4104 SendUpdateFaviconURL(urls);
4082 } 4105 }
4083 4106
4084 } // namespace content 4107 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698