forked from mirrors/gecko-dev
Backed out changeset bb1d2a4a5570 (bug 1786525) for causing build bustages in xpfe/appshell/AppWindow.cpp CLOSED TREE
This commit is contained in:
parent
163b9c7bda
commit
9d7f9853a2
13 changed files with 29 additions and 48 deletions
|
|
@ -819,7 +819,6 @@ void nsMenuPopupFrame::InitializePopup(nsIContent* aAnchorContent,
|
|||
mHFlip = false;
|
||||
mAlignmentOffset = 0;
|
||||
mPositionedOffset = 0;
|
||||
mPositionedByMoveToRect = false;
|
||||
|
||||
mAnchorType = aAnchorType;
|
||||
|
||||
|
|
@ -1538,16 +1537,12 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
|
|||
// tell us which axis the popup is flush against in case we have to move
|
||||
// it around later. The AdjustPositionForAnchorAlign method accounts for
|
||||
// the popup's margin.
|
||||
if (!mPositionedByMoveToRect) {
|
||||
mUntransformedAnchorRect = anchorRect;
|
||||
}
|
||||
mUntransformedAnchorRect = anchorRect;
|
||||
screenPoint = AdjustPositionForAnchorAlign(anchorRect, hFlip, vFlip);
|
||||
} else {
|
||||
// with no anchor, the popup is positioned relative to the root frame
|
||||
anchorRect = rootScreenRect;
|
||||
if (!mPositionedByMoveToRect) {
|
||||
mUntransformedAnchorRect = anchorRect;
|
||||
}
|
||||
mUntransformedAnchorRect = anchorRect;
|
||||
screenPoint = anchorRect.TopLeft() + nsPoint(margin.left, margin.top);
|
||||
}
|
||||
|
||||
|
|
@ -1584,9 +1579,7 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
|
|||
} else {
|
||||
screenPoint = mScreenRect.TopLeft();
|
||||
anchorRect = nsRect(screenPoint, nsSize());
|
||||
if (!mPositionedByMoveToRect) {
|
||||
mUntransformedAnchorRect = anchorRect;
|
||||
}
|
||||
mUntransformedAnchorRect = anchorRect;
|
||||
|
||||
// Right-align RTL context menus, and apply margin and offsets as per the
|
||||
// platform conventions.
|
||||
|
|
@ -2415,8 +2408,7 @@ nsMargin nsMenuPopupFrame::GetMargin() const {
|
|||
return margin;
|
||||
}
|
||||
|
||||
void nsMenuPopupFrame::MoveTo(const CSSPoint& aPos, bool aUpdateAttrs,
|
||||
bool aByMoveToRect) {
|
||||
void nsMenuPopupFrame::MoveTo(const CSSPoint& aPos, bool aUpdateAttrs) {
|
||||
nsIWidget* widget = GetWidget();
|
||||
nsPoint appUnitsPos = CSSPixel::ToAppUnits(aPos);
|
||||
|
||||
|
|
@ -2441,7 +2433,6 @@ void nsMenuPopupFrame::MoveTo(const CSSPoint& aPos, bool aUpdateAttrs,
|
|||
return;
|
||||
}
|
||||
|
||||
mPositionedByMoveToRect = aByMoveToRect;
|
||||
mScreenRect.MoveTo(appUnitsPos);
|
||||
if (mAnchorType == MenuPopupAnchorType_Rect) {
|
||||
// This ensures that the anchor width is still honored, to prevent it from
|
||||
|
|
|
|||
|
|
@ -318,8 +318,7 @@ class nsMenuPopupFrame final : public nsBoxFrame,
|
|||
// If aUpdateAttrs is true, and the popup already has left or top attributes,
|
||||
// then those attributes are updated to the new location.
|
||||
// The frame may be destroyed by this method.
|
||||
void MoveTo(const mozilla::CSSPoint& aPos, bool aUpdateAttrs,
|
||||
bool aByMoveToRect = false);
|
||||
void MoveTo(const mozilla::CSSPoint& aPos, bool aUpdateAttrs);
|
||||
|
||||
void MoveToAnchor(nsIContent* aAnchorContent, const nsAString& aPosition,
|
||||
int32_t aXPos, int32_t aYPos, bool aAttributesOverride);
|
||||
|
|
@ -569,11 +568,6 @@ class nsMenuPopupFrame final : public nsBoxFrame,
|
|||
// without margins applied, as GTK is what takes care of determining how to
|
||||
// flip etc. on Wayland.
|
||||
nsRect mUntransformedAnchorRect;
|
||||
|
||||
// Whether we were moved by the move-to-rect Wayland callback. In that case,
|
||||
// we stop updating the anchor so that we can end up with a stable position.
|
||||
bool mPositionedByMoveToRect = false;
|
||||
|
||||
// Store SizedToPopup attribute for MoveTo call to avoid
|
||||
// unwanted popup resize there.
|
||||
bool mSizedToPopup = false;
|
||||
|
|
|
|||
|
|
@ -558,8 +558,7 @@ static nsMenuPopupFrame* GetPopupToMoveOrResize(nsIFrame* aFrame) {
|
|||
return menuPopupFrame;
|
||||
}
|
||||
|
||||
void nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt,
|
||||
bool aByMoveToRect) {
|
||||
void nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt) {
|
||||
nsMenuPopupFrame* menuPopupFrame = GetPopupToMoveOrResize(aFrame);
|
||||
if (!menuPopupFrame) {
|
||||
return;
|
||||
|
|
@ -592,7 +591,7 @@ void nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt,
|
|||
} else {
|
||||
CSSPoint cssPos = LayoutDeviceIntPoint::FromUnknownPoint(aPnt) /
|
||||
menuPopupFrame->PresContext()->CSSToDevPixelScale();
|
||||
menuPopupFrame->MoveTo(cssPos, false, aByMoveToRect);
|
||||
menuPopupFrame->MoveTo(cssPos, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -659,9 +659,9 @@ class nsXULPopupManager final : public nsIDOMEventListener,
|
|||
|
||||
/**
|
||||
* Indicate that the popup associated with aView has been moved to the
|
||||
* specified screen coordinates.
|
||||
* specified screen coordiates.
|
||||
*/
|
||||
void PopupMoved(nsIFrame* aFrame, nsIntPoint aPoint, bool aByMoveToRect);
|
||||
void PopupMoved(nsIFrame* aFrame, nsIntPoint aPoint);
|
||||
|
||||
/**
|
||||
* Indicate that the popup associated with aView has been resized to the
|
||||
|
|
|
|||
|
|
@ -919,12 +919,10 @@ static bool IsPopupWidget(nsIWidget* aWidget) {
|
|||
|
||||
PresShell* nsView::GetPresShell() { return GetViewManager()->GetPresShell(); }
|
||||
|
||||
bool nsView::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y,
|
||||
ByMoveToRect aByMoveToRect) {
|
||||
bool nsView::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm && IsPopupWidget(aWidget)) {
|
||||
pm->PopupMoved(mFrame, nsIntPoint(x, y),
|
||||
aByMoveToRect == ByMoveToRect::Yes);
|
||||
pm->PopupMoved(mFrame, nsIntPoint(x, y));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -444,8 +444,7 @@ class nsView final : public nsIWidgetListener {
|
|||
// nsIWidgetListener
|
||||
virtual mozilla::PresShell* GetPresShell() override;
|
||||
virtual nsView* GetView() override { return this; }
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y,
|
||||
ByMoveToRect) override;
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
|
||||
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth,
|
||||
int32_t aHeight) override;
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
|
|
|||
|
|
@ -1897,7 +1897,12 @@ void nsWindow::WaylandPopupPropagateChangesToLayout(bool aMove, bool aResize) {
|
|||
}
|
||||
if (aMove) {
|
||||
LOG(" needPositionUpdate, bounds [%d, %d]", mBounds.x, mBounds.y);
|
||||
NotifyWindowMoved(mBounds.x, mBounds.y, ByMoveToRect::Yes);
|
||||
NotifyWindowMoved(mBounds.x, mBounds.y);
|
||||
if (nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame())) {
|
||||
auto p = CSSIntPoint::Round(
|
||||
mBounds.TopLeft() / popupFrame->PresContext()->CSSToDevPixelScale());
|
||||
popupFrame->MoveTo(p, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1641,10 +1641,9 @@ void nsBaseWidget::NotifyWindowDestroyed() {
|
|||
}
|
||||
}
|
||||
|
||||
void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY,
|
||||
ByMoveToRect aByMoveToRect) {
|
||||
void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY) {
|
||||
if (mWidgetListener) {
|
||||
mWidgetListener->WindowMoved(this, aX, aY, aByMoveToRect);
|
||||
mWidgetListener->WindowMoved(this, aX, aY);
|
||||
}
|
||||
|
||||
if (mIMEHasFocus && IMENotificationRequestsRef().WantPositionChanged()) {
|
||||
|
|
|
|||
|
|
@ -355,10 +355,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
|||
|
||||
void NotifyWindowDestroyed();
|
||||
void NotifySizeMoveDone();
|
||||
|
||||
using ByMoveToRect = nsIWidgetListener::ByMoveToRect;
|
||||
void NotifyWindowMoved(int32_t aX, int32_t aY,
|
||||
ByMoveToRect = ByMoveToRect::No);
|
||||
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
||||
|
||||
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override {}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ nsView* nsIWidgetListener::GetView() { return nullptr; }
|
|||
|
||||
PresShell* nsIWidgetListener::GetPresShell() { return nullptr; }
|
||||
|
||||
bool nsIWidgetListener::WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY,
|
||||
ByMoveToRect) {
|
||||
bool nsIWidgetListener::WindowMoved(nsIWidget* aWidget, int32_t aX,
|
||||
int32_t aY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,9 +65,7 @@ class nsIWidgetListener {
|
|||
* Called when a window is moved to location (x, y). Returns true if the
|
||||
* notification was handled. Coordinates are outer window screen coordinates.
|
||||
*/
|
||||
enum class ByMoveToRect : bool { No, Yes };
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY,
|
||||
ByMoveToRect);
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
|
||||
|
||||
/**
|
||||
* Called when a window is resized to (width, height). Returns true if the
|
||||
|
|
|
|||
|
|
@ -113,8 +113,11 @@ using dom::AutoNoJSAPI;
|
|||
using dom::BrowserHost;
|
||||
using dom::BrowsingContext;
|
||||
using dom::Document;
|
||||
using dom::DocumentL10n;
|
||||
using dom::Element;
|
||||
using dom::EventTarget;
|
||||
using dom::LoadURIOptions;
|
||||
using dom::Promise;
|
||||
|
||||
AppWindow::AppWindow(uint32_t aChromeFlags)
|
||||
: mChromeTreeOwner(nullptr),
|
||||
|
|
@ -3327,8 +3330,7 @@ PresShell* AppWindow::WidgetListenerDelegate::GetPresShell() {
|
|||
}
|
||||
|
||||
bool AppWindow::WidgetListenerDelegate::WindowMoved(nsIWidget* aWidget,
|
||||
int32_t aX, int32_t aY,
|
||||
ByMoveToRect) {
|
||||
int32_t aX, int32_t aY) {
|
||||
RefPtr<AppWindow> holder = mAppWindow;
|
||||
return holder->WindowMoved(aWidget, aX, aY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,7 @@ class AppWindow final : public nsIBaseWindow,
|
|||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
virtual mozilla::PresShell* GetPresShell() override;
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y,
|
||||
ByMoveToRect) override;
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth,
|
||||
int32_t aHeight) override;
|
||||
|
|
|
|||
Loading…
Reference in a new issue