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 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 | 1924 |
1925 // TODO(esprehn): Blink only ever passes Elements, this should take WebElement. | 1925 // TODO(esprehn): Blink only ever passes Elements, this should take WebElement. |
1926 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode, | 1926 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode, |
1927 const WebNode& toNode) { | 1927 const WebNode& toNode) { |
1928 has_scrolled_focused_editable_node_into_rect_ = false; | 1928 has_scrolled_focused_editable_node_into_rect_ = false; |
1929 | 1929 |
1930 gfx::Rect node_bounds; | 1930 gfx::Rect node_bounds; |
1931 bool is_editable = false; | 1931 bool is_editable = false; |
1932 if (!toNode.isNull() && toNode.isElementNode()) { | 1932 if (!toNode.isNull() && toNode.isElementNode()) { |
1933 WebElement element = const_cast<WebNode&>(toNode).to<WebElement>(); | 1933 WebElement element = const_cast<WebNode&>(toNode).to<WebElement>(); |
1934 blink::WebRect rect = element.boundsInViewport(); | 1934 // TODO(huangs): Use getElementBoundingBoxWindow(). |
| 1935 blink::WebRect rect = element.boundsInViewportInt(); |
1935 convertViewportToWindow(&rect); | 1936 convertViewportToWindow(&rect); |
1936 node_bounds = gfx::Rect(rect); | 1937 node_bounds = gfx::Rect(rect); |
1937 is_editable = element.isEditable(); | 1938 is_editable = element.isEditable(); |
1938 } | 1939 } |
1939 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, is_editable, | 1940 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, is_editable, |
1940 node_bounds)); | 1941 node_bounds)); |
1941 | 1942 |
1942 // TODO(estade): remove. | 1943 // TODO(estade): remove. |
1943 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode)); | 1944 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode)); |
1944 | 1945 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 } | 2126 } |
2126 | 2127 |
2127 const std::string& RenderViewImpl::GetAcceptLanguages() const { | 2128 const std::string& RenderViewImpl::GetAcceptLanguages() const { |
2128 return renderer_preferences_.accept_languages; | 2129 return renderer_preferences_.accept_languages; |
2129 } | 2130 } |
2130 | 2131 |
2131 void RenderViewImpl::convertViewportToWindow(blink::WebRect* rect) { | 2132 void RenderViewImpl::convertViewportToWindow(blink::WebRect* rect) { |
2132 RenderWidget::convertViewportToWindow(rect); | 2133 RenderWidget::convertViewportToWindow(rect); |
2133 } | 2134 } |
2134 | 2135 |
| 2136 void RenderViewImpl::convertViewportToWindow(blink::WebFloatRect* rect) { |
| 2137 RenderWidget::convertViewportToWindow(rect); |
| 2138 } |
| 2139 |
| 2140 void RenderViewImpl::getElementBoundingBoxWindow( |
| 2141 blink::WebElement* element, blink::WebFloatRect* rect) { |
| 2142 *rect = element->boundsInViewportFloat(); |
| 2143 convertViewportToWindow(rect); |
| 2144 } |
| 2145 |
2135 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2146 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
2136 WebIconURL::Type icon_type) { | 2147 WebIconURL::Type icon_type) { |
2137 if (frame->parent()) | 2148 if (frame->parent()) |
2138 return; | 2149 return; |
2139 | 2150 |
2140 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2151 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
2141 std::vector<FaviconURL> urls; | 2152 std::vector<FaviconURL> urls; |
2142 for (size_t i = 0; i < icon_urls.size(); i++) { | 2153 for (size_t i = 0; i < icon_urls.size(); i++) { |
2143 std::vector<gfx::Size> sizes; | 2154 std::vector<gfx::Size> sizes; |
2144 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2155 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3710 if (IsUseZoomForDSFEnabled()) { | 3721 if (IsUseZoomForDSFEnabled()) { |
3711 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); | 3722 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); |
3712 webview()->setZoomFactorForDeviceScaleFactor( | 3723 webview()->setZoomFactorForDeviceScaleFactor( |
3713 device_scale_factor_); | 3724 device_scale_factor_); |
3714 } else { | 3725 } else { |
3715 webview()->setDeviceScaleFactor(device_scale_factor_); | 3726 webview()->setDeviceScaleFactor(device_scale_factor_); |
3716 } | 3727 } |
3717 } | 3728 } |
3718 | 3729 |
3719 } // namespace content | 3730 } // namespace content |
OLD | NEW |