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 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 const blink::WebElement& element) { | 2205 const blink::WebElement& element) { |
2206 blink::WebRect bounding_box_in_window = element.boundsInViewport(); | 2206 blink::WebRect bounding_box_in_window = element.boundsInViewport(); |
2207 convertViewportToWindow(&bounding_box_in_window); | 2207 convertViewportToWindow(&bounding_box_in_window); |
2208 return gfx::RectF(bounding_box_in_window); | 2208 return gfx::RectF(bounding_box_in_window); |
2209 } | 2209 } |
2210 | 2210 |
2211 float RenderViewImpl::GetDeviceScaleFactorForTest() const { | 2211 float RenderViewImpl::GetDeviceScaleFactorForTest() const { |
2212 return device_scale_factor_; | 2212 return device_scale_factor_; |
2213 } | 2213 } |
2214 | 2214 |
| 2215 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( |
| 2216 const gfx::Point& point) { |
| 2217 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); |
| 2218 convertWindowToViewport(&point_in_viewport); |
| 2219 return gfx::Point(point_in_viewport.x, point_in_viewport.y); |
| 2220 } |
| 2221 |
2215 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2222 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
2216 WebIconURL::Type icon_type) { | 2223 WebIconURL::Type icon_type) { |
2217 if (frame->parent()) | 2224 if (frame->parent()) |
2218 return; | 2225 return; |
2219 | 2226 |
2220 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2227 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
2221 std::vector<FaviconURL> urls; | 2228 std::vector<FaviconURL> urls; |
2222 for (size_t i = 0; i < icon_urls.size(); i++) { | 2229 for (size_t i = 0; i < icon_urls.size(); i++) { |
2223 std::vector<gfx::Size> sizes; | 2230 std::vector<gfx::Size> sizes; |
2224 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2231 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 RenderProcess::current()->AddBindings(enabled_bindings_flags); | 2413 RenderProcess::current()->AddBindings(enabled_bindings_flags); |
2407 } | 2414 } |
2408 | 2415 |
2409 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, | 2416 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, |
2410 const gfx::Point& client_point, | 2417 const gfx::Point& client_point, |
2411 const gfx::Point& screen_point, | 2418 const gfx::Point& screen_point, |
2412 WebDragOperationsMask ops, | 2419 WebDragOperationsMask ops, |
2413 int key_modifiers) { | 2420 int key_modifiers) { |
2414 WebDragOperation operation = webview()->dragTargetDragEnter( | 2421 WebDragOperation operation = webview()->dragTargetDragEnter( |
2415 DropDataToWebDragData(drop_data), | 2422 DropDataToWebDragData(drop_data), |
2416 client_point, | 2423 ConvertWindowPointToViewport(client_point), |
2417 screen_point, | 2424 screen_point, |
2418 ops, | 2425 ops, |
2419 key_modifiers); | 2426 key_modifiers); |
2420 | 2427 |
2421 Send(new DragHostMsg_UpdateDragCursor(routing_id(), operation)); | 2428 Send(new DragHostMsg_UpdateDragCursor(routing_id(), operation)); |
2422 } | 2429 } |
2423 | 2430 |
2424 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, | 2431 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, |
2425 const gfx::Point& screen_point, | 2432 const gfx::Point& screen_point, |
2426 WebDragOperationsMask ops, | 2433 WebDragOperationsMask ops, |
2427 int key_modifiers) { | 2434 int key_modifiers) { |
2428 WebDragOperation operation = webview()->dragTargetDragOver( | 2435 WebDragOperation operation = webview()->dragTargetDragOver( |
2429 client_point, | 2436 ConvertWindowPointToViewport(client_point), |
2430 screen_point, | 2437 screen_point, |
2431 ops, | 2438 ops, |
2432 key_modifiers); | 2439 key_modifiers); |
2433 | 2440 |
2434 Send(new DragHostMsg_UpdateDragCursor(routing_id(), operation)); | 2441 Send(new DragHostMsg_UpdateDragCursor(routing_id(), operation)); |
2435 } | 2442 } |
2436 | 2443 |
2437 void RenderViewImpl::OnDragTargetDragLeave() { | 2444 void RenderViewImpl::OnDragTargetDragLeave() { |
2438 webview()->dragTargetDragLeave(); | 2445 webview()->dragTargetDragLeave(); |
2439 } | 2446 } |
2440 | 2447 |
2441 void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, | 2448 void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, |
2442 const gfx::Point& screen_point, | 2449 const gfx::Point& screen_point, |
2443 int key_modifiers) { | 2450 int key_modifiers) { |
2444 webview()->dragTargetDrop(client_point, screen_point, key_modifiers); | 2451 webview()->dragTargetDrop( |
| 2452 ConvertWindowPointToViewport(client_point), screen_point, key_modifiers); |
2445 } | 2453 } |
2446 | 2454 |
2447 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, | 2455 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, |
2448 const gfx::Point& screen_point, | 2456 const gfx::Point& screen_point, |
2449 WebDragOperation op) { | 2457 WebDragOperation op) { |
2450 webview()->dragSourceEndedAt(client_point, screen_point, op); | 2458 webview()->dragSourceEndedAt( |
| 2459 ConvertWindowPointToViewport(client_point), screen_point, op); |
2451 } | 2460 } |
2452 | 2461 |
2453 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2462 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
2454 webview()->dragSourceSystemDragEnded(); | 2463 webview()->dragSourceSystemDragEnded(); |
2455 } | 2464 } |
2456 | 2465 |
2457 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2466 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
2458 webkit_preferences_ = prefs; | 2467 webkit_preferences_ = prefs; |
2459 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); | 2468 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
2460 } | 2469 } |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3537 if (IsUseZoomForDSFEnabled()) { | 3546 if (IsUseZoomForDSFEnabled()) { |
3538 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3547 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3539 } else { | 3548 } else { |
3540 webview()->setDeviceScaleFactor(device_scale_factor_); | 3549 webview()->setDeviceScaleFactor(device_scale_factor_); |
3541 } | 3550 } |
3542 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3551 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3543 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3552 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3544 } | 3553 } |
3545 | 3554 |
3546 } // namespace content | 3555 } // namespace content |
OLD | NEW |