mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 07:05:24 +00:00
Fix tracking rect setup for scrolling tabs. Patch by smorgan <stuart.morgan@alumni.case.edu> r=delliott sr=pink b=355715
This commit is contained in:
parent
b31519be79
commit
293a9d1fb4
@ -367,14 +367,13 @@ static const int kOverflowButtonMargin = 1;
|
||||
local = [self convertPoint:local fromView:nil];
|
||||
|
||||
BrowserTabViewItem* tab = nil;
|
||||
float rightEdge = NSMaxX([self tabsRect]);
|
||||
while ((tab = [tabEnumerator nextObject])) {
|
||||
TabButtonCell* tabButton = [tab tabButtonCell];
|
||||
if (tabButton) {
|
||||
NSRect trackingRect = [tabButton frame];
|
||||
// only track tabs that are onscreen
|
||||
if (NSMaxX(trackingRect) > (rightEdge + 0.00001))
|
||||
break;
|
||||
if (trackingRect.size.width < 0.00001)
|
||||
continue;
|
||||
|
||||
[mTrackingCells addObject:tabButton];
|
||||
[tabButton addTrackingRectInView:self withFrame:trackingRect cursorLocation:local];
|
||||
@ -384,6 +383,20 @@ static const int kOverflowButtonMargin = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// causes tab buttons to stop reacting to mouse events
|
||||
-(void)unregisterTabButtonsForTracking
|
||||
{
|
||||
if (mTrackingCells) {
|
||||
NSEnumerator *tabEnumerator = [mTrackingCells objectEnumerator];
|
||||
TabButtonCell *tab = nil;
|
||||
while ((tab = (TabButtonCell *)[tabEnumerator nextObject]))
|
||||
[tab removeTrackingRectFromView:self];
|
||||
[mTrackingCells release];
|
||||
mTrackingCells = nil;
|
||||
}
|
||||
[self removeAllToolTips];
|
||||
}
|
||||
|
||||
- (void)viewDidMoveToWindow
|
||||
{
|
||||
// setup the tab bar to recieve notifications of key window changes
|
||||
@ -411,20 +424,6 @@ static const int kOverflowButtonMargin = 1;
|
||||
if ([self isMouseInside])
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
// causes tab buttons to stop reacting to mouse events
|
||||
-(void)unregisterTabButtonsForTracking
|
||||
{
|
||||
if (mTrackingCells) {
|
||||
NSEnumerator *tabEnumerator = [mTrackingCells objectEnumerator];
|
||||
TabButtonCell *tab = nil;
|
||||
while ((tab = (TabButtonCell *)[tabEnumerator nextObject]))
|
||||
[tab removeTrackingRectFromView: self];
|
||||
[mTrackingCells release];
|
||||
mTrackingCells = nil;
|
||||
}
|
||||
[self removeAllToolTips];
|
||||
}
|
||||
|
||||
// returns the height the tab bar should be if drawn
|
||||
-(float)tabBarHeight
|
||||
|
Loading…
Reference in New Issue
Block a user