Bug 386917, choose application in feeds page not working, add popup state retrieving api, r=mano,sr=bz,a=dbaron

git-svn-id: svn://10.0.0.236/trunk@232182 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
enndeakin%sympatico.ca 2007-08-15 23:52:47 +00:00
parent d812f8b7f2
commit 0d45eb5583
5 changed files with 58 additions and 8 deletions

View File

@ -566,13 +566,13 @@ FeedWriter.prototype = {
* selected). If we don't show the filepicker here, it will be shown
* when clicking "Subscribe Now".
*/
if (this._document.getElementById("handlersMenuList")
.getAttribute("open") == "true") {
if (!this._chooseClientApp()) {
// Select the (per-prefs) selected handler if no application was
// selected
this._setSelectedHandler();
}
var popupbox = this._document.getElementById("handlersMenuList")
.firstChild.boxObject;
popupbox.QueryInterface(Components.interfaces.nsIPopupBoxObject);
if (popupbox.popupState == "hiding" && !this._chooseClientApp()) {
// Select the (per-prefs) selected handler if no application was
// selected
this._setSelectedHandler();
}
break;
default:

View File

@ -41,7 +41,7 @@
interface nsIDOMElement;
[scriptable, uuid(8714441F-0E24-4EB5-BE58-905F2854B4EB)]
[scriptable, uuid(A41AF368-9F73-4D73-A058-49DD7E41F9EA)]
interface nsIPopupBoxObject : nsISupports
{
/**
@ -154,6 +154,15 @@ interface nsIPopupBoxObject : nsISupports
* @param y vertical screen position
*/
void openPopupAtScreen(in long x, in long y, in boolean isContextMenu);
/**
* Returns the state of the popup:
* closed - the popup is closed
* open - the popup is open
* showing - the popup is in the process of being shown
* hiding - the popup is in the process of being hidden
*/
readonly attribute AString popupState;
};
%{C++

View File

@ -223,6 +223,32 @@ nsPopupBoxObject::EnableKeyboardNavigator(PRBool aEnableKeyboardNavigator)
return NS_OK;
}
NS_IMETHODIMP
nsPopupBoxObject::GetPopupState(nsAString& aState)
{
aState.AssignLiteral("closed");
nsMenuPopupFrame *menuPopupFrame = GetMenuPopupFrame();
if (menuPopupFrame) {
switch (menuPopupFrame->PopupState()) {
case ePopupShowing:
case ePopupOpen:
aState.AssignLiteral("showing");
break;
case ePopupOpenAndVisible:
aState.AssignLiteral("open");
break;
case ePopupHiding:
case ePopupInvisible:
aState.AssignLiteral("hiding");
break;
}
}
return NS_OK;
}
// Creation Routine ///////////////////////////////////////////////////////////////////////
nsresult

View File

@ -99,6 +99,18 @@ function eventOccured(event)
(eventitem[0] == event.type && eventitem[1] == event.target.id);
ok(matches, test.testname + " " + event.type + " fired");
var expectedState;
switch (event.type) {
case "popupshowing": expectedState = "showing"; break;
case "popupshown": expectedState = "open"; break;
case "popuphiding": expectedState = "hiding"; break;
case "popuphidden": expectedState = "closed"; break;
}
if (expectedState)
is(event.originalTarget.state, expectedState,
test.testname + " " + event.type + " state");
if (matches) {
gTestEventIndex++
if (events.length <= gTestEventIndex)

View File

@ -31,6 +31,9 @@
</getter>
</property>
<property name="state" readonly="true"
onget="return this.popupBoxObject.popupState"/>
<method name="openPopup">
<parameter name="aAnchorElement"/>
<parameter name="aPosition"/>