Skip to content

Commit 8ec8cdd

Browse files
committedNov 25, 2024
Bug 1933094 - Remove nsView::GetFloating and associated code. r=jwatt
The only place it matters is GetDisplayRootFor and we check for popups explicitly there. Differential Revision: https://phabricator.services.mozilla.com/D230058
1 parent 8a91f0e commit 8ec8cdd

File tree

5 files changed

+4
-68
lines changed

5 files changed

+4
-68
lines changed
 

‎layout/xul/nsMenuPopupFrame.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,7 @@ void nsMenuPopupFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
149149

150150
CreatePopupView();
151151

152-
// XXX Hack. The popup's view should float above all other views,
153-
// so we use the nsView::SetFloating() to tell the view manager
154-
// about that constraint.
155152
nsView* ourView = GetView();
156-
nsViewManager* viewManager = ourView->GetViewManager();
157-
viewManager->SetViewFloating(ourView, true);
158153

159154
const auto& el = PopupElement();
160155
mPopupType = PopupType::Panel;

‎view/nsView.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,6 @@ void nsView::SetVisibility(ViewVisibility aVisibility) {
419419
NotifyEffectiveVisibilityChanged(IsEffectivelyVisible());
420420
}
421421

422-
void nsView::SetFloating(bool aFloatingView) {
423-
if (aFloatingView)
424-
mVFlags |= NS_VIEW_FLAG_FLOATING;
425-
else
426-
mVFlags &= ~NS_VIEW_FLAG_FLOATING;
427-
}
428-
429422
void nsView::InvalidateHierarchy() {
430423
if (mViewManager->GetRootView() == this) mViewManager->InvalidateHierarchy();
431424

‎view/nsView.h

+1-27
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ enum class WindowType : uint8_t;
100100
// the layer's parent.
101101
enum class ViewVisibility : uint8_t { Hide = 0, Show = 1 };
102102

103-
// Public view flags
104-
105-
// Indicates that the view is a floating view.
106-
#define NS_VIEW_FLAG_FLOATING 0x0008
107-
108103
//----------------------------------------------------------------------
109104

110105
/**
@@ -225,16 +220,6 @@ class nsView final : public nsIWidgetListener {
225220
*/
226221
ViewVisibility GetVisibility() const { return mVis; }
227222

228-
/**
229-
* Get whether the view "floats" above all other views,
230-
* which tells the compositor not to consider higher views in
231-
* the view hierarchy that would geometrically intersect with
232-
* this view. This is a hack, but it fixes some problems with
233-
* views that need to be drawn in front of all other views.
234-
* @result true if the view floats, false otherwise.
235-
*/
236-
bool GetFloating() const { return (mVFlags & NS_VIEW_FLAG_FLOATING) != 0; }
237-
238223
/**
239224
* Called to query the parent of the view.
240225
* @result view's parent
@@ -400,8 +385,7 @@ class nsView final : public nsIWidgetListener {
400385

401386
nsRegion& GetDirtyRegion() {
402387
if (!mDirtyRegion) {
403-
NS_ASSERTION(!mParent || GetFloating(),
404-
"Only display roots should have dirty regions");
388+
NS_ASSERTION(!mParent, "Only display roots should have dirty regions");
405389
mDirtyRegion = mozilla::MakeUnique<nsRegion>();
406390
}
407391
return *mDirtyRegion;
@@ -472,16 +456,6 @@ class nsView final : public nsIWidgetListener {
472456
*/
473457
void SetVisibility(ViewVisibility visibility);
474458

475-
/**
476-
* Set/Get whether the view "floats" above all other views,
477-
* which tells the compositor not to consider higher views in
478-
* the view hierarchy that would geometrically intersect with
479-
* this view. This is a hack, but it fixes some problems with
480-
* views that need to be drawn in front of all other views.
481-
* @result true if the view floats, false otherwise.
482-
*/
483-
void SetFloating(bool aFloatingView);
484-
485459
// Helper function to get mouse grabbing off this view (by moving it to the
486460
// parent, if we can)
487461
void DropMouseGrabbing();

‎view/nsViewManager.cpp

+3-20
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,13 @@ nsView* nsViewManager::GetDisplayRootFor(nsView* aView) {
214214
nsView* displayRoot = aView;
215215
for (;;) {
216216
nsView* displayParent = displayRoot->GetParent();
217-
if (!displayParent) return displayRoot;
218-
219-
if (displayRoot->GetFloating() && !displayParent->GetFloating())
217+
if (!displayParent) {
220218
return displayRoot;
219+
}
221220

222-
// If we have a combobox dropdown popup within a panel popup, both the view
223-
// for the dropdown popup and its parent will be floating, so we need to
224-
// distinguish this situation. We do this by looking for a widget. Any view
225-
// with a widget is a display root.
221+
// Any view with a widget is a display root.
226222
nsIWidget* widget = displayRoot->GetWidget();
227223
if (widget && widget->GetWindowType() == widget::WindowType::Popup) {
228-
NS_ASSERTION(displayRoot->GetFloating() && displayParent->GetFloating(),
229-
"this should only happen with floating views that have "
230-
"floating parents");
231224
return displayRoot;
232225
}
233226

@@ -755,10 +748,6 @@ void nsViewManager::InsertChild(nsView* aParent, nsView* aChild,
755748
ReparentWidgets(aChild, aParent);
756749
}
757750
}
758-
759-
// if the parent view is marked as "floating", make the newly added view
760-
// float as well.
761-
if (aParent->GetFloating()) aChild->SetFloating(true);
762751
}
763752
}
764753

@@ -795,12 +784,6 @@ void nsViewManager::ResizeView(nsView* aView, const nsRect& aRect) {
795784
// because layout will change it back again if necessary.
796785
}
797786

798-
void nsViewManager::SetViewFloating(nsView* aView, bool aFloating) {
799-
NS_ASSERTION(aView, "no view");
800-
801-
aView->SetFloating(aFloating);
802-
}
803-
804787
void nsViewManager::SetViewVisibility(nsView* aView, ViewVisibility aVisible) {
805788
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
806789

‎view/nsViewManager.h

-9
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,6 @@ class nsViewManager final {
196196
*/
197197
void SetViewVisibility(nsView* aView, ViewVisibility aVisible);
198198

199-
/**
200-
* Set whether the view "floats" above all other views,
201-
* which tells the compositor not to consider higher views in
202-
* the view hierarchy that would geometrically intersect with
203-
* this view. This is a hack, but it fixes some problems with
204-
* views that need to be drawn in front of all other views.
205-
*/
206-
void SetViewFloating(nsView* aView, bool aFloatingView);
207-
208199
/**
209200
* Set the presshell associated with this manager
210201
* @param aPresShell - new presshell

0 commit comments

Comments
 (0)
Failed to load comments.