mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 798226 - allow the anchor arrow on a panel to move while the popup is open. r=neil
This commit is contained in:
parent
4a11d23738
commit
609f355cf8
@ -551,6 +551,8 @@ nsMenuPopupFrame::InitializePopup(nsIContent* aAnchorContent,
|
||||
mXPos = aXPos;
|
||||
mYPos = aYPos;
|
||||
mAdjustOffsetForContextMenu = false;
|
||||
mVFlip = false;
|
||||
mHFlip = false;
|
||||
|
||||
// if aAttributesOverride is true, then the popupanchor, popupalign and
|
||||
// position attributes on the <popup> override those values passed in.
|
||||
@ -1190,12 +1192,19 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove)
|
||||
}
|
||||
|
||||
// mXPos and mYPos specify an additonal offset passed to OpenPopup that
|
||||
// should be added to the position
|
||||
if (IsDirectionRTL())
|
||||
screenPoint.x -= presContext->CSSPixelsToAppUnits(mXPos);
|
||||
else
|
||||
screenPoint.x += presContext->CSSPixelsToAppUnits(mXPos);
|
||||
screenPoint.y += presContext->CSSPixelsToAppUnits(mYPos);
|
||||
// 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 = presContext->CSSPixelsToAppUnits(mXPos);
|
||||
if (IsDirectionRTL()) {
|
||||
screenPoint.x -= anchorXOffset;
|
||||
anchorRect.x -= anchorXOffset;
|
||||
} else {
|
||||
screenPoint.x += anchorXOffset;
|
||||
anchorRect.x += anchorXOffset;
|
||||
}
|
||||
nscoord anchorYOffset = presContext->CSSPixelsToAppUnits(mYPos);
|
||||
screenPoint.y += anchorYOffset;
|
||||
anchorRect.y += anchorYOffset;
|
||||
|
||||
// If this is a noautohide popup, set the screen coordinates of the popup.
|
||||
// This way, the popup stays at the location where it was opened even when
|
||||
|
@ -137,8 +137,7 @@ var tests = [
|
||||
openPopup("after_end", function() {
|
||||
isArrowPositionedOn("right");
|
||||
panel.sizeTo(anchor.getBoundingClientRect().left + 50, 50);
|
||||
todo(false, "Bug 798226 - panel doesn't handle resize/moves correctly while open")
|
||||
// isArrowPositionedOn("left"); // check it flipped and has zero offset.
|
||||
isArrowPositionedOn("left"); // check it flipped and has zero offset.
|
||||
next();
|
||||
});
|
||||
}],
|
||||
@ -147,8 +146,7 @@ var tests = [
|
||||
openPopup("start_after", function() {
|
||||
isArrowPositionedOn("bottom");
|
||||
panel.sizeTo(50, anchor.getBoundingClientRect().top + 50);
|
||||
todo(false, "Bug 798226 - panel doesn't handle resize/moves correctly while open")
|
||||
//isArrowPositionedOn("top"); // check it flipped and has zero offset.
|
||||
isArrowPositionedOn("top"); // check it flipped and has zero offset.
|
||||
next();
|
||||
});
|
||||
}],
|
||||
@ -193,8 +191,7 @@ var tests = [
|
||||
// on the right, so it must flip (arrow on the left, panel on the right)
|
||||
var offset = Math.floor(-anchorRight / 2);
|
||||
panel.moveToAnchor(anchor, "after_end", offset, 0);
|
||||
todo(false, "Bug 798226 - panel doesn't handle resize/moves correctly while open")
|
||||
//isArrowPositionedOn("left", offset); // should have flipped and have the offset.
|
||||
isArrowPositionedOn("left", offset); // should have flipped and have the offset.
|
||||
// resize back to original and move to a zero offset - it should flip back.
|
||||
panel.sizeTo(anchorRight - 10, 100);
|
||||
panel.moveToAnchor(anchor, "after_end", 0, 0);
|
||||
@ -213,8 +210,7 @@ var tests = [
|
||||
isArrowPositionedOn("bottom");
|
||||
var offset = Math.floor(-anchorBottom / 2);
|
||||
panel.moveToAnchor(anchor, "start_after", 0, offset);
|
||||
todo(false, "Bug 798226 - panel doesn't handle resize/moves correctly while open")
|
||||
//isArrowPositionedOn("top", offset);
|
||||
isArrowPositionedOn("top", offset);
|
||||
panel.sizeTo(100, anchorBottom - 10);
|
||||
panel.moveToAnchor(anchor, "start_after", 0, 0);
|
||||
isArrowPositionedOn("bottom");
|
||||
|
@ -340,10 +340,45 @@
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="_fadeTimer">null</field>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="popupshowing" phase="target">
|
||||
<![CDATA[
|
||||
<method name="sizeTo">
|
||||
<parameter name="aWidth"/>
|
||||
<parameter name="aHeight"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.sizeTo(aWidth, aHeight);
|
||||
if (this.state == "open")
|
||||
this.adjustArrowPosition();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="moveTo">
|
||||
<parameter name="aLeft"/>
|
||||
<parameter name="aTop"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.moveTo(aLeft, aTop);
|
||||
if (this.state == "open")
|
||||
this.adjustArrowPosition();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="moveToAnchor">
|
||||
<parameter name="aAnchorElement"/>
|
||||
<parameter name="aPosition"/>
|
||||
<parameter name="aX"/>
|
||||
<parameter name="aY"/>
|
||||
<parameter name="aAttributesOverride"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.popupBoxObject.moveToAnchor(aAnchorElement, aPosition, aX, aY, aAttributesOverride);
|
||||
if (this.state == "open")
|
||||
this.adjustArrowPosition();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="adjustArrowPosition">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var arrow = document.getAnonymousElementByAttribute(this, "anonid", "arrow");
|
||||
|
||||
var anchor = this.anchorNode;
|
||||
@ -389,7 +424,14 @@
|
||||
}
|
||||
|
||||
arrow.hidden = false;
|
||||
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="popupshowing" phase="target">
|
||||
<![CDATA[
|
||||
this.adjustArrowPosition();
|
||||
// set fading
|
||||
var fade = this.getAttribute("fade");
|
||||
var fadeDelay = (fade == "fast") ? 1 : fade == "slow" ? 4000 : 0;
|
||||
@ -642,4 +684,3 @@
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user