Bug 1856452: Make NonDraggableView opaque region limited to its bounds. r=mstange
commitce7aeec77052b6a7c1012ce759e03d4c0cad40d8
authorBrad Werth <bwerth@mozilla.com>
Tue, 3 Oct 2023 19:14:23 +0000 (3 19:14 +0000)
committerBrad Werth <bwerth@mozilla.com>
Tue, 3 Oct 2023 19:14:23 +0000 (3 19:14 +0000)
tree64d889803ac89babd872edcf70cebf6a15a209d6
parent49558158fa7110607ace9083281671140c01301c
Bug 1856452: Make NonDraggableView opaque region limited to its bounds. r=mstange

NonDraggableView responds to an undocumented selector
_opaqueRectForWindowMoveWhenInTitlebar to determine if mouse downs
within its bounds should drag the window. Since some of our
NonDraggableViews are used to represent the tabs, which should prevent
window dragging, we want to return an NSRect here which represents only
the view's visible bounds. Prior to this patch, we were returing [self
visibleRect], which is calculated by the ancestor clip chain. That's
mostly what we want, but it relies upon the NonDraggableView clipping to
its own bounds. There is a property that sort-of conveys this,
clipsToBounds, but as documented it implies that it only affects the
display of subviews. Since we are already overridding this undocumented
method, we just return the view's bounds  here instead of setting the
clipsToBounds property which implies that we are expecting to add
subviews to the NonDraggableViews. This keeps the complexity all in one
place.

Differential Revision: https://phabricator.services.mozilla.com/D189866
widget/cocoa/nsChildView.mm