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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_view.mm

Issue 2404783002: [Mac] Avoid "adding unknown subview" warning. (Closed)
Patch Set: Merged with head Created 4 years, 2 months 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
Index: chrome/browser/ui/cocoa/tabs/tab_view.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm
index 5936812438ff60760d89d8a7916e12f66f28279a..d0124c3a4e957ea4637e664aeafcfd147b9c1bd3 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_view.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm
@@ -51,6 +51,14 @@ const NSTimeInterval kGlowUpdateInterval = 0.025;
// has moved less than the threshold, we want to close the tab.
const CGFloat kRapidCloseDist = 2.5;
+@interface NSView (PrivateAPI)
+// Called by AppKit to check if dragging this view should move the window.
+// NSButton overrides this method in the same way so dragging window buttons
+// has no effect. NSView implementation returns NSZeroRect so the whole view
+// area can be dragged.
+- (NSRect)_opaqueRectForWindowMoveWhenInTitlebar;
+@end
+
// This class contains the logic for drawing Material Design tab images. The
// |setTabEdgeStrokeColor| method is overridden by |TabHeavyImageMaker| to draw
// high-contrast tabs.
@@ -219,6 +227,13 @@ CGFloat LineWidthFromContext(CGContextRef context) {
[super dealloc];
}
+// Called by AppKit to check if dragging this view should move the window.
+// NSButton overrides this method in the same way so dragging window buttons
+// has no effect.
+- (NSRect)_opaqueRectForWindowMoveWhenInTitlebar {
+ return [self bounds];
+}
+
// Called to obtain the context menu for when the user hits the right mouse
// button (or control-clicks). (Note that -rightMouseDown: is *not* called for
// control-click.)

Powered by Google App Engine
This is Rietveld 408576698