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

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: RenderText fixup 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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large 2155 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large
2156 // data encoded images. We should have a way to save them. 2156 // data encoded images. We should have a way to save them.
2157 if (params.src_url.spec().size() > kMaxURLChars) 2157 if (params.src_url.spec().size() > kMaxURLChars)
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 params.selection_start =
2166 start_rect.bottom()); 2166 gfx::Point(start_rect.x(), start_rect.bottom()) + GetScrollOffset();
2167 gfx::Point end_point(end_rect.right(), 2167 params.selection_end =
2168 end_rect.bottom()); 2168 gfx::Point(end_rect.right(), end_rect.bottom()) + GetScrollOffset();
2169 params.selection_start = GetScrollOffset().Add(start_point);
2170 params.selection_end = GetScrollOffset().Add(end_point);
2171 #endif 2169 #endif
2172 2170
2173 Send(new ViewHostMsg_ContextMenu(routing_id_, params)); 2171 Send(new ViewHostMsg_ContextMenu(routing_id_, params));
2174 } 2172 }
2175 2173
2176 void RenderViewImpl::setStatusText(const WebString& text) { 2174 void RenderViewImpl::setStatusText(const WebString& text) {
2177 } 2175 }
2178 2176
2179 void RenderViewImpl::UpdateTargetURL(const GURL& url, 2177 void RenderViewImpl::UpdateTargetURL(const GURL& url,
2180 const GURL& fallback_url) { 2178 const GURL& fallback_url) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 2228
2231 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { 2229 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) {
2232 focus_url_ = GURL(url); 2230 focus_url_ = GURL(url);
2233 UpdateTargetURL(focus_url_, mouse_over_url_); 2231 UpdateTargetURL(focus_url_, mouse_over_url_);
2234 } 2232 }
2235 2233
2236 void RenderViewImpl::startDragging(WebFrame* frame, 2234 void RenderViewImpl::startDragging(WebFrame* frame,
2237 const WebDragData& data, 2235 const WebDragData& data,
2238 WebDragOperationsMask mask, 2236 WebDragOperationsMask mask,
2239 const WebImage& image, 2237 const WebImage& image,
2240 const WebPoint& imageOffset) { 2238 const WebPoint& webImageOffset) {
2241 WebDropData drop_data(data); 2239 WebDropData drop_data(data);
2242 drop_data.referrer_policy = frame->document().referrerPolicy(); 2240 drop_data.referrer_policy = frame->document().referrerPolicy();
2241 gfx::Vector2d imageOffset(gfx::Point(webImageOffset).OffsetFromOrigin());
2243 Send(new DragHostMsg_StartDragging(routing_id_, 2242 Send(new DragHostMsg_StartDragging(routing_id_,
2244 drop_data, 2243 drop_data,
2245 mask, 2244 mask,
2246 image.getSkBitmap(), 2245 image.getSkBitmap(),
2247 imageOffset)); 2246 imageOffset));
2248 } 2247 }
2249 2248
2250 bool RenderViewImpl::acceptsLoadDrops() { 2249 bool RenderViewImpl::acceptsLoadDrops() {
2251 return renderer_preferences_.can_accept_load_drops; 2250 return renderer_preferences_.can_accept_load_drops;
2252 } 2251 }
(...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after
5511 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( 5510 webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint(
5512 const gfx::Rect& paint_bounds, 5511 const gfx::Rect& paint_bounds,
5513 TransportDIB** dib, 5512 TransportDIB** dib,
5514 gfx::Rect* location, 5513 gfx::Rect* location,
5515 gfx::Rect* clip, 5514 gfx::Rect* clip,
5516 float* scale_factor) { 5515 float* scale_factor) {
5517 return pepper_delegate_.GetBitmapForOptimizedPluginPaint( 5516 return pepper_delegate_.GetBitmapForOptimizedPluginPaint(
5518 paint_bounds, dib, location, clip, scale_factor); 5517 paint_bounds, dib, location, clip, scale_factor);
5519 } 5518 }
5520 5519
5521 gfx::Point RenderViewImpl::GetScrollOffset() { 5520 gfx::Vector2d RenderViewImpl::GetScrollOffset() {
5522 WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); 5521 WebSize scroll_offset = webview()->mainFrame()->scrollOffset();
5523 return gfx::Point(scroll_offset.width, scroll_offset.height); 5522 return gfx::Vector2d(scroll_offset.width, scroll_offset.height);
5524 } 5523 }
5525 5524
5526 void RenderViewImpl::OnClearFocusedNode() { 5525 void RenderViewImpl::OnClearFocusedNode() {
5527 if (webview()) 5526 if (webview())
5528 webview()->clearFocusedNode(); 5527 webview()->clearFocusedNode();
5529 } 5528 }
5530 5529
5531 void RenderViewImpl::OnSetBackground(const SkBitmap& background) { 5530 void RenderViewImpl::OnSetBackground(const SkBitmap& background) {
5532 if (webview()) 5531 if (webview())
5533 webview()->setIsTransparent(!background.empty()); 5532 webview()->setIsTransparent(!background.empty());
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
6328 } 6327 }
6329 #endif 6328 #endif
6330 6329
6331 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6330 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6332 TransportDIB::Handle dib_handle) { 6331 TransportDIB::Handle dib_handle) {
6333 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6332 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6334 RenderProcess::current()->ReleaseTransportDIB(dib); 6333 RenderProcess::current()->ReleaseTransportDIB(dib);
6335 } 6334 }
6336 6335
6337 } // namespace content 6336 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698