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 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 } | 1909 } |
1910 | 1910 |
1911 void RenderViewImpl::focusNext() { | 1911 void RenderViewImpl::focusNext() { |
1912 Send(new ViewHostMsg_TakeFocus(routing_id_, false)); | 1912 Send(new ViewHostMsg_TakeFocus(routing_id_, false)); |
1913 } | 1913 } |
1914 | 1914 |
1915 void RenderViewImpl::focusPrevious() { | 1915 void RenderViewImpl::focusPrevious() { |
1916 Send(new ViewHostMsg_TakeFocus(routing_id_, true)); | 1916 Send(new ViewHostMsg_TakeFocus(routing_id_, true)); |
1917 } | 1917 } |
1918 | 1918 |
1919 void RenderViewImpl::focusedNodeChanged(const WebNode& node) { | 1919 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode, |
| 1920 const WebNode& toNode) { |
1920 has_scrolled_focused_editable_node_into_rect_ = false; | 1921 has_scrolled_focused_editable_node_into_rect_ = false; |
1921 | 1922 |
1922 gfx::Rect node_bounds; | 1923 gfx::Rect node_bounds; |
1923 if (!node.isNull() && node.isElementNode()) { | 1924 if (!toNode.isNull() && toNode.isElementNode()) { |
1924 WebNode web_node = const_cast<WebNode&>(node); | 1925 WebNode web_node = const_cast<WebNode&>(toNode); |
1925 node_bounds = gfx::Rect(web_node.to<WebElement>().boundsInViewportSpace()); | 1926 node_bounds = gfx::Rect(web_node.to<WebElement>().boundsInViewportSpace()); |
1926 } | 1927 } |
1927 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node), | 1928 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(toNode), |
1928 node_bounds)); | 1929 node_bounds)); |
1929 | 1930 |
1930 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); | 1931 // TODO(estade): remove. |
| 1932 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode)); |
1931 | 1933 |
1932 // TODO(dmazzoni): this should be part of RenderFrameObserver. | 1934 RenderFrameImpl* previous_frame = nullptr; |
1933 GetMainRenderFrame()->FocusedNodeChanged(node); | 1935 if (!fromNode.isNull()) |
| 1936 previous_frame = RenderFrameImpl::FromWebFrame(fromNode.document().frame()); |
| 1937 RenderFrameImpl* new_frame = nullptr; |
| 1938 if (!toNode.isNull()) |
| 1939 new_frame = RenderFrameImpl::FromWebFrame(toNode.document().frame()); |
| 1940 |
| 1941 if (previous_frame && previous_frame != new_frame) |
| 1942 previous_frame->FocusedNodeChanged(WebNode()); |
| 1943 if (new_frame) |
| 1944 new_frame->FocusedNodeChanged(toNode); |
| 1945 |
| 1946 // TODO(dmazzoni): remove once there's a separate a11y tree per frame. |
| 1947 GetMainRenderFrame()->FocusedNodeChangedForAccessibility(toNode); |
1934 } | 1948 } |
1935 | 1949 |
1936 void RenderViewImpl::didUpdateLayout() { | 1950 void RenderViewImpl::didUpdateLayout() { |
1937 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout()); | 1951 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout()); |
1938 | 1952 |
1939 // We don't always want to set up a timer, only if we've been put in that | 1953 // We don't always want to set up a timer, only if we've been put in that |
1940 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 1954 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
1941 // message. | 1955 // message. |
1942 if (!send_preferred_size_changes_ || !webview()) | 1956 if (!send_preferred_size_changes_ || !webview()) |
1943 return; | 1957 return; |
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4085 std::vector<gfx::Size> sizes; | 4099 std::vector<gfx::Size> sizes; |
4086 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4100 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4087 if (!url.isEmpty()) | 4101 if (!url.isEmpty()) |
4088 urls.push_back( | 4102 urls.push_back( |
4089 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4103 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4090 } | 4104 } |
4091 SendUpdateFaviconURL(urls); | 4105 SendUpdateFaviconURL(urls); |
4092 } | 4106 } |
4093 | 4107 |
4094 } // namespace content | 4108 } // namespace content |
OLD | NEW |