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 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2158 params.src_url = GURL(); | 2158 params.src_url = GURL(); |
2159 context_menu_node_ = data.node; | 2159 context_menu_node_ = data.node; |
2160 | 2160 |
2161 #if defined(OS_ANDROID) | 2161 #if defined(OS_ANDROID) |
2162 gfx::Rect start_rect; | 2162 gfx::Rect start_rect; |
2163 gfx::Rect end_rect; | 2163 gfx::Rect end_rect; |
2164 GetSelectionBounds(&start_rect, &end_rect); | 2164 GetSelectionBounds(&start_rect, &end_rect); |
2165 gfx::Point start_point(start_rect.x(), | 2165 gfx::Point start_point(start_rect.x(), |
2166 start_rect.bottom()); | 2166 start_rect.bottom()); |
2167 gfx::Point end_point(end_rect.right(), | 2167 gfx::Point end_point(end_rect.right(), |
2168 end_rect.bottom()); | 2168 end_rect.bottom()); |
Peter Kasting
2012/10/30 01:14:14
Nit: Can inline these two points
| |
2169 params.selection_start = GetScrollOffset().Add(start_point); | 2169 params.selection_start = start_point.Add(GetScrollOffset()); |
2170 params.selection_end = GetScrollOffset().Add(end_point); | 2170 params.selection_end = end_point.Add(GetScrollOffset()); |
2171 #endif | 2171 #endif |
2172 | 2172 |
2173 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); | 2173 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); |
2174 } | 2174 } |
2175 | 2175 |
2176 void RenderViewImpl::setStatusText(const WebString& text) { | 2176 void RenderViewImpl::setStatusText(const WebString& text) { |
2177 } | 2177 } |
2178 | 2178 |
2179 void RenderViewImpl::UpdateTargetURL(const GURL& url, | 2179 void RenderViewImpl::UpdateTargetURL(const GURL& url, |
2180 const GURL& fallback_url) { | 2180 const GURL& fallback_url) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2230 | 2230 |
2231 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { | 2231 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { |
2232 focus_url_ = GURL(url); | 2232 focus_url_ = GURL(url); |
2233 UpdateTargetURL(focus_url_, mouse_over_url_); | 2233 UpdateTargetURL(focus_url_, mouse_over_url_); |
2234 } | 2234 } |
2235 | 2235 |
2236 void RenderViewImpl::startDragging(WebFrame* frame, | 2236 void RenderViewImpl::startDragging(WebFrame* frame, |
2237 const WebDragData& data, | 2237 const WebDragData& data, |
2238 WebDragOperationsMask mask, | 2238 WebDragOperationsMask mask, |
2239 const WebImage& image, | 2239 const WebImage& image, |
2240 const WebPoint& imageOffset) { | 2240 const WebPoint& webImageOffset) { |
2241 WebDropData drop_data(data); | 2241 WebDropData drop_data(data); |
2242 drop_data.referrer_policy = frame->document().referrerPolicy(); | 2242 drop_data.referrer_policy = frame->document().referrerPolicy(); |
2243 gfx::Vector2d imageOffset(gfx::Point(webImageOffset).OffsetFromOrigin()); | |
2243 Send(new DragHostMsg_StartDragging(routing_id_, | 2244 Send(new DragHostMsg_StartDragging(routing_id_, |
2244 drop_data, | 2245 drop_data, |
2245 mask, | 2246 mask, |
2246 image.getSkBitmap(), | 2247 image.getSkBitmap(), |
2247 imageOffset)); | 2248 imageOffset)); |
2248 } | 2249 } |
2249 | 2250 |
2250 bool RenderViewImpl::acceptsLoadDrops() { | 2251 bool RenderViewImpl::acceptsLoadDrops() { |
2251 return renderer_preferences_.can_accept_load_drops; | 2252 return renderer_preferences_.can_accept_load_drops; |
2252 } | 2253 } |
(...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5504 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( | 5505 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( |
5505 const gfx::Rect& paint_bounds, | 5506 const gfx::Rect& paint_bounds, |
5506 TransportDIB** dib, | 5507 TransportDIB** dib, |
5507 gfx::Rect* location, | 5508 gfx::Rect* location, |
5508 gfx::Rect* clip, | 5509 gfx::Rect* clip, |
5509 float* scale_factor) { | 5510 float* scale_factor) { |
5510 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( | 5511 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( |
5511 paint_bounds, dib, location, clip, scale_factor); | 5512 paint_bounds, dib, location, clip, scale_factor); |
5512 } | 5513 } |
5513 | 5514 |
5514 gfx::Point RenderViewImpl::GetScrollOffset() { | 5515 gfx::Vector2d RenderViewImpl::GetScrollOffset() { |
5515 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); | 5516 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); |
5516 return gfx::Point(scroll_offset.width, scroll_offset.height); | 5517 return gfx::Vector2d(scroll_offset.width, scroll_offset.height); |
5517 } | 5518 } |
5518 | 5519 |
5519 void RenderViewImpl::OnClearFocusedNode() { | 5520 void RenderViewImpl::OnClearFocusedNode() { |
5520 if (webview()) | 5521 if (webview()) |
5521 webview()->clearFocusedNode(); | 5522 webview()->clearFocusedNode(); |
5522 } | 5523 } |
5523 | 5524 |
5524 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { | 5525 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { |
5525 if (webview()) | 5526 if (webview()) |
5526 webview()->setIsTransparent(!background.empty()); | 5527 webview()->setIsTransparent(!background.empty()); |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6317 } | 6318 } |
6318 #endif | 6319 #endif |
6319 | 6320 |
6320 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6321 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6321 TransportDIB::Handle dib_handle) { | 6322 TransportDIB::Handle dib_handle) { |
6322 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6323 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6323 RenderProcess::current()->ReleaseTransportDIB(dib); | 6324 RenderProcess::current()->ReleaseTransportDIB(dib); |
6324 } | 6325 } |
6325 | 6326 |
6326 } // namespace content | 6327 } // namespace content |
OLD | NEW |