Added fix for mozbz#1708709

This commit is contained in:
Martin Stransky 2021-09-07 10:47:32 +02:00
parent 79e725aec1
commit 02021e6135
2 changed files with 243 additions and 0 deletions

View File

@ -238,6 +238,7 @@ Patch408: mozilla-1663844.patch
Patch415: mozilla-1670333.patch
Patch420: mochitest-wayland-workaround.patch
Patch422: mozilla-1728749.patch
Patch423: mozilla-1708709.patch
# PGO/LTO patches
Patch600: pgo.patch
@ -476,6 +477,7 @@ This package contains results of tests executed during build.
%patch415 -p1 -b .1670333
%patch420 -p1 -b .mochitest-wayland-workaround
%patch422 -p1 -b .1728749
%patch423 -p1 -b .1708709
# PGO patches
%if %{build_with_pgo}
@ -1049,6 +1051,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
* Fri Sep 3 2021 Martin Stransky <stransky@redhat.com> - 92.0
- Updated to 92.0
- Added fix for mozbz#1728749
- Added fix for mozbz#1708709
* Thu Aug 26 2021 Martin Stransky <stransky@redhat.com> - 91.0.2-1
- Updated to 91.0.2

240
mozilla-1708709.patch Normal file
View File

@ -0,0 +1,240 @@
diff -up firefox-92.0/dom/xul/XULPopupElement.cpp.1708709 firefox-92.0/dom/xul/XULPopupElement.cpp
--- firefox-92.0/dom/xul/XULPopupElement.cpp.1708709 2021-09-01 19:14:41.000000000 +0200
+++ firefox-92.0/dom/xul/XULPopupElement.cpp 2021-09-07 10:33:55.686223973 +0200
@@ -271,8 +271,7 @@ already_AddRefed<DOMRect> XULPopupElemen
// For native menus we can't query the true size. Use the anchor rect
// instead, which at least has the position at which we were intending to
// open the menu.
- screenRect = Some(CSSRect(
- CSSIntRect::FromUnknownRect(menuPopupFrame->GetScreenAnchorRect())));
+ screenRect = Some(CSSRect(menuPopupFrame->GetScreenAnchorRect()));
} else {
// For non-native menus, query the bounds from the widget.
if (nsView* view = menuPopupFrame->GetView()) {
diff -up firefox-92.0/layout/xul/nsMenuPopupFrame.cpp.1708709 firefox-92.0/layout/xul/nsMenuPopupFrame.cpp
--- firefox-92.0/layout/xul/nsMenuPopupFrame.cpp.1708709 2021-09-01 19:15:06.000000000 +0200
+++ firefox-92.0/layout/xul/nsMenuPopupFrame.cpp 2021-09-07 10:33:55.686223973 +0200
@@ -868,8 +868,9 @@ void nsMenuPopupFrame::InitializePopup(n
InitPositionFromAnchorAlign(anchor, align);
}
}
-
- mScreenRect = nsIntRect(-1, -1, 0, 0);
+ // When converted back to CSSIntRect it is (-1, -1, 0, 0) - as expected in
+ // nsXULPopupManager::Rollup
+ mScreenRect = nsRect(-AppUnitsPerCSSPixel(), -AppUnitsPerCSSPixel(), 0, 0);
if (aAttributesOverride) {
// Use |left| and |top| dimension attributes to position the popup if
@@ -881,11 +882,15 @@ void nsMenuPopupFrame::InitializePopup(n
nsresult err;
if (!left.IsEmpty()) {
int32_t x = left.ToInteger(&err);
- if (NS_SUCCEEDED(err)) mScreenRect.x = x;
+ if (NS_SUCCEEDED(err)) {
+ mScreenRect.x = CSSPixel::ToAppUnits(x);
+ }
}
if (!top.IsEmpty()) {
int32_t y = top.ToInteger(&err);
- if (NS_SUCCEEDED(err)) mScreenRect.y = y;
+ if (NS_SUCCEEDED(err)) {
+ mScreenRect.y = CSSPixel::ToAppUnits(y);
+ }
}
}
}
@@ -900,7 +905,8 @@ void nsMenuPopupFrame::InitializePopupAt
mPopupState = ePopupShowing;
mAnchorContent = nullptr;
mTriggerContent = aTriggerContent;
- mScreenRect = nsIntRect(aXPos, aYPos, 0, 0);
+ mScreenRect =
+ nsRect(CSSPixel::ToAppUnits(aXPos), CSSPixel::ToAppUnits(aYPos), 0, 0);
mXPos = 0;
mYPos = 0;
mFlip = FlipType_Default;
@@ -920,7 +926,8 @@ void nsMenuPopupFrame::InitializePopupAs
mTriggerContent = aTriggerContent;
mPopupState = ePopupShowing;
mAnchorContent = nullptr;
- mScreenRect = nsIntRect(aXPos, aYPos, 0, 0);
+ mScreenRect =
+ nsRect(CSSPixel::ToAppUnits(aXPos), CSSPixel::ToAppUnits(aYPos), 0, 0);
mXPos = 0;
mYPos = 0;
mFlip = FlipType_Default;
@@ -941,7 +948,7 @@ void nsMenuPopupFrame::InitializePopupAt
bool aAttributesOverride) {
InitializePopup(nullptr, aTriggerContent, aPosition, 0, 0,
MenuPopupAnchorType_Rect, aAttributesOverride);
- mScreenRect = aRect;
+ mScreenRect = ToAppUnits(aRect, AppUnitsPerCSSPixel());
}
void nsMenuPopupFrame::ShowPopup(bool aIsContextMenu) {
@@ -1430,7 +1437,7 @@ nsresult nsMenuPopupFrame::SetPopupPosit
// If anchored to a rectangle, use that rectangle. Otherwise, determine the
// rectangle from the anchor.
if (mAnchorType == MenuPopupAnchorType_Rect) {
- anchorRect = ToAppUnits(mScreenRect, AppUnitsPerCSSPixel());
+ anchorRect = mScreenRect;
} else {
// if the frame is not specified, use the anchor node passed to OpenPopup.
// If that wasn't specified either, use the root frame. Note that
@@ -1517,7 +1524,7 @@ nsresult nsMenuPopupFrame::SetPopupPosit
// mXPos and mYPos specify an additonal offset passed to OpenPopup that
// should be added to the position. We also add the offset to the anchor
// pos so a later flip/resize takes the offset into account.
- nscoord anchorXOffset = nsPresContext::CSSPixelsToAppUnits(mXPos);
+ nscoord anchorXOffset = CSSPixel::ToAppUnits(mXPos);
if (IsDirectionRTL()) {
screenPoint.x -= anchorXOffset;
anchorRect.x -= anchorXOffset;
@@ -1525,7 +1532,7 @@ nsresult nsMenuPopupFrame::SetPopupPosit
screenPoint.x += anchorXOffset;
anchorRect.x += anchorXOffset;
}
- nscoord anchorYOffset = nsPresContext::CSSPixelsToAppUnits(mYPos);
+ nscoord anchorYOffset = CSSPixel::ToAppUnits(mYPos);
screenPoint.y += anchorYOffset;
anchorRect.y += anchorYOffset;
@@ -1539,10 +1546,8 @@ nsresult nsMenuPopupFrame::SetPopupPosit
// Account for the margin that will end up being added to the screen
// coordinate the next time SetPopupPosition is called.
mAnchorType = MenuPopupAnchorType_Point;
- mScreenRect.x =
- nsPresContext::AppUnitsToIntCSSPixels(screenPoint.x - margin.left);
- mScreenRect.y =
- nsPresContext::AppUnitsToIntCSSPixels(screenPoint.y - margin.top);
+ mScreenRect.x = screenPoint.x - margin.left;
+ mScreenRect.y = screenPoint.y - margin.top;
}
} else {
// The popup is positioned at a screen coordinate.
@@ -1557,11 +1562,11 @@ nsresult nsMenuPopupFrame::SetPopupPosit
if (mAdjustOffsetForContextMenu) {
nsPoint offsetForContextMenuDev;
offsetForContextMenuDev.x =
- nsPresContext::CSSPixelsToAppUnits(LookAndFeel::GetInt(
+ CSSPixel::ToAppUnits(LookAndFeel::GetInt(
LookAndFeel::IntID::ContextMenuOffsetHorizontal)) /
factor;
offsetForContextMenuDev.y =
- nsPresContext::CSSPixelsToAppUnits(LookAndFeel::GetInt(
+ CSSPixel::ToAppUnits(LookAndFeel::GetInt(
LookAndFeel::IntID::ContextMenuOffsetVertical)) /
factor;
offsetForContextMenu.x =
@@ -1571,10 +1576,8 @@ nsresult nsMenuPopupFrame::SetPopupPosit
}
// next, convert into app units accounting for the zoom
- screenPoint.x = presContext->DevPixelsToAppUnits(
- nsPresContext::CSSPixelsToAppUnits(mScreenRect.x) / factor);
- screenPoint.y = presContext->DevPixelsToAppUnits(
- nsPresContext::CSSPixelsToAppUnits(mScreenRect.y) / factor);
+ screenPoint.x = presContext->DevPixelsToAppUnits(mScreenRect.x / factor);
+ screenPoint.y = presContext->DevPixelsToAppUnits(mScreenRect.y / factor);
anchorRect = nsRect(screenPoint, nsSize(0, 0));
// add the margins on the popup
@@ -2377,9 +2380,10 @@ void nsMenuPopupFrame::DestroyFrom(nsIFr
nsBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
}
-void nsMenuPopupFrame::MoveTo(const CSSIntPoint& aPos, bool aUpdateAttrs) {
+void nsMenuPopupFrame::MoveTo(const CSSPoint& aPos, bool aUpdateAttrs) {
nsIWidget* widget = GetWidget();
- if ((mScreenRect.x == aPos.x && mScreenRect.y == aPos.y) &&
+ nsPoint appUnitsPos = CSSPixel::ToAppUnits(aPos);
+ if ((mScreenRect.x == appUnitsPos.x && mScreenRect.y == appUnitsPos.y) &&
(!widget || widget->GetClientOffset() == mLastClientOffset)) {
return;
}
@@ -2393,15 +2397,15 @@ void nsMenuPopupFrame::MoveTo(const CSSI
// Workaround for bug 788189. See also bug 708278 comment #25 and following.
if (mAdjustOffsetForContextMenu) {
- margin.left += nsPresContext::CSSPixelsToAppUnits(
+ margin.left += CSSPixel::ToAppUnits(
LookAndFeel::GetInt(LookAndFeel::IntID::ContextMenuOffsetHorizontal));
- margin.top += nsPresContext::CSSPixelsToAppUnits(
+ margin.top += CSSPixel::ToAppUnits(
LookAndFeel::GetInt(LookAndFeel::IntID::ContextMenuOffsetVertical));
}
mAnchorType = MenuPopupAnchorType_Point;
- mScreenRect.x = aPos.x - nsPresContext::AppUnitsToIntCSSPixels(margin.left);
- mScreenRect.y = aPos.y - nsPresContext::AppUnitsToIntCSSPixels(margin.top);
+ mScreenRect.x = appUnitsPos.x - margin.left;
+ mScreenRect.y = appUnitsPos.y - margin.top;
SetPopupPosition(nullptr, true, false);
@@ -2409,8 +2413,8 @@ void nsMenuPopupFrame::MoveTo(const CSSI
if (aUpdateAttrs && (popup->HasAttr(kNameSpaceID_None, nsGkAtoms::left) ||
popup->HasAttr(kNameSpaceID_None, nsGkAtoms::top))) {
nsAutoString left, top;
- left.AppendInt(aPos.x);
- top.AppendInt(aPos.y);
+ left.AppendInt(RoundedToInt(aPos).x);
+ top.AppendInt(RoundedToInt(aPos).y);
popup->SetAttr(kNameSpaceID_None, nsGkAtoms::left, left, false);
popup->SetAttr(kNameSpaceID_None, nsGkAtoms::top, top, false);
}
diff -up firefox-92.0/layout/xul/nsMenuPopupFrame.h.1708709 firefox-92.0/layout/xul/nsMenuPopupFrame.h
--- firefox-92.0/layout/xul/nsMenuPopupFrame.h.1708709 2021-09-01 19:15:06.000000000 +0200
+++ firefox-92.0/layout/xul/nsMenuPopupFrame.h 2021-09-07 10:46:10.360036429 +0200
@@ -321,7 +321,7 @@ class nsMenuPopupFrame final : public ns
// 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::CSSIntPoint& aPos, bool aUpdateAttrs);
+ void MoveTo(const mozilla::CSSPoint& aPos, bool aUpdateAttrs);
void MoveToAnchor(nsIContent* aAnchorContent, const nsAString& aPosition,
int32_t aXPos, int32_t aYPos, bool aAttributesOverride);
@@ -370,7 +370,9 @@ class nsMenuPopupFrame final : public ns
// Return the screen coordinates in CSS pixels of the popup,
// or (-1, -1, 0, 0) if anchored.
- nsIntRect GetScreenAnchorRect() const { return mScreenRect; }
+ mozilla::CSSIntRect GetScreenAnchorRect() const {
+ return mozilla::CSSRect::FromAppUnitsRounded(mScreenRect);
+ }
mozilla::LayoutDeviceIntPoint GetLastClientOffset() const {
return mLastClientOffset;
@@ -557,7 +559,7 @@ class nsMenuPopupFrame final : public ns
// override mXPos and mYPos.
int32_t mXPos;
int32_t mYPos;
- nsIntRect mScreenRect;
+ nsRect mScreenRect;
// Used for store rectangle which the popup is going to be anchored to,
// we need that for Wayland
#ifdef MOZ_WAYLAND
diff -up firefox-92.0/layout/xul/nsXULPopupManager.cpp.1708709 firefox-92.0/layout/xul/nsXULPopupManager.cpp
--- firefox-92.0/layout/xul/nsXULPopupManager.cpp.1708709 2021-09-01 19:15:01.000000000 +0200
+++ firefox-92.0/layout/xul/nsXULPopupManager.cpp 2021-09-07 10:33:55.686223973 +0200
@@ -343,8 +343,7 @@ bool nsXULPopupManager::Rollup(uint32_t
if (popupFrame->IsAnchored()) {
// Check if the popup has a screen anchor rectangle. If not, get the
// rectangle from the anchor element.
- anchorRect =
- CSSIntRect::FromUnknownRect(popupFrame->GetScreenAnchorRect());
+ anchorRect = popupFrame->GetScreenAnchorRect();
if (anchorRect.x == -1 || anchorRect.y == -1) {
nsCOMPtr<nsIContent> anchor = popupFrame->GetAnchor();
@@ -581,7 +580,7 @@ void nsXULPopupManager::PopupMoved(nsIFr
} else {
CSSPoint cssPos = LayoutDeviceIntPoint::FromUnknownPoint(aPnt) /
menuPopupFrame->PresContext()->CSSToDevPixelScale();
- menuPopupFrame->MoveTo(RoundedToInt(cssPos), false);
+ menuPopupFrame->MoveTo(cssPos, false);
}
}