Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 474773 Details for
Bug 554937
[patch]
Part 1: add an anchorNode property for popups which returns the node the popup is anchored to, address comments
arrow-anchornode.txt (text/plain), 4.56 KB, created by
Neil Deakin (away until Sept 6)
(
hide
)
Description:
Part 1: add an anchorNode property for popups which returns the node the popup is anchored to, address comments
Filename:
MIME Type:
Creator:
Neil Deakin (away until Sept 6)
Size:
4.56 KB
patch
obsolete
>diff --git a/layout/xul/base/public/nsIPopupBoxObject.idl b/layout/xul/base/public/nsIPopupBoxObject.idl >--- a/layout/xul/base/public/nsIPopupBoxObject.idl >+++ b/layout/xul/base/public/nsIPopupBoxObject.idl >@@ -38,17 +38,17 @@ > * ***** END LICENSE BLOCK ***** */ > > #include "nsIBoxObject.idl" > > interface nsIDOMElement; > interface nsIDOMNode; > interface nsIDOMEvent; > >-[scriptable, uuid(e4c3845b-97d2-4fdf-860e-949746d15fb9)] >+[scriptable, uuid(548a9e3f-af78-42b0-a260-035ece15c19f)] > interface nsIPopupBoxObject : nsISupports > { > /** > * This method is deprecated. Use openPopup or openPopupAtScreen instead. > */ > void showPopup(in nsIDOMElement srcContent, in nsIDOMElement popupContent, > in long xpos, in long ypos, > in wstring popupType, in wstring anchorAlignment, >@@ -172,15 +172,21 @@ interface nsIPopupBoxObject : nsISupport > */ > readonly attribute AString popupState; > > /** > * The node that triggered the popup. If the popup is not open, will return > * 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++ > nsresult > NS_NewPopupBoxObject(nsIBoxObject** aResult); > > %} >diff --git a/layout/xul/base/src/nsMenuPopupFrame.h b/layout/xul/base/src/nsMenuPopupFrame.h >--- a/layout/xul/base/src/nsMenuPopupFrame.h >+++ b/layout/xul/base/src/nsMenuPopupFrame.h >@@ -320,16 +320,19 @@ public: > // Later, when bug 357725 is implemented, we can make this adjust aChange by > // the amount that the side can be resized, so that minimums and maximums > // can be taken into account. > void CanAdjustEdges(PRInt8 aHorizontalSide, PRInt8 aVerticalSide, nsIntPoint& aChange); > > // 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); } > > protected: > > // returns the popup's level. > nsPopupLevel PopupLevel(PRBool aIsNoAutoHide) const; > >diff --git a/layout/xul/base/src/nsPopupBoxObject.cpp b/layout/xul/base/src/nsPopupBoxObject.cpp >--- a/layout/xul/base/src/nsPopupBoxObject.cpp >+++ b/layout/xul/base/src/nsPopupBoxObject.cpp >@@ -46,17 +46,16 @@ > #include "nsIDocument.h" > #include "nsIDOMDocument.h" > #include "nsIDOMElement.h" > #include "nsIFrame.h" > #include "nsINameSpaceManager.h" > #include "nsGkAtoms.h" > #include "nsMenuPopupFrame.h" > >- > class nsPopupBoxObject : public nsBoxObject, > public nsIPopupBoxObject > { > public: > NS_DECL_ISUPPORTS_INHERITED > NS_DECL_NSIPOPUPBOXOBJECT > > nsPopupBoxObject() {} >@@ -270,16 +269,32 @@ nsPopupBoxObject::GetTriggerNode(nsIDOMN > > nsIContent* triggerContent = nsMenuPopupFrame::GetTriggerContent(GetMenuPopupFrame()); > if (triggerContent) > CallQueryInterface(triggerContent, 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 > NS_NewPopupBoxObject(nsIBoxObject** aResult) > { > *aResult = new nsPopupBoxObject; > if (!*aResult) > return NS_ERROR_OUT_OF_MEMORY; >diff --git a/toolkit/content/widgets/popup.xml b/toolkit/content/widgets/popup.xml >--- a/toolkit/content/widgets/popup.xml >+++ b/toolkit/content/widgets/popup.xml >@@ -22,16 +22,19 @@ > </property> > > <property name="state" readonly="true" > onget="return this.popupBoxObject.popupState"/> > > <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"/> > <parameter name="aX"/> > <parameter name="aY"/> > <parameter name="aIsContextMenu"/> > <parameter name="aAttributesOverride"/> > <parameter name="aTriggerEvent"/>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
enndeakin
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 554937
:
460925
|
460927
|
468151
|
468152
|
468153
|
468154
|
468155
|
468306
|
468308
|
468309
|
468317
| 474773 |
474788
|
474799
|
476138
|
476142
|
476154
|
476325
|
476327
|
478036