зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1796735 - Remove XULPopupElement.autoPosition. r=dao
This was used to prevent reflows due to popuppositioned events during view transitions. The previous patch should've prevented the popuppositioned events to begin with, plus we no longer use arrows that need positioning etc, which means we shouldn't be triggering the reflows anyways. Since this is the only consumer of autoPosition = true/false, we can remove the code supporting it. It's a bit bogus as per the commit message of the previous patch and, while fixable, it doesn't seem worth fixing if we can just get rid of it. Depends on D159936 Differential Revision: https://phabricator.services.mozilla.com/D159937
This commit is contained in:
Родитель
02e4309f1e
Коммит
ed02e6e84e
|
@ -656,17 +656,6 @@ var PanelMultiView = class extends AssociatedToNode {
|
|||
* subview when a "title" attribute is not specified.
|
||||
*/
|
||||
showSubView(viewIdOrNode, anchor) {
|
||||
// When autoPosition is true, the popup window manager would attempt to re-position
|
||||
// the panel as subviews are opened and it changes size. The resulting popoppositioned
|
||||
// events triggers the binding's arrow position adjustment - and its reflow.
|
||||
// This is not needed here, as we calculated and set maxHeight so it is known
|
||||
// to fit the screen while open.
|
||||
// We do need autoposition for cases where the panel's anchor moves, which can happen
|
||||
// especially with the "page actions" button in the URL bar (see bug 1520607), so
|
||||
// we only set this to false when showing a subview, and set it back to true after we
|
||||
// activate the subview.
|
||||
this._panel.autoPosition = false;
|
||||
|
||||
this._showSubView(viewIdOrNode, anchor).catch(Cu.reportError);
|
||||
}
|
||||
async _showSubView(viewIdOrNode, anchor) {
|
||||
|
@ -894,9 +883,6 @@ var PanelMultiView = class extends AssociatedToNode {
|
|||
panelView.focusWhenActive = false;
|
||||
}
|
||||
panelView.dispatchCustomEvent("ViewShown");
|
||||
|
||||
// Re-enable panel autopositioning.
|
||||
this._panel.autoPosition = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,6 @@ interface XULPopupElement : XULElement
|
|||
{
|
||||
[HTMLConstructor] constructor();
|
||||
|
||||
/**
|
||||
* Allow the popup to automatically position itself.
|
||||
*/
|
||||
attribute boolean autoPosition;
|
||||
|
||||
/**
|
||||
* Open the popup relative to a specified node at a specific location.
|
||||
*
|
||||
|
|
|
@ -188,21 +188,6 @@ void XULPopupElement::SizeTo(int32_t aWidth, int32_t aHeight) {
|
|||
}
|
||||
}
|
||||
|
||||
bool XULPopupElement::AutoPosition() {
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetPrimaryFrame());
|
||||
if (menuPopupFrame) {
|
||||
return menuPopupFrame->GetAutoPosition();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void XULPopupElement::SetAutoPosition(bool aShouldAutoPosition) {
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetPrimaryFrame());
|
||||
if (menuPopupFrame) {
|
||||
menuPopupFrame->SetAutoPosition(aShouldAutoPosition);
|
||||
}
|
||||
}
|
||||
|
||||
void XULPopupElement::GetState(nsString& aState) {
|
||||
// set this here in case there's no frame for the popup
|
||||
aState.AssignLiteral("closed");
|
||||
|
|
|
@ -51,10 +51,6 @@ class XULPopupElement : public nsXULElement {
|
|||
SetXULAttr(nsGkAtoms::position, aValue, rv);
|
||||
}
|
||||
|
||||
bool AutoPosition();
|
||||
|
||||
void SetAutoPosition(bool aShouldAutoPosition);
|
||||
|
||||
void OpenPopup(Element* aAnchorElement,
|
||||
const StringOrOpenPopupOptions& aOptions, int32_t aXPos,
|
||||
int32_t aYPos, bool aIsContextMenu, bool aAttributesOverride,
|
||||
|
|
|
@ -118,7 +118,6 @@ nsMenuPopupFrame::nsMenuPopupFrame(ComputedStyle* aStyle,
|
|||
mFlip(FlipType_Default),
|
||||
mIsOpenChanged(false),
|
||||
mMenuCanOverlapOSBar(false),
|
||||
mShouldAutoPosition(true),
|
||||
mInContentShell(true),
|
||||
mIsMenuLocked(false),
|
||||
mIsOffset(false),
|
||||
|
@ -1023,8 +1022,6 @@ void nsMenuPopupFrame::ShowPopup(bool aIsContextMenu) {
|
|||
if (sound) sound->PlayEventSound(nsISound::EVENT_MENU_POPUP);
|
||||
}
|
||||
}
|
||||
|
||||
mShouldAutoPosition = true;
|
||||
}
|
||||
|
||||
void nsMenuPopupFrame::ClearTriggerContentIncludingDocument() {
|
||||
|
@ -1440,10 +1437,6 @@ static nsIFrame* MaybeDelegatedAnchorFrame(nsIFrame* aFrame) {
|
|||
|
||||
nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
|
||||
bool aIsMove, bool aSizedToPopup) {
|
||||
if (!mShouldAutoPosition) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If this is due to a move, return early if the popup hasn't been laid out
|
||||
// yet. On Windows, this can happen when using a drag popup before it opens.
|
||||
if (aIsMove && (mPrefSize.width == -1 || mPrefSize.height == -1)) {
|
||||
|
@ -2487,16 +2480,6 @@ void nsMenuPopupFrame::MoveToAnchor(nsIContent* aAnchorContent,
|
|||
SetPopupPosition(nullptr, false, false);
|
||||
}
|
||||
|
||||
bool nsMenuPopupFrame::GetAutoPosition() { return mShouldAutoPosition; }
|
||||
|
||||
void nsMenuPopupFrame::SetAutoPosition(bool aShouldAutoPosition) {
|
||||
mShouldAutoPosition = aShouldAutoPosition;
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm) {
|
||||
pm->UpdateFollowAnchor(this);
|
||||
}
|
||||
}
|
||||
|
||||
int8_t nsMenuPopupFrame::GetAlignmentPosition() const {
|
||||
// The code below handles most cases of alignment, anchor and position values.
|
||||
// Those that are not handled just return POPUPPOSITION_UNKNOWN.
|
||||
|
@ -2585,8 +2568,7 @@ void nsMenuPopupFrame::CreatePopupView() {
|
|||
}
|
||||
|
||||
bool nsMenuPopupFrame::ShouldFollowAnchor() {
|
||||
if (!mShouldAutoPosition || mAnchorType != MenuPopupAnchorType_Node ||
|
||||
!mAnchorContent) {
|
||||
if (mAnchorType != MenuPopupAnchorType_Node || !mAnchorContent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -324,9 +324,6 @@ class nsMenuPopupFrame final : public nsBoxFrame,
|
|||
void MoveToAnchor(nsIContent* aAnchorContent, const nsAString& aPosition,
|
||||
int32_t aXPos, int32_t aYPos, bool aAttributesOverride);
|
||||
|
||||
bool GetAutoPosition();
|
||||
void SetAutoPosition(bool aShouldAutoPosition);
|
||||
|
||||
nsIScrollableFrame* GetScrollFrame(nsIFrame* aStart);
|
||||
|
||||
void SetOverrideConstraintRect(mozilla::LayoutDeviceIntRect aRect) {
|
||||
|
@ -396,7 +393,6 @@ class nsMenuPopupFrame final : public nsBoxFrame,
|
|||
|
||||
void ShowWithPositionedEvent() {
|
||||
mPopupState = ePopupPositioning;
|
||||
mShouldAutoPosition = true;
|
||||
}
|
||||
|
||||
// Checks for the anchor to change and either moves or hides the popup
|
||||
|
@ -618,8 +614,6 @@ class nsMenuPopupFrame final : public nsBoxFrame,
|
|||
bool mIsTopLevelContextMenu = false; // true for the topmost context menu.
|
||||
|
||||
bool mMenuCanOverlapOSBar; // can we appear over the taskbar/menubar?
|
||||
bool mShouldAutoPosition; // Should SetPopupPosition be allowed to auto
|
||||
// position popup?
|
||||
bool mInContentShell; // True if the popup is in a content shell
|
||||
bool mIsMenuLocked; // Should events inside this menu be ignored?
|
||||
|
||||
|
|
|
@ -519,7 +519,7 @@ void nsXULPopupManager::AdjustPopupsOnWindowChange(
|
|||
// only move popups that are within the same window and where auto
|
||||
// positioning has not been disabled
|
||||
nsMenuPopupFrame* frame = item->Frame();
|
||||
if (item->IsNoAutoHide() && frame->GetAutoPosition()) {
|
||||
if (item->IsNoAutoHide()) {
|
||||
nsIContent* popup = frame->GetContent();
|
||||
if (popup) {
|
||||
Document* document = popup->GetUncomposedDoc();
|
||||
|
|
Загрузка…
Ссылка в новой задаче