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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

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 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 6
7 #import "content/browser/web_contents/web_contents_view_mac.h" 7 #import "content/browser/web_contents/web_contents_view_mac.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 167 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
168 bounds.origin.y = [screen frame].size.height - bounds.origin.y 168 bounds.origin.y = [screen frame].size.height - bounds.origin.y
169 - bounds.size.height; 169 - bounds.size.height;
170 *out = gfx::Rect(NSRectToCGRect(bounds)); 170 *out = gfx::Rect(NSRectToCGRect(bounds));
171 } 171 }
172 172
173 void WebContentsViewMac::StartDragging( 173 void WebContentsViewMac::StartDragging(
174 const WebDropData& drop_data, 174 const WebDropData& drop_data,
175 WebDragOperationsMask allowed_operations, 175 WebDragOperationsMask allowed_operations,
176 const gfx::ImageSkia& image, 176 const gfx::ImageSkia& image,
177 const gfx::Point& image_offset) { 177 const gfx::Vector2d& image_offset) {
178 // By allowing nested tasks, the code below also allows Close(), 178 // By allowing nested tasks, the code below also allows Close(),
179 // which would deallocate |this|. The same problem can occur while 179 // which would deallocate |this|. The same problem can occur while
180 // processing -sendEvent:, so Close() is deferred in that case. 180 // processing -sendEvent:, so Close() is deferred in that case.
181 // Drags from web content do not come via -sendEvent:, this sets the 181 // Drags from web content do not come via -sendEvent:, this sets the
182 // same flag -sendEvent: would. 182 // same flag -sendEvent: would.
183 base::mac::ScopedSendingEvent sending_event_scoper; 183 base::mac::ScopedSendingEvent sending_event_scoper;
184 184
185 // The drag invokes a nested event loop, arrange to continue 185 // The drag invokes a nested event loop, arrange to continue
186 // processing events. 186 // processing events.
187 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 187 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
188 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); 188 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations);
189 NSPoint offset = NSPointFromCGPoint(image_offset.ToCGPoint()); 189 NSPoint offset = NSPointFromCGPoint(
190 gfx::PointAtOffsetFromOrigin(image_offset).ToCGPoint());
190 [cocoa_view_ startDragWithDropData:drop_data 191 [cocoa_view_ startDragWithDropData:drop_data
191 dragOperationMask:mask 192 dragOperationMask:mask
192 image:gfx::NSImageFromImageSkia(image) 193 image:gfx::NSImageFromImageSkia(image)
193 offset:offset]; 194 offset:offset];
194 } 195 }
195 196
196 void WebContentsViewMac::RenderViewCreated(RenderViewHost* host) { 197 void WebContentsViewMac::RenderViewCreated(RenderViewHost* host) {
197 // We want updates whenever the intrinsic width of the webpage changes. 198 // We want updates whenever the intrinsic width of the webpage changes.
198 // Put the RenderView into that mode. The preferred width is used for example 199 // Put the RenderView into that mode. The preferred width is used for example
199 // when the "zoom" button in the browser window is clicked. 200 // when the "zoom" button in the browser window is clicked.
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 [[[notification userInfo] objectForKey:kSelectionDirection] 532 [[[notification userInfo] objectForKey:kSelectionDirection]
532 unsignedIntegerValue]; 533 unsignedIntegerValue];
533 if (direction == NSDirectSelection) 534 if (direction == NSDirectSelection)
534 return; 535 return;
535 536
536 [self webContents]-> 537 [self webContents]->
537 FocusThroughTabTraversal(direction == NSSelectingPrevious); 538 FocusThroughTabTraversal(direction == NSSelectingPrevious);
538 } 539 }
539 540
540 @end 541 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698