Chromium Code Reviews| 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 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1934 | 1934 |
| 1935 // TODO(esprehn): Blink only ever passes Elements, this should take WebElement. | 1935 // TODO(esprehn): Blink only ever passes Elements, this should take WebElement. |
| 1936 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode, | 1936 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode, |
| 1937 const WebNode& toNode) { | 1937 const WebNode& toNode) { |
| 1938 has_scrolled_focused_editable_node_into_rect_ = false; | 1938 has_scrolled_focused_editable_node_into_rect_ = false; |
| 1939 | 1939 |
| 1940 gfx::Rect node_bounds; | 1940 gfx::Rect node_bounds; |
| 1941 bool is_editable = false; | 1941 bool is_editable = false; |
| 1942 if (!toNode.isNull() && toNode.isElementNode()) { | 1942 if (!toNode.isNull() && toNode.isElementNode()) { |
| 1943 WebElement element = const_cast<WebNode&>(toNode).to<WebElement>(); | 1943 WebElement element = const_cast<WebNode&>(toNode).to<WebElement>(); |
| 1944 node_bounds = gfx::Rect(element.boundsInViewport()); | 1944 if (IsUseZoomForDSFEnabled()) { |
| 1945 node_bounds = gfx::ScaleToEnclosedRect( | |
| 1946 gfx::Rect(element.boundsInViewport()), 1 / device_scale_factor_); | |
|
bokan
2015/12/03 20:49:20
If you change convertViewportToWindow to return a
oshima
2015/12/03 21:58:17
I was going to change this during cleanup but forg
| |
| 1947 } else { | |
| 1948 node_bounds = gfx::Rect(element.boundsInViewport()); | |
| 1949 } | |
| 1945 is_editable = element.isEditable(); | 1950 is_editable = element.isEditable(); |
| 1946 } | 1951 } |
| 1947 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, is_editable, | 1952 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, is_editable, |
| 1948 node_bounds)); | 1953 node_bounds)); |
| 1949 | 1954 |
| 1950 // TODO(estade): remove. | 1955 // TODO(estade): remove. |
| 1951 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode)); | 1956 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode)); |
| 1952 | 1957 |
| 1953 RenderFrameImpl* previous_frame = nullptr; | 1958 RenderFrameImpl* previous_frame = nullptr; |
| 1954 if (!fromNode.isNull()) | 1959 if (!fromNode.isNull()) |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2129 | 2134 |
| 2130 SSLStatus result; | 2135 SSLStatus result; |
| 2131 CHECK(DeserializeSecurityInfo(security_info, &result)); | 2136 CHECK(DeserializeSecurityInfo(security_info, &result)); |
| 2132 return result; | 2137 return result; |
| 2133 } | 2138 } |
| 2134 | 2139 |
| 2135 const std::string& RenderViewImpl::GetAcceptLanguages() const { | 2140 const std::string& RenderViewImpl::GetAcceptLanguages() const { |
| 2136 return renderer_preferences_.accept_languages; | 2141 return renderer_preferences_.accept_languages; |
| 2137 } | 2142 } |
| 2138 | 2143 |
| 2144 void RenderViewImpl::convertViewportToWindow(blink::WebRect* rect) { | |
|
bokan
2015/12/03 20:49:20
Why not just make this return a gfx::Rect since Wi
oshima
2015/12/03 21:58:17
This was a part of larger CL, and Blink needs this
bokan
2015/12/04 00:28:52
Ah, I see. Yah, right now I think gfx::Rect is sti
| |
| 2145 if (IsUseZoomForDSFEnabled()) { | |
| 2146 float reverse = 1 / device_scale_factor_; | |
| 2147 // TODO(oshima): We may wait to allow pixel precision here as the the | |
| 2148 // anchor element can be placed at half pixel. | |
| 2149 gfx::Rect window_rect = | |
| 2150 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); | |
| 2151 rect->x = window_rect.x(); | |
| 2152 rect->y = window_rect.y(); | |
| 2153 rect->width = window_rect.width(); | |
| 2154 rect->height = window_rect.height(); | |
| 2155 } | |
| 2156 } | |
| 2157 | |
| 2139 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2158 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2140 WebIconURL::Type icon_type) { | 2159 WebIconURL::Type icon_type) { |
| 2141 if (frame->parent()) | 2160 if (frame->parent()) |
| 2142 return; | 2161 return; |
| 2143 | 2162 |
| 2144 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2163 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
| 2145 std::vector<FaviconURL> urls; | 2164 std::vector<FaviconURL> urls; |
| 2146 for (size_t i = 0; i < icon_urls.size(); i++) { | 2165 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 2147 std::vector<gfx::Size> sizes; | 2166 std::vector<gfx::Size> sizes; |
| 2148 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2167 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| (...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3720 if (IsUseZoomForDSFEnabled()) { | 3739 if (IsUseZoomForDSFEnabled()) { |
| 3721 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); | 3740 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); |
| 3722 webview()->setZoomFactorForDeviceScaleFactor( | 3741 webview()->setZoomFactorForDeviceScaleFactor( |
| 3723 device_scale_factor_); | 3742 device_scale_factor_); |
| 3724 } else { | 3743 } else { |
| 3725 webview()->setDeviceScaleFactor(device_scale_factor_); | 3744 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3726 } | 3745 } |
| 3727 } | 3746 } |
| 3728 | 3747 |
| 3729 } // namespace content | 3748 } // namespace content |
| OLD | NEW |