| OLD | NEW |
| 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 "chrome/browser/ui/cocoa/tabs/tab_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 NSPoint hitLocation = | 359 NSPoint hitLocation = |
| 360 [[self superview] convertPoint:[theEvent locationInWindow] | 360 [[self superview] convertPoint:[theEvent locationInWindow] |
| 361 fromView:nil]; | 361 fromView:nil]; |
| 362 if ([self hitTest:hitLocation] == closeButton_) { | 362 if ([self hitTest:hitLocation] == closeButton_) { |
| 363 [controller_ closeTab:self]; | 363 [controller_ closeTab:self]; |
| 364 return; | 364 return; |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 // Fire the action to select the tab. | 369 // Except in the rapid tab closure case, mouseDown: triggers a nested run loop |
| 370 [controller_ selectTab:self]; | 370 // that swallows the mouseUp: event. There's a bug in AppKit that sends |
| 371 | 371 // mouseUp: callbacks to inappropriate views, so it's doubly important that |
| 372 // Messaging the drag controller with |-endDrag:| would seem like the right | 372 // this method doesn't do anything. https://crbug.com/511095. |
| 373 // thing to do here. But, when a tab has been detached, the controller's | 373 [super mouseUp:theEvent]; |
| 374 // target is nil until the drag is finalized. Since |-mouseUp:| gets called | |
| 375 // via the manual event loop inside -[TabStripDragController | |
| 376 // maybeStartDrag:forTab:], the drag controller can end the dragging session | |
| 377 // itself directly after calling this. | |
| 378 } | 374 } |
| 379 | 375 |
| 380 - (void)otherMouseUp:(NSEvent*)theEvent { | 376 - (void)otherMouseUp:(NSEvent*)theEvent { |
| 381 if ([self isClosing]) | 377 if ([self isClosing]) |
| 382 return; | 378 return; |
| 383 | 379 |
| 384 // Support middle-click-to-close. | 380 // Support middle-click-to-close. |
| 385 if ([theEvent buttonNumber] == 2) { | 381 if ([theEvent buttonNumber] == 2) { |
| 386 // |-hitTest:| takes a location in the superview's coordinates. | 382 // |-hitTest:| takes a location in the superview's coordinates. |
| 387 NSPoint upLocation = | 383 NSPoint upLocation = |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1027 |
| 1032 // For "Increase Contrast" mode, use flat black instead of semitransparent black | 1028 // For "Increase Contrast" mode, use flat black instead of semitransparent black |
| 1033 // for the tab edge stroke. | 1029 // for the tab edge stroke. |
| 1034 + (void)setTabEdgeStrokeColor { | 1030 + (void)setTabEdgeStrokeColor { |
| 1035 static NSColor* heavyStrokeColor = | 1031 static NSColor* heavyStrokeColor = |
| 1036 [skia::SkColorToSRGBNSColor(SK_ColorBLACK) retain]; | 1032 [skia::SkColorToSRGBNSColor(SK_ColorBLACK) retain]; |
| 1037 [heavyStrokeColor set]; | 1033 [heavyStrokeColor set]; |
| 1038 } | 1034 } |
| 1039 | 1035 |
| 1040 @end | 1036 @end |
| OLD | NEW |