| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 context_menu_node_ = data.node; | 2226 context_menu_node_ = data.node; |
| 2227 | 2227 |
| 2228 #if defined(OS_ANDROID) | 2228 #if defined(OS_ANDROID) |
| 2229 gfx::Rect start_rect; | 2229 gfx::Rect start_rect; |
| 2230 gfx::Rect end_rect; | 2230 gfx::Rect end_rect; |
| 2231 GetSelectionBounds(&start_rect, &end_rect); | 2231 GetSelectionBounds(&start_rect, &end_rect); |
| 2232 gfx::Point start_point(start_rect.x(), | 2232 gfx::Point start_point(start_rect.x(), |
| 2233 start_rect.bottom()); | 2233 start_rect.bottom()); |
| 2234 gfx::Point end_point(end_rect.right(), | 2234 gfx::Point end_point(end_rect.right(), |
| 2235 end_rect.bottom()); | 2235 end_rect.bottom()); |
| 2236 params.selection_start = GetScrollOffset().Add(start_point); | 2236 params.selection_start = start_point.Add(GetScrollOffset()); |
| 2237 params.selection_end = GetScrollOffset().Add(end_point); | 2237 params.selection_end = end_point.Add(GetScrollOffset()); |
| 2238 #endif | 2238 #endif |
| 2239 | 2239 |
| 2240 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); | 2240 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 void RenderViewImpl::setStatusText(const WebString& text) { | 2243 void RenderViewImpl::setStatusText(const WebString& text) { |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 void RenderViewImpl::UpdateTargetURL(const GURL& url, | 2246 void RenderViewImpl::UpdateTargetURL(const GURL& url, |
| 2247 const GURL& fallback_url) { | 2247 const GURL& fallback_url) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 | 2297 |
| 2298 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { | 2298 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { |
| 2299 focus_url_ = GURL(url); | 2299 focus_url_ = GURL(url); |
| 2300 UpdateTargetURL(focus_url_, mouse_over_url_); | 2300 UpdateTargetURL(focus_url_, mouse_over_url_); |
| 2301 } | 2301 } |
| 2302 | 2302 |
| 2303 void RenderViewImpl::startDragging(WebFrame* frame, | 2303 void RenderViewImpl::startDragging(WebFrame* frame, |
| 2304 const WebDragData& data, | 2304 const WebDragData& data, |
| 2305 WebDragOperationsMask mask, | 2305 WebDragOperationsMask mask, |
| 2306 const WebImage& image, | 2306 const WebImage& image, |
| 2307 const WebPoint& imageOffset) { | 2307 const WebPoint& webImageOffset) { |
| 2308 WebDropData drop_data(data); | 2308 WebDropData drop_data(data); |
| 2309 drop_data.referrer_policy = frame->document().referrerPolicy(); | 2309 drop_data.referrer_policy = frame->document().referrerPolicy(); |
| 2310 gfx::Vector2d imageOffset(gfx::Point(webImageOffset).DistanceFromOrigin()); |
| 2310 Send(new DragHostMsg_StartDragging(routing_id_, | 2311 Send(new DragHostMsg_StartDragging(routing_id_, |
| 2311 drop_data, | 2312 drop_data, |
| 2312 mask, | 2313 mask, |
| 2313 image.getSkBitmap(), | 2314 image.getSkBitmap(), |
| 2314 imageOffset)); | 2315 imageOffset)); |
| 2315 } | 2316 } |
| 2316 | 2317 |
| 2317 bool RenderViewImpl::acceptsLoadDrops() { | 2318 bool RenderViewImpl::acceptsLoadDrops() { |
| 2318 return renderer_preferences_.can_accept_load_drops; | 2319 return renderer_preferences_.can_accept_load_drops; |
| 2319 } | 2320 } |
| (...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5616 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( | 5617 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( |
| 5617 const gfx::Rect& paint_bounds, | 5618 const gfx::Rect& paint_bounds, |
| 5618 TransportDIB** dib, | 5619 TransportDIB** dib, |
| 5619 gfx::Rect* location, | 5620 gfx::Rect* location, |
| 5620 gfx::Rect* clip, | 5621 gfx::Rect* clip, |
| 5621 float* scale_factor) { | 5622 float* scale_factor) { |
| 5622 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( | 5623 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( |
| 5623 paint_bounds, dib, location, clip, scale_factor); | 5624 paint_bounds, dib, location, clip, scale_factor); |
| 5624 } | 5625 } |
| 5625 | 5626 |
| 5626 gfx::Point RenderViewImpl::GetScrollOffset() { | 5627 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
| 5627 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 5628 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); |
| 5628 return gfx::Point(scroll_offset.width, scroll_offset.height); | 5629 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
| 5629 } | 5630 } |
| 5630 | 5631 |
| 5631 void RenderViewImpl::OnClearFocusedNode() { | 5632 void RenderViewImpl::OnClearFocusedNode() { |
| 5632 if (webview()) | 5633 if (webview()) |
| 5633 webview()->clearFocusedNode(); | 5634 webview()->clearFocusedNode(); |
| 5634 } | 5635 } |
| 5635 | 5636 |
| 5636 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { | 5637 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { |
| 5637 if (webview()) | 5638 if (webview()) |
| 5638 webview()->setIsTransparent(!background.empty()); | 5639 webview()->setIsTransparent(!background.empty()); |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6429 } | 6430 } |
| 6430 #endif | 6431 #endif |
| 6431 | 6432 |
| 6432 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6433 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6433 TransportDIB::Handle dib_handle) { | 6434 TransportDIB::Handle dib_handle) { |
| 6434 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6435 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6435 RenderProcess::current()->ReleaseTransportDIB(dib); | 6436 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6436 } | 6437 } |
| 6437 | 6438 |
| 6438 } // namespace content | 6439 } // namespace content |
| OLD | NEW |