Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1258)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasefinal Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 context_menu_node_ = data.node; 2184 context_menu_node_ = data.node;
2185 2185
2186 #if defined(OS_ANDROID) 2186 #if defined(OS_ANDROID)
2187 gfx::Rect start_rect; 2187 gfx::Rect start_rect;
2188 gfx::Rect end_rect; 2188 gfx::Rect end_rect;
2189 GetSelectionBounds(&start_rect, &end_rect); 2189 GetSelectionBounds(&start_rect, &end_rect);
2190 gfx::Point start_point(start_rect.x(), 2190 gfx::Point start_point(start_rect.x(),
2191 start_rect.bottom()); 2191 start_rect.bottom());
2192 gfx::Point end_point(end_rect.right(), 2192 gfx::Point end_point(end_rect.right(),
2193 end_rect.bottom()); 2193 end_rect.bottom());
2194 params.selection_start = GetScrollOffset().Add(start_point); 2194 params.selection_start = start_point.Add(GetScrollOffset());
2195 params.selection_end = GetScrollOffset().Add(end_point); 2195 params.selection_end = end_point.Add(GetScrollOffset());
2196 #endif 2196 #endif
2197 2197
2198 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); 2198 Send(new ViewHostMsg_ContextMenu(routing_id_, params));
2199 } 2199 }
2200 2200
2201 void RenderViewImpl::setStatusText(const WebString& text) { 2201 void RenderViewImpl::setStatusText(const WebString& text) {
2202 } 2202 }
2203 2203
2204 void RenderViewImpl::UpdateTargetURL(const GURL& url, 2204 void RenderViewImpl::UpdateTargetURL(const GURL& url,
2205 const GURL& fallback_url) { 2205 const GURL& fallback_url) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 2255
2256 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { 2256 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) {
2257 focus_url_ = GURL(url); 2257 focus_url_ = GURL(url);
2258 UpdateTargetURL(focus_url_, mouse_over_url_); 2258 UpdateTargetURL(focus_url_, mouse_over_url_);
2259 } 2259 }
2260 2260
2261 void RenderViewImpl::startDragging(WebFrame* frame, 2261 void RenderViewImpl::startDragging(WebFrame* frame,
2262 const WebDragData& data, 2262 const WebDragData& data,
2263 WebDragOperationsMask mask, 2263 WebDragOperationsMask mask,
2264 const WebImage& image, 2264 const WebImage& image,
2265 const WebPoint& imageOffset) { 2265 const WebPoint& webImageOffset) {
2266 WebDropData drop_data(data); 2266 WebDropData drop_data(data);
2267 drop_data.referrer_policy = frame->document().referrerPolicy(); 2267 drop_data.referrer_policy = frame->document().referrerPolicy();
2268 gfx::Vector2d imageOffset(gfx::Point(webImageOffset).OffsetFromOrigin());
2268 Send(new DragHostMsg_StartDragging(routing_id_, 2269 Send(new DragHostMsg_StartDragging(routing_id_,
2269 drop_data, 2270 drop_data,
2270 mask, 2271 mask,
2271 image.getSkBitmap(), 2272 image.getSkBitmap(),
2272 imageOffset)); 2273 imageOffset));
2273 } 2274 }
2274 2275
2275 bool RenderViewImpl::acceptsLoadDrops() { 2276 bool RenderViewImpl::acceptsLoadDrops() {
2276 return renderer_preferences_.can_accept_load_drops; 2277 return renderer_preferences_.can_accept_load_drops;
2277 } 2278 }
(...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after
5529 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( 5530 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint(
5530 const gfx::Rect& paint_bounds, 5531 const gfx::Rect& paint_bounds,
5531 TransportDIB** dib, 5532 TransportDIB** dib,
5532 gfx::Rect* location, 5533 gfx::Rect* location,
5533 gfx::Rect* clip, 5534 gfx::Rect* clip,
5534 float* scale_factor) { 5535 float* scale_factor) {
5535 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( 5536 return pepper_delegate_.GetBitmapForOptimizedPluginPaint(
5536 paint_bounds, dib, location, clip, scale_factor); 5537 paint_bounds, dib, location, clip, scale_factor);
5537 } 5538 }
5538 5539
5539 gfx::Point RenderViewImpl::GetScrollOffset() { 5540 gfx::Vector2d RenderViewImpl::GetScrollOffset() {
5540 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); 5541 WebSize scroll_offset = webview()->mainFrame()->scrollOffset();
5541 return gfx::Point(scroll_offset.width, scroll_offset.height); 5542 return gfx::Vector2d(scroll_offset.width, scroll_offset.height);
5542 } 5543 }
5543 5544
5544 void RenderViewImpl::OnClearFocusedNode() { 5545 void RenderViewImpl::OnClearFocusedNode() {
5545 if (webview()) 5546 if (webview())
5546 webview()->clearFocusedNode(); 5547 webview()->clearFocusedNode();
5547 } 5548 }
5548 5549
5549 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { 5550 void RenderViewImpl::OnSetBackground(const SkBitmap& background) {
5550 if (webview()) 5551 if (webview())
5551 webview()->setIsTransparent(!background.empty()); 5552 webview()->setIsTransparent(!background.empty());
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
6342 } 6343 }
6343 #endif 6344 #endif
6344 6345
6345 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6346 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6346 TransportDIB::Handle dib_handle) { 6347 TransportDIB::Handle dib_handle) {
6347 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6348 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6348 RenderProcess::current()->ReleaseTransportDIB(dib); 6349 RenderProcess::current()->ReleaseTransportDIB(dib);
6349 } 6350 }
6350 6351
6351 } // namespace content 6352 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698