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

Unified Diff: chrome/browser/cocoa/tab_strip_controller.mm

Issue 501135: Revert 34998, more stabbing in the dark to find a perf regression - Mac: impl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.h ('k') | chrome/browser/cocoa/tab_strip_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_strip_controller.mm
===================================================================
--- chrome/browser/cocoa/tab_strip_controller.mm (revision 35037)
+++ chrome/browser/cocoa/tab_strip_controller.mm (working copy)
@@ -120,7 +120,7 @@
- (NSInteger)numberOfOpenUnpinnedTabs;
- (void)mouseMoved:(NSEvent*)event;
- (void)setTabTrackingAreasEnabled:(BOOL)enabled;
-- (void)droppingURLsAt:(NSPoint)point
+- (void)droppingURLsAt:(NSPoint)location
givesIndex:(NSInteger*)index
disposition:(WindowOpenDisposition*)disposition;
@end
@@ -1436,11 +1436,11 @@
[self setTabTrackingAreasEnabled:mouseInside_];
}
-// Get the index and disposition for a potential URL(s) drop given a point (in
-// the |TabStripView|'s coordinates). It considers only the x-coordinate of the
-// given point. If it's in the "middle" of a tab, it drops on that tab. If it's
-// to the left, it inserts to the left, and similarly for the right.
-- (void)droppingURLsAt:(NSPoint)point
+// Get the index and disposition for a potential URL(s) drop given a location
+// (in window base coordinates). It considers x coordinate of the given
+// location. If it's in the "middle" of a tab, it drops on that tab. If it's to
+// the left, it inserts to the left, and similarly for the right.
+- (void)droppingURLsAt:(NSPoint)location
givesIndex:(NSInteger*)index
disposition:(WindowOpenDisposition*)disposition {
// Proportion of the tab which is considered the "middle" (and causes things
@@ -1455,9 +1455,8 @@
DCHECK([view isKindOfClass:[TabView class]]);
// Recall that |-[NSView frame]| is in its superview's coordinates, so a
- // |TabView|'s frame is in the coordinates of the |TabStripView| (which
- // matches the coordinate system of |point|).
- NSRect frame = [view frame];
+ // |TabView|'s frame is in the coordinates of the |TabStripView|.
+ NSRect frame = [tabStripView_ convertRectToBase:[view frame]];
// Modify the frame to make it "unoverlapped".
frame.origin.x += kTabOverlap / 2.0;
@@ -1466,14 +1465,14 @@
frame.size.width = 1.0; // try to avoid complete failure
// Drop in a new tab to the left of tab |i|?
- if (point.x < (frame.origin.x + kLRProportion * frame.size.width)) {
+ if (location.x < (frame.origin.x + kLRProportion * frame.size.width)) {
*index = i;
*disposition = NEW_FOREGROUND_TAB;
return;
}
// Drop on tab |i|?
- if (point.x <= (frame.origin.x +
+ if (location.x <= (frame.origin.x +
(1.0 - kLRProportion) * frame.size.width)) {
*index = i;
*disposition = CURRENT_TAB;
@@ -1490,10 +1489,8 @@
*disposition = NEW_FOREGROUND_TAB;
}
-// (URLDropTargetController protocol)
-- (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point {
- DCHECK_EQ(view, tabStripView_.get());
-
+// Drop URLs at the given location.
+- (void)dropURLs:(NSArray*)urls at:(NSPoint)location {
if ([urls count] < 1) {
NOTREACHED();
return;
@@ -1510,7 +1507,7 @@
// Get the index and disposition.
NSInteger index;
WindowOpenDisposition disposition;
- [self droppingURLsAt:point
+ [self droppingURLsAt:location
givesIndex:&index
disposition:&disposition];
@@ -1532,16 +1529,15 @@
}
}
-// (URLDropTargetController protocol)
-- (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point {
- DCHECK_EQ(view, tabStripView_.get());
-
+// Update (possibly showing) the indicator which indicates where an URL drop
+// would happen.
+- (void)indicateDropURLsAt:(NSPoint)location {
// The minimum y-coordinate at which one should consider place the arrow.
const CGFloat arrowBaseY = 25;
NSInteger index;
WindowOpenDisposition disposition;
- [self droppingURLsAt:point
+ [self droppingURLsAt:location
givesIndex:&index
disposition:&disposition];
@@ -1573,10 +1569,8 @@
[tabStripView_ setNeedsDisplay:YES];
}
-// (URLDropTargetController protocol)
-- (void)hideDropURLsIndicatorInView:(NSView*)view {
- DCHECK_EQ(view, tabStripView_.get());
-
+// Hide the indicator which indicates where an URL drop would happen.
+- (void)hideDropURLsIndicator {
if ([tabStripView_ dropArrowShown]) {
[tabStripView_ setDropArrowShown:NO];
[tabStripView_ setNeedsDisplay:YES];
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.h ('k') | chrome/browser/cocoa/tab_strip_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698