зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1644337, add an isAnchored property to popups, as popups can be anchored to a rectangle as well as a node. This prevented the arrow from appearing in panels, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D86099
This commit is contained in:
Родитель
154827069d
Коммит
707aba1b0b
|
@ -142,6 +142,12 @@ interface XULPopupElement : XULElement
|
|||
*/
|
||||
readonly attribute Node? triggerNode;
|
||||
|
||||
/**
|
||||
* True if the popup is anchored to a point or rectangle. False if it
|
||||
* appears at a fixed screen coordinate.
|
||||
*/
|
||||
readonly attribute boolean isAnchored;
|
||||
|
||||
/**
|
||||
* Retrieve the anchor that was specified to openPopup or for menupopups in a
|
||||
* menu, the parent menu.
|
||||
|
|
|
@ -188,6 +188,15 @@ nsINode* XULPopupElement::GetTriggerNode() const {
|
|||
return nsMenuPopupFrame::GetTriggerContent(menuPopupFrame);
|
||||
}
|
||||
|
||||
bool XULPopupElement::IsAnchored() const {
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetPrimaryFrame());
|
||||
if (!menuPopupFrame) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return menuPopupFrame->IsAnchored();
|
||||
}
|
||||
|
||||
// FIXME(emilio): should probably be renamed to GetAnchorElement?
|
||||
Element* XULPopupElement::GetAnchorNode() const {
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetPrimaryFrame());
|
||||
|
|
|
@ -72,6 +72,8 @@ class XULPopupElement : public nsXULElement {
|
|||
|
||||
nsINode* GetTriggerNode() const;
|
||||
|
||||
bool IsAnchored() const;
|
||||
|
||||
Element* GetAnchorNode() const;
|
||||
|
||||
already_AddRefed<DOMRect> GetOuterScreenRect();
|
||||
|
|
|
@ -96,12 +96,7 @@
|
|||
}
|
||||
|
||||
adjustArrowPosition() {
|
||||
if (!this.isArrowPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
var anchor = this.anchorNode;
|
||||
if (!anchor) {
|
||||
if (!this.isArrowPanel || !this.isAnchored) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -159,7 +154,7 @@
|
|||
on_popupshowing(event) {
|
||||
if (this.isArrowPanel && event.target == this) {
|
||||
var arrow = this.shadowRoot.querySelector(".panel-arrow");
|
||||
arrow.hidden = this.anchorNode == null;
|
||||
arrow.hidden = !this.isAnchored;
|
||||
this.shadowRoot
|
||||
.querySelector(".panel-arrowbox")
|
||||
.style.removeProperty("transform");
|
||||
|
|
Загрузка…
Ссылка в новой задаче