mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 619223 - Arrow panel should use the direction of the anchor. r=enndeakin f=smontagu a=blocking-final
This commit is contained in:
parent
228134d642
commit
4c878405c1
@ -7506,10 +7506,6 @@ var gIdentityHandler = {
|
||||
// Update the popup strings
|
||||
this.setPopupMessages(this._identityBox.className);
|
||||
|
||||
// Make sure the identity popup hangs toward the middle of the location bar
|
||||
// in RTL builds
|
||||
var position = (getComputedStyle(gNavToolbox, "").direction == "rtl") ? 'bottomcenter topright' : 'bottomcenter topleft';
|
||||
|
||||
// Add the "open" attribute to the identity box for styling
|
||||
this._identityBox.setAttribute("open", "true");
|
||||
var self = this;
|
||||
@ -7519,7 +7515,7 @@ var gIdentityHandler = {
|
||||
}, false);
|
||||
|
||||
// Now open the popup, anchored off the primary chrome element
|
||||
this._identityPopup.openPopup(this._identityBox, position);
|
||||
this._identityPopup.openPopup(this._identityBox, "bottomcenter topleft");
|
||||
},
|
||||
|
||||
onDragStart: function (event) {
|
||||
|
@ -900,7 +900,7 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(nsRect& anchorRect,
|
||||
// flip the anchor and alignment for right-to-left
|
||||
PRInt8 popupAnchor(mPopupAnchor);
|
||||
PRInt8 popupAlign(mPopupAlignment);
|
||||
if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (IsDirectionRTL()) {
|
||||
// no need to flip the centered anchor types
|
||||
if (popupAnchor < POPUPALIGNMENT_LEFTCENTER) {
|
||||
popupAnchor = -popupAnchor;
|
||||
@ -1183,7 +1183,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove)
|
||||
|
||||
// mXPos and mYPos specify an additonal offset passed to OpenPopup that
|
||||
// should be added to the position
|
||||
if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
|
||||
if (IsDirectionRTL())
|
||||
screenPoint.x -= presContext->CSSPixelsToAppUnits(mXPos);
|
||||
else
|
||||
screenPoint.x += presContext->CSSPixelsToAppUnits(mXPos);
|
||||
@ -1364,7 +1364,7 @@ nsMenuPopupFrame::GetConstraintRect(const nsRect& aAnchorRect,
|
||||
void nsMenuPopupFrame::CanAdjustEdges(PRInt8 aHorizontalSide, PRInt8 aVerticalSide, nsIntPoint& aChange)
|
||||
{
|
||||
PRInt8 popupAlign(mPopupAlignment);
|
||||
if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (IsDirectionRTL()) {
|
||||
popupAlign = -popupAlign;
|
||||
}
|
||||
|
||||
|
@ -387,6 +387,19 @@ protected:
|
||||
// Move the popup to the position specified in its |left| and |top| attributes.
|
||||
void MoveToAttributePosition();
|
||||
|
||||
/**
|
||||
* Return whether the popup direction should be RTL.
|
||||
* If the popup has an anchor, its direction is the anchor direction.
|
||||
* Otherwise, its the general direction of the UI.
|
||||
*
|
||||
* Return whether the popup direction should be RTL.
|
||||
*/
|
||||
bool IsDirectionRTL() const {
|
||||
return mAnchorContent && mAnchorContent->GetPrimaryFrame()
|
||||
? mAnchorContent->GetPrimaryFrame()->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL
|
||||
: GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
}
|
||||
|
||||
nsString mIncrementalString; // for incremental typing navigation
|
||||
|
||||
// the content that the popup is anchored to, if any, which may be in a
|
||||
|
@ -16,9 +16,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=477754
|
||||
</body>
|
||||
|
||||
<hbox pack="center">
|
||||
<label id="anchor" value="Anchor"/>
|
||||
<label id="anchor" style="direction: rtl;" value="Anchor"/>
|
||||
</hbox>
|
||||
<panel id="testPopup" style="direction: rtl;" onpopupshown="doTest();">
|
||||
<panel id="testPopup" onpopupshown="doTest();">
|
||||
<label value="I am a popup"/>
|
||||
</panel>
|
||||
|
||||
|
@ -411,10 +411,6 @@ PopupNotifications.prototype = {
|
||||
if (this.isPanelOpen && this._currentAnchorElement == anchorElement)
|
||||
return;
|
||||
|
||||
// Make sure the identity popup hangs in the correct direction.
|
||||
var position = (this.window.getComputedStyle(this.panel, "").direction == "rtl") ?
|
||||
"bottomcenter topright" : "bottomcenter topleft";
|
||||
|
||||
// If the panel is already open but we're changing anchors, we need to hide
|
||||
// it first. Otherwise it can appear in the wrong spot. (_hidePanel is
|
||||
// safe to call even if the panel is already hidden.)
|
||||
@ -422,7 +418,7 @@ PopupNotifications.prototype = {
|
||||
|
||||
this._currentAnchorElement = anchorElement;
|
||||
|
||||
this.panel.openPopup(anchorElement, position);
|
||||
this.panel.openPopup(anchorElement, "bottomcenter topleft");
|
||||
notificationsToShow.forEach(function (n) {
|
||||
this._fireCallback(n, "shown");
|
||||
}, this);
|
||||
|
Loading…
Reference in New Issue
Block a user