Backed out changeset e7a3ba795e1a (bug 1276976) for timeouts in browser_tableWidget_mouse_interaction.js on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2016-06-09 15:28:22 +02:00
parent 69f29f31e5
commit a34d39f529
11 changed files with 1 additions and 125 deletions

View File

@ -355,53 +355,3 @@ add_task(function* test_event_order() {
});
});
// This test checks select elements with a large number of options to ensure that
// the popup appears within the browser area.
add_task(function* test_large_popup() {
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let doc = content.document;
let select = doc.getElementById("one");
for (var i = 0; i < 180; i++) {
select.add(new content.Option("Test" + i));
}
select.focus();
});
let selectPopup = document.getElementById("ContentSelectDropdown").menupopup;
let browserRect = tab.linkedBrowser.getBoundingClientRect();
let positions = [
"margin-top: 300px;",
"position: fixed; bottom: 100px;",
"width: 100%; height: 9999px;"
];
let position;
while (true) {
yield openSelectPopup(selectPopup, false);
let rect = selectPopup.getBoundingClientRect();
ok(rect.top >= browserRect.top, "Popup top position in within browser area");
ok(rect.bottom <= browserRect.bottom, "Popup bottom position in within browser area");
yield hideSelectPopup(selectPopup, false);
position = positions.shift();
if (!position) {
break;
}
let contentPainted = BrowserTestUtils.contentPainted(tab.linkedBrowser);
yield ContentTask.spawn(tab.linkedBrowser, position, function*(position) {
let select = content.document.getElementById("one");
select.setAttribute("style", position);
});
yield contentPainted;
}
yield BrowserTestUtils.removeTab(tab);
});

View File

@ -187,5 +187,4 @@ interface PopupBoxObject : BoxObject
readonly attribute DOMString alignmentPosition;
readonly attribute long alignmentOffset;
void setConstraintRect(DOMRectReadOnly rect);
};

View File

@ -132,8 +132,6 @@ class SourceSurface;
#define CAPTURE_PREVENTDRAG 4
// true when the mouse is pointer locked, and events are sent to locked element
#define CAPTURE_POINTERLOCK 8
// true when events shouldn't be retargeted to a descendant popup when capturing
#define CAPTURE_PREVENTPOPUPRETARGET 16
typedef struct CapturingContentInfo {
// capture should only be allowed during a mousedown event
@ -141,7 +139,6 @@ typedef struct CapturingContentInfo {
bool mPointerLock;
bool mRetargetToElement;
bool mPreventDrag;
bool mPreventPopupRetarget;
mozilla::StaticRefPtr<nsIContent> mContent;
} CapturingContentInfo;
@ -1330,10 +1327,6 @@ public:
* events are targeted at aContent, but capturing is held more strongly (i.e.,
* calls to SetCapturingContent won't unlock unless CAPTURE_POINTERLOCK is
* set again).
*
* If CAPTURE_PREVENTPOPUPRETARGET is set, mouse events will not be retargeted
* to an overlapping popup. If this is not set, this retargeting can happen,
* as long as the popup is a descendant of aContent.
*/
static void SetCapturingContent(nsIContent* aContent, uint8_t aFlags);
@ -1353,15 +1346,6 @@ public:
gCaptureInfo.mAllowed = aAllowed;
}
/**
* Allow updating of some of the capturing information.
*/
static void UpdateCapturingInfo(uint8_t aFlags, bool aNewValue) {
if (aFlags & CAPTURE_PREVENTPOPUPRETARGET) {
gCaptureInfo.mPreventPopupRetarget = aNewValue;
}
}
/**
* Returns true if there is an active mouse capture that wants to prevent
* drags.

View File

@ -228,7 +228,7 @@ using PaintFrameFlags = nsLayoutUtils::PaintFrameFlags;
CapturingContentInfo nsIPresShell::gCaptureInfo =
{ false /* mAllowed */, false /* mPointerLock */, false /* mRetargetToElement */,
false /* mPreventDrag */, false /* mPreventPopupRetarget */ };
false /* mPreventDrag */ };
nsIContent* nsIPresShell::gKeyDownTarget;
nsClassHashtable<nsUint32HashKey, nsIPresShell::PointerCaptureInfo>* nsIPresShell::gPointerCaptureList;
nsClassHashtable<nsUint32HashKey, nsIPresShell::PointerInfo>* nsIPresShell::gActivePointersIds;
@ -6651,7 +6651,6 @@ nsIPresShell::SetCapturingContent(nsIContent* aContent, uint8_t aFlags)
((aFlags & CAPTURE_POINTERLOCK) != 0);
gCaptureInfo.mPreventDrag = (aFlags & CAPTURE_PREVENTDRAG) != 0;
gCaptureInfo.mPointerLock = (aFlags & CAPTURE_POINTERLOCK) != 0;
gCaptureInfo.mPreventPopupRetarget = (aFlags & CAPTURE_PREVENTPOPUPRETARGET) != 0;
}
}
@ -7739,7 +7738,6 @@ PresShell::HandleEvent(nsIFrame* aFrame,
// If the popupFrame is an ancestor of the 'frame', the frame should
// handle the event, otherwise, the popup should handle it.
if (popupFrame &&
!gCaptureInfo.mPreventPopupRetarget &&
!nsContentUtils::ContentIsCrossDocDescendantOf(
framePresContext->GetPresShell()->GetDocument(),
popupFrame->GetContent())) {

View File

@ -357,16 +357,6 @@ PopupBoxObject::AlignmentOffset()
return popupOffset.x;
}
void
PopupBoxObject::SetConstraintRect(dom::DOMRectReadOnly& aRect)
{
nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetFrame(false));
if (menuPopupFrame) {
menuPopupFrame->SetOverrideConstraintRect(
LayoutDeviceIntRect(aRect.Left(), aRect.Top(), aRect.Width(), aRect.Height()));
}
}
} // namespace dom
} // namespace mozilla

