From 45c92c73579e610a8d0fc402cadec63ef6bf4110 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 22 Jan 2014 14:23:57 -0800 Subject: [PATCH] Backed out 2 changesets (bug 956162) for m-oth failures on a CLOSED TREE Backed out changeset 026dc3ee0654 (bug 956162) Backed out changeset 0a7e5eeafed6 (bug 956162) --- browser/base/content/browser.xul | 1 - layout/xul/nsMenuPopupFrame.cpp | 25 +++++------ layout/xul/nsMenuPopupFrame.h | 11 +---- toolkit/content/tests/chrome/window_panel.xul | 45 +------------------ 4 files changed, 14 insertions(+), 68 deletions(-) diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 24712a010ea3..58048ee479f7 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -217,7 +217,6 @@ hidden="true" noautofocus="true" noautohide="true" - flip="none" consumeoutsideclicks="false"> diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 119ebaf54d65..2da86aced749 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -87,7 +87,7 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex mPopupAnchor(POPUPALIGNMENT_NONE), mPosition(POPUPPOSITION_UNKNOWN), mConsumeRollupEvent(nsIPopupBoxObject::ROLLUP_DEFAULT), - mFlip(FlipType_Default), + mFlipBoth(false), mIsOpenChanged(false), mIsContextMenu(false), mAdjustOffsetForContextMenu(false), @@ -581,13 +581,8 @@ nsMenuPopupFrame::InitializePopup(nsIContent* aAnchorContent, position.Assign(aPosition); } - if (flip.EqualsLiteral("none")) { - mFlip = FlipType_None; - } else if (flip.EqualsLiteral("both")) { - mFlip = FlipType_Both; - } else if (flip.EqualsLiteral("slide")) { - mFlip = FlipType_Slide; - } + mFlipBoth = flip.EqualsLiteral("both"); + mSlide = flip.EqualsLiteral("slide"); position.CompressWhitespace(); int32_t spaceIdx = position.FindChar(' '); @@ -690,7 +685,8 @@ nsMenuPopupFrame::InitializePopupAtScreen(nsIContent* aTriggerContent, mTriggerContent = aTriggerContent; mScreenXPos = aXPos; mScreenYPos = aYPos; - mFlip = FlipType_Default; + mFlipBoth = false; + mSlide = false; mPopupAnchor = POPUPALIGNMENT_NONE; mPopupAlignment = POPUPALIGNMENT_NONE; mIsContextMenu = aIsContextMenu; @@ -707,7 +703,8 @@ nsMenuPopupFrame::InitializePopupWithAnchorAlign(nsIContent* aAnchorContent, mPopupState = ePopupShowing; mAdjustOffsetForContextMenu = false; - mFlip = FlipType_Default; + mFlipBoth = false; + mSlide = false; // this popup opening function is provided for backwards compatibility // only. It accepts either coordinates or an anchor and alignment value @@ -984,7 +981,7 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(nsRect& anchorRect, break; default: { - FlipStyle anchorEdge = mFlip == FlipType_Both ? FlipStyle_Inside : FlipStyle_None; + FlipStyle anchorEdge = mFlipBoth ? FlipStyle_Inside : FlipStyle_None; aHFlip = (popupAnchor == -popupAlign) ? FlipStyle_Outside : anchorEdge; if (((popupAnchor > 0) == (popupAlign > 0)) || (popupAnchor == POPUPALIGNMENT_TOPLEFT && popupAlign == POPUPALIGNMENT_TOPLEFT)) @@ -1274,9 +1271,9 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove) vFlip = FlipStyle_Outside; } - // If a panel is being moved or has flip="none", don't constrain or flip it. But always do this for + // If a panel is being moved, don't constrain or flip it. But always do this for // content shells, so that the popup doesn't extend outside the containing frame. - if (mInContentShell || (mFlip != FlipType_None && (!aIsMove || mPopupType != ePopupTypePanel))) { + if (mInContentShell || !aIsMove || mPopupType != ePopupTypePanel) { nsRect screenRect = GetConstraintRect(anchorRect, rootScreenRect); // ensure that anchorRect is on screen @@ -1306,7 +1303,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove) // but we can only slide on one axis - the other axis must be "flipped or // resized" as normal. bool slideHorizontal = false, slideVertical = false; - if (mFlip == FlipType_Slide) { + if (mSlide) { int8_t position = GetAlignmentPosition(); slideHorizontal = position >= POPUPPOSITION_BEFORESTART && position <= POPUPPOSITION_AFTEREND; diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index 5cf680698347..e205f47dee49 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -65,14 +65,6 @@ enum FlipStyle { FlipStyle_Inside = 2 }; -// Values for the flip attribute -enum FlipType { - FlipType_Default = 0, - FlipType_None = 1, // don't try to flip or translate to stay onscreen - FlipType_Both = 2, // flip in both directions - FlipType_Slide = 3 // allow the arrow to "slide" instead of resizing -}; - // values are selected so that the direction can be flipped just by // changing the sign #define POPUPALIGNMENT_NONE 0 @@ -467,7 +459,8 @@ protected: // One of nsIPopupBoxObject::ROLLUP_DEFAULT/ROLLUP_CONSUME/ROLLUP_NO_CONSUME int8_t mConsumeRollupEvent; - FlipType mFlip; // Whether to flip + bool mFlipBoth; // flip in both directions + bool mSlide; // allow the arrow to "slide" instead of resizing bool mIsOpenChanged; // true if the open state changed since the last layout bool mIsContextMenu; // true for context menus diff --git a/toolkit/content/tests/chrome/window_panel.xul b/toolkit/content/tests/chrome/window_panel.xul index fd6bfbebf963..1bfd525fa39a 100644 --- a/toolkit/content/tests/chrome/window_panel.xul +++ b/toolkit/content/tests/chrome/window_panel.xul @@ -254,50 +254,7 @@ var tests = [ is(panel.getOuterScreenRect().top, 245, testname + "top"); } } - }, - { - // The panel should be allowed to appear and remain offscreen - testname: "normal panel with flip='none' off-screen", - attrs: { "flip": "none" }, - test: function(panel) { - panel.openPopup(document.documentElement, "", -100 - mozInnerScreenX, -100 - mozInnerScreenY, false, false, null); - }, - result: function(testname, panel) { - var panelrect = panel.getBoundingClientRect(); - is(panelrect.left, -100 - mozInnerScreenX, testname + "left"); - is(panelrect.top, -100 - mozInnerScreenY, testname + "top"); - is(panelrect.width, 120, testname + "width"); - is(panelrect.height, 40, testname + "height"); - - var screenRect = panel.getOuterScreenRect(); - is(screenRect.left, -100, testname + " screen left"); - is(screenRect.top, -100, testname + " screen top"); - is(screenRect.width, 120, testname + " screen width"); - is(screenRect.height, 40, testname + " screen height"); - } - }, - { - // The panel should be allowed to remain offscreen after moving and it should follow the anchor - testname: "normal panel with flip='none' moved off-screen", - attrs: { "flip": "none" }, - test: function(panel) { - panel.openPopup(document.documentElement, "", -100 - mozInnerScreenX, -100 - mozInnerScreenY, false, false, null); - window.moveBy(-50, -50); - }, - result: function(testname, panel) { - var panelrect = panel.getBoundingClientRect(); - is(panelrect.left, -150 - mozInnerScreenX, testname + "left"); - is(panelrect.top, -150 - mozInnerScreenY, testname + "top"); - is(panelrect.width, 120, testname + "width"); - is(panelrect.height, 40, testname + "height"); - - var screenRect = panel.getOuterScreenRect(); - is(screenRect.left, -150, testname + " screen left"); - is(screenRect.top, -150, testname + " screen top"); - is(screenRect.width, 120, testname + " screen width"); - is(screenRect.height, 40, testname + " screen height"); - } - }, + } ]; window.opener.wrappedJSObject.SimpleTest.waitForFocus(test_panels, window);