зеркало из https://github.com/mozilla/gecko-dev.git
Merge. a=blockers
This commit is contained in:
Коммит
0d75348ba7
|
@ -43,7 +43,7 @@ interface nsIDOMElement;
|
|||
interface nsIDOMNode;
|
||||
interface nsIDOMEvent;
|
||||
|
||||
[scriptable, uuid(e4c3845b-97d2-4fdf-860e-949746d15fb9)]
|
||||
[scriptable, uuid(548a9e3f-af78-42b0-a260-035ece15c19f)]
|
||||
interface nsIPopupBoxObject : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -177,6 +177,12 @@ interface nsIPopupBoxObject : nsISupports
|
|||
* null.
|
||||
*/
|
||||
readonly attribute nsIDOMNode triggerNode;
|
||||
|
||||
/**
|
||||
* Retrieve the anchor that was specified to openPopup or for menupopups in a
|
||||
* menu, the parent menu.
|
||||
*/
|
||||
readonly attribute nsIDOMElement anchorNode;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -325,6 +325,9 @@ public:
|
|||
// Return true if the popup is positioned relative to an anchor.
|
||||
PRBool IsAnchored() const { return mScreenXPos == -1 && mScreenYPos == -1; }
|
||||
|
||||
// Return the anchor if there is one.
|
||||
nsIContent* GetAnchor() const { return mAnchorContent; }
|
||||
|
||||
// Return the screen coordinates of the popup, or (-1, -1) if anchored.
|
||||
nsIntPoint ScreenPosition() const { return nsIntPoint(mScreenXPos, mScreenYPos); }
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
|
||||
|
||||
class nsPopupBoxObject : public nsBoxObject,
|
||||
public nsIPopupBoxObject
|
||||
{
|
||||
|
@ -275,6 +274,22 @@ nsPopupBoxObject::GetTriggerNode(nsIDOMNode** aTriggerNode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPopupBoxObject::GetAnchorNode(nsIDOMElement** aAnchor)
|
||||
{
|
||||
*aAnchor = nsnull;
|
||||
|
||||
nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame();
|
||||
if (!menuPopupFrame)
|
||||
return NS_OK;
|
||||
|
||||
nsIContent* anchor = menuPopupFrame->GetAnchor();
|
||||
if (anchor)
|
||||
CallQueryInterface(anchor, aAnchor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<property name="triggerNode" readonly="true"
|
||||
onget="return this.popupBoxObject.triggerNode"/>
|
||||
|
||||
<property name="anchorNode" readonly="true"
|
||||
onget="return this.popupBoxObject.anchorNode"/>
|
||||
|
||||
<method name="openPopup">
|
||||
<parameter name="aAnchorElement"/>
|
||||
<parameter name="aPosition"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче