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
This commit is contained in:
Brad Werth 2023-10-03 19:14:23 +00:00
Родитель 49558158fa
Коммит ce7aeec770
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -1897,7 +1897,10 @@ void nsChildView::UpdateBoundsFromView() {
// of _opaqueRect returns [self visibleRect], and the default implementation
// of _opaqueRectForWindowMoveWhenInTitlebar returns NSZeroRect unless it's
// overridden.
return [self visibleRect];
//
// Since this view is constructed and used such that its entire bounds is the
// relevant region, we just return our bounds.
return self.bounds;
}
@end