View File

@ -100,8 +100,6 @@ public:
int32_t AlignmentOffset();
void SetConstraintRect(dom::DOMRectReadOnly& aRect);
private:
~PopupBoxObject();

View File

@ -1583,17 +1583,6 @@ nsMenuPopupFrame::GetConstraintRect(const LayoutDeviceIntRect& aAnchorRect,
// for content shells, clip to the client area rather than the screen area
screenRectPixels.IntersectRect(screenRectPixels, aRootScreenRect);
}
else if (!mOverrideConstraintRect.IsEmpty()) {
LayoutDeviceIntRect overrideConstrainRect =
LayoutDeviceIntRect::FromAppUnitsToNearest(mOverrideConstraintRect,
PresContext()->AppUnitsPerDevPixel());
// This is currently only used for <select> elements where we want to constrain
// vertically to the screen but not horizontally, so do the intersection and then
// reset the horizontal values.
screenRectPixels.IntersectRect(screenRectPixels, overrideConstrainRect);
screenRectPixels.x = overrideConstrainRect.x;
screenRectPixels.width = overrideConstrainRect.width;
}
return screenRectPixels;
}

View File

@ -355,10 +355,6 @@ public:
nsIScrollableFrame* GetScrollFrame(nsIFrame* aStart);
void SetOverrideConstraintRect(mozilla::LayoutDeviceIntRect aRect) {
mOverrideConstraintRect = ToAppUnits(aRect, PresContext()->AppUnitsPerCSSPixel());
}
// For a popup that should appear anchored at the given rect, determine
// the screen area that it is constrained by. This will be the available
// area of the screen the popup should be displayed on. Content popups,
@ -592,8 +588,6 @@ protected:
// How the popup is anchored.
MenuPopupAnchorType mAnchorType;
nsRect mOverrideConstraintRect;
static int8_t sDefaultLevelIsTop;
// If 0, never timed out. Otherwise, the value is in milliseconds.

View File

@ -223,15 +223,6 @@
]]>
</body>
</method>
<method name="setConstraintRect">
<parameter name="aRect"/>
<body>
<![CDATA[
this.popupBoxObject.setConstraintRect(aRect);
]]>
</body>
</method>
</implementation>
</binding>

View File

@ -26,12 +26,6 @@ this.SelectParentHelper = {
currentBrowser = browser;
this._registerListeners(browser, menulist.menupopup);
let win = browser.ownerDocument.defaultView;
let constraintRect = browser.getBoundingClientRect();
constraintRect = new win.DOMRect(constraintRect.left + win.mozInnerScreenX,
constraintRect.top + win.mozInnerScreenY,
constraintRect.width, constraintRect.height);
menulist.menupopup.setConstraintRect(constraintRect);
menulist.menupopup.openPopupAtScreenRect("after_start", rect.left, rect.top, rect.width, rect.height, false, false);
menulist.selectedItem.scrollIntoView();
},

View File

@ -261,11 +261,6 @@ nsWebShellWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y)
pm->AdjustPopupsOnWindowChange(window);
}
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell) {
presShell->UpdateCapturingInfo(CAPTURE_PREVENTPOPUPRETARGET, true);
}
// Notify all tabs that the widget moved.
if (mDocShell && mDocShell->GetWindow()) {
nsCOMPtr<EventTarget> eventTarget = mDocShell->GetWindow()->GetTopWindowRoot();
@ -288,12 +283,6 @@ nsWebShellWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHei
if (shellAsWin) {
shellAsWin->SetPositionAndSize(0, 0, aWidth, aHeight, 0);
}
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell) {
presShell->UpdateCapturingInfo(CAPTURE_PREVENTPOPUPRETARGET, true);
}
// Persist size, but not immediately, in case this OS is firing
// repeated size events as the user drags the sizing handle
if (!IsLocked())