зеркало из https://github.com/mozilla/pjs.git
Merge last green changeset from mozilla-inbound to mozilla-central
This commit is contained in:
Коммит
1cefdd5c7d
|
@ -108,13 +108,6 @@
|
|||
key="printKb"
|
||||
command="cmd_print"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_import"
|
||||
label="&import.label;"
|
||||
accesskey="&import.accesskey;"
|
||||
oncommand="BrowserImport();"/>
|
||||
#ifndef XP_MACOSX
|
||||
<menuseparator/>
|
||||
#endif
|
||||
<menuitem id="goOfflineMenuitem"
|
||||
label="&goOfflineCmd.label;"
|
||||
accesskey="&goOfflineCmd.accesskey;"
|
||||
|
|
|
@ -2617,24 +2617,6 @@ function PageProxyClickHandler(aEvent)
|
|||
middleMousePaste(aEvent);
|
||||
}
|
||||
|
||||
function BrowserImport()
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("Browser:MigrationWizard");
|
||||
if (win)
|
||||
win.focus();
|
||||
else {
|
||||
window.openDialog("chrome://browser/content/migration/migration.xul",
|
||||
"migration", "centerscreen,chrome,resizable=no");
|
||||
}
|
||||
#else
|
||||
window.openDialog("chrome://browser/content/migration/migration.xul",
|
||||
"migration", "modal,centerscreen,chrome,resizable=no");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle load of some pages (about:*) so that we can make modifications
|
||||
* to the DOM for unprivileged pages.
|
||||
|
@ -8135,8 +8117,6 @@ let gPrivateBrowsingUI = {
|
|||
|
||||
this._setPBMenuTitle("stop");
|
||||
|
||||
document.getElementById("menu_import").setAttribute("disabled", "true");
|
||||
|
||||
// Disable the Clear Recent History... menu item when in PB mode
|
||||
// temporary fix until bug 463607 is fixed
|
||||
document.getElementById("Tools:Sanitize").setAttribute("disabled", "true");
|
||||
|
@ -8184,8 +8164,6 @@ let gPrivateBrowsingUI = {
|
|||
gURLBar.editor.transactionManager.clear();
|
||||
}
|
||||
|
||||
document.getElementById("menu_import").removeAttribute("disabled");
|
||||
|
||||
// Re-enable the Clear Recent History... menu item on exit of PB mode
|
||||
// temporary fix until bug 463607 is fixed
|
||||
document.getElementById("Tools:Sanitize").removeAttribute("disabled");
|
||||
|
|
|
@ -249,7 +249,11 @@ function GroupItem(listOfEls, options) {
|
|||
this._init($container[0]);
|
||||
|
||||
// ___ Children
|
||||
Array.prototype.forEach.call(listOfEls, function(el) {
|
||||
// We explicitly set dontArrange=true to prevent the groupItem from
|
||||
// re-arranging its children after a tabItem has been added. This saves us a
|
||||
// group.arrange() call per child and therefore some tab.setBounds() calls.
|
||||
options.dontArrange = true;
|
||||
listOfEls.forEach(function (el) {
|
||||
self.add(el, options);
|
||||
});
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@ body {
|
|||
|
||||
.tab-title {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.stacked .tab-title {
|
||||
|
|
|
@ -1,83 +1,57 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let tabViewShownCount = 0;
|
||||
let timerId;
|
||||
let newWin;
|
||||
|
||||
// ----------
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
// verify initial state
|
||||
ok(!TabView.isVisible(), "Tab View starts hidden");
|
||||
|
||||
// launch tab view for the first time
|
||||
window.addEventListener("tabviewshown", onTabViewLoadedAndShown, false);
|
||||
TabView.toggle();
|
||||
newWindowWithTabView(function() {}, function(win) {
|
||||
newWin = win;
|
||||
|
||||
let onSelect = function(event) {
|
||||
if (deck != event.target)
|
||||
return;
|
||||
|
||||
let iframe = win.document.getElementById("tab-view");
|
||||
if (deck.selectedPanel != iframe)
|
||||
return;
|
||||
|
||||
deck.removeEventListener("select", onSelect, true);
|
||||
|
||||
whenTabViewIsShown(function() {
|
||||
executeSoon(function() {
|
||||
testMethodToHideAndShowTabView(function() {
|
||||
newWin.document.getElementById("menu_tabview").doCommand();
|
||||
}, function() {
|
||||
testMethodToHideAndShowTabView(function() {
|
||||
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true }, newWin);
|
||||
}, finish);
|
||||
});
|
||||
});
|
||||
}, win);
|
||||
};
|
||||
|
||||
let deck = win.document.getElementById("tab-view-deck");
|
||||
deck.addEventListener("select", onSelect, true);
|
||||
});
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
window.removeEventListener("tabviewshown", onTabViewLoadedAndShown, false);
|
||||
if (timerId)
|
||||
clearTimeout(timerId);
|
||||
TabView.hide()
|
||||
newWin.close();
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
function onTabViewLoadedAndShown() {
|
||||
window.removeEventListener("tabviewshown", onTabViewLoadedAndShown, false);
|
||||
|
||||
// Evidently sometimes isVisible (which is based on the selectedIndex of the
|
||||
// tabview deck) isn't updated immediately when called from button.doCommand,
|
||||
// so we add a little timeout here to get outside of the doCommand call.
|
||||
// If the initial timeout isn't enough, we keep waiting in case it's taking
|
||||
// longer than expected.
|
||||
// See bug 594909.
|
||||
let deck = document.getElementById("tab-view-deck");
|
||||
let iframe = document.getElementById("tab-view");
|
||||
ok(iframe, "The tab view iframe exists");
|
||||
|
||||
function waitForSwitch() {
|
||||
if (deck.selectedPanel == iframe) {
|
||||
ok(TabView.isVisible(), "Tab View is visible. Count: " + tabViewShownCount);
|
||||
tabViewShownCount++;
|
||||
|
||||
// kick off the series
|
||||
window.addEventListener("tabviewshown", onTabViewShown, false);
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
window.removeEventListener("tabviewshown", onTabViewShown, false);
|
||||
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
});
|
||||
TabView.toggle();
|
||||
} else {
|
||||
timerId = setTimeout(waitForSwitch, 10);
|
||||
}
|
||||
}
|
||||
|
||||
timerId = setTimeout(waitForSwitch, 1);
|
||||
}
|
||||
|
||||
// ----------
|
||||
function onTabViewShown() {
|
||||
// add the count to the message so we can track things more easily.
|
||||
ok(TabView.isVisible(), "Tab View is visible. Count: " + tabViewShownCount);
|
||||
tabViewShownCount++;
|
||||
TabView.toggle();
|
||||
}
|
||||
|
||||
// ----------
|
||||
function onTabViewHidden() {
|
||||
ok(!TabView.isVisible(), "Tab View is hidden. Count: " + tabViewShownCount);
|
||||
|
||||
if (tabViewShownCount == 1) {
|
||||
document.getElementById("menu_tabview").doCommand();
|
||||
} else if (tabViewShownCount == 2) {
|
||||
EventUtils.synthesizeKey("E", { accelKey: true, shiftKey: true });
|
||||
} else if (tabViewShownCount == 3) {
|
||||
window.removeEventListener("tabviewshown", onTabViewShown, false);
|
||||
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
finish();
|
||||
}
|
||||
function testMethodToHideAndShowTabView(executeFunc, callback) {
|
||||
whenTabViewIsHidden(function() {
|
||||
ok(!newWin.TabView.isVisible(), "Tab View is not visible after executing the function");
|
||||
whenTabViewIsShown(function() {
|
||||
ok(newWin.TabView.isVisible(), "Tab View is visible after executing the function again");
|
||||
callback();
|
||||
}, newWin);
|
||||
executeFunc();
|
||||
}, newWin);
|
||||
executeFunc();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Asaf Romano <mano@mozilla.com>
|
||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
* Drew Willcoxon <adw@mozilla.com>
|
||||
* Steffen Wilberg <steffen.wilberg@web.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -114,6 +115,8 @@ var PlacesOrganizer = {
|
|||
// remove the "Properties" context-menu item, we've our own details pane
|
||||
document.getElementById("placesContext")
|
||||
.removeChild(document.getElementById("placesContext_show:info"));
|
||||
|
||||
gPrivateBrowsingListener.init();
|
||||
},
|
||||
|
||||
QueryInterface: function PO_QueryInterface(aIID) {
|
||||
|
@ -145,6 +148,7 @@ var PlacesOrganizer = {
|
|||
},
|
||||
|
||||
destroy: function PO_destroy() {
|
||||
gPrivateBrowsingListener.uninit();
|
||||
},
|
||||
|
||||
_location: null,
|
||||
|
@ -364,19 +368,24 @@ var PlacesOrganizer = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Show the migration wizard for importing from a file.
|
||||
* Show the migration wizard for importing passwords,
|
||||
* cookies, history, preferences, and bookmarks.
|
||||
*/
|
||||
importBookmarks: function PO_import() {
|
||||
// XXX: ifdef it to be non-modal (non-"sheet") on mac (see bug 259039)
|
||||
var features = "modal,centerscreen,chrome,resizable=no";
|
||||
importFromBrowser: function PO_importFromBrowser() {
|
||||
#ifdef XP_MACOSX
|
||||
// On Mac, the window is not modal
|
||||
let win = Services.wm.getMostRecentWindow("Browser:MigrationWizard");
|
||||
if (win) {
|
||||
win.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// The migrator window will set this to true when it closes, if the user
|
||||
// chose to migrate from a specific file.
|
||||
window.fromFile = false;
|
||||
openDialog("chrome://browser/content/migration/migration.xul",
|
||||
"migration", features, "bookmarks");
|
||||
if (window.fromFile)
|
||||
this.importFromFile();
|
||||
let features = "centerscreen,chrome,resizable=no";
|
||||
#else
|
||||
let features = "modal,centerscreen,chrome,resizable=no";
|
||||
#endif
|
||||
window.openDialog("chrome://browser/content/migration/migration.xul",
|
||||
"migration", features);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1340,4 +1349,41 @@ var ViewMenu = {
|
|||
result.sortingAnnotation = colLookupTable[columnId].anno || "";
|
||||
result.sortingMode = Ci.nsINavHistoryQueryOptions[sortConst];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the "Import and Backup->Import From Another Browser" menu item
|
||||
* in private browsing mode.
|
||||
*/
|
||||
let gPrivateBrowsingListener = {
|
||||
_cmd_import: null,
|
||||
|
||||
init: function PO_PB_init() {
|
||||
this._cmd_import = document.getElementById("OrganizerCommand_browserImport");
|
||||
|
||||
let pbs = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
if (pbs.privateBrowsingEnabled)
|
||||
this.updateUI(true);
|
||||
|
||||
Services.obs.addObserver(this, "private-browsing", false);
|
||||
},
|
||||
|
||||
uninit: function PO_PB_uninit() {
|
||||
Services.obs.removeObserver(this, "private-browsing");
|
||||
},
|
||||
|
||||
observe: function PO_PB_observe(aSubject, aTopic, aData) {
|
||||
if (aData == "enter")
|
||||
this.updateUI(true);
|
||||
else if (aData == "exit")
|
||||
this.updateUI(false);
|
||||
},
|
||||
|
||||
updateUI: function PO_PB_updateUI(PBmode) {
|
||||
if (PBmode)
|
||||
this._cmd_import.setAttribute("disabled", "true");
|
||||
else
|
||||
this._cmd_import.removeAttribute("disabled");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -109,7 +109,9 @@
|
|||
<command id="OrganizerCommand_export"
|
||||
oncommand="PlacesOrganizer.exportBookmarks();"/>
|
||||
<command id="OrganizerCommand_import"
|
||||
oncommand="PlacesOrganizer.importBookmarks();"/>
|
||||
oncommand="PlacesOrganizer.importFromFile();"/>
|
||||
<command id="OrganizerCommand_browserImport"
|
||||
oncommand="PlacesOrganizer.importFromBrowser();"/>
|
||||
<command id="OrganizerCommand_backup"
|
||||
oncommand="PlacesOrganizer.backupBookmarks();"/>
|
||||
<command id="OrganizerCommand_restoreFromFile"
|
||||
|
@ -351,12 +353,17 @@
|
|||
<menuseparator/>
|
||||
<menuitem id="fileImport"
|
||||
command="OrganizerCommand_import"
|
||||
label="&cmd.importHTML.label;"
|
||||
accesskey="&cmd.importHTML.accesskey;"/>
|
||||
label="&importBookmarksFromHTML.label;"
|
||||
accesskey="&importBookmarksFromHTML.accesskey;"/>
|
||||
<menuitem id="fileExport"
|
||||
command="OrganizerCommand_export"
|
||||
label="&cmd.exportHTML.label;"
|
||||
accesskey="&cmd.exportHTML.accesskey;"/>
|
||||
label="&exportBookmarksToHTML.label;"
|
||||
accesskey="&exportBookmarksToHTML.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="browserImport"
|
||||
command="OrganizerCommand_browserImport"
|
||||
label="&importOtherBrowser.label;"
|
||||
accesskey="&importOtherBrowser.accesskey;"/>
|
||||
</menupopup>
|
||||
#ifdef XP_MACOSX
|
||||
</toolbarbutton>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
|
||||
* Steffen Wilberg <steffen.wilberg@web.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -35,33 +36,71 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// This test makes sure that the File->Import menu item is disabled inside the
|
||||
// private browsing mode.
|
||||
// This test makes sure that the "Import and Backup->Import From Another Browser"
|
||||
// menu item in the Places Organizer is disabled inside private browsing mode.
|
||||
|
||||
// TEST_PATH=browser/components/privatebrowsing/test/browser/browser_privatebrowsing_import.js make -C $(OBJDIR) mochitest-browser-chrome
|
||||
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
function test() {
|
||||
// initialization
|
||||
waitForExplicitFinish();
|
||||
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
let importMenuItem = document.getElementById("menu_import");
|
||||
// first test: open the library with PB disabled
|
||||
pb.privateBrowsingEnabled = false;
|
||||
openLibrary(testPBoff);
|
||||
}
|
||||
|
||||
// make sure the menu item is not disabled to begin with
|
||||
function openLibrary(callback) {
|
||||
var library = window.openDialog("chrome://browser/content/places/places.xul",
|
||||
"", "chrome,toolbar=yes,dialog=no,resizable");
|
||||
waitForFocus(function () {
|
||||
callback(library);
|
||||
}, library);
|
||||
}
|
||||
|
||||
function testPBoff(win) {
|
||||
// XXX want to test the #browserImport menuitem instead
|
||||
let importMenuItem = win.document.getElementById("OrganizerCommand_browserImport");
|
||||
|
||||
// make sure the menu item is enabled outside PB mode when opening the Library
|
||||
ok(!importMenuItem.hasAttribute("disabled"),
|
||||
"File->Import menu item should not be disabled outside of the private browsing mode");
|
||||
"Import From Another Browser menu item should be enabled outside PB mode when opening the Library");
|
||||
|
||||
// enter private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
ok(importMenuItem.hasAttribute("disabled"),
|
||||
"File->Import menu item should be disabled inside of the private browsing mode");
|
||||
"Import From Another Browser menu item should be disabled after starting PB mode");
|
||||
|
||||
// leave private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
|
||||
ok(!importMenuItem.hasAttribute("disabled"),
|
||||
"File->Import menu item should not be disabled after leaving the private browsing mode");
|
||||
"Import From Another Browser menu item should not be disabled after leaving the PB mode");
|
||||
|
||||
win.close();
|
||||
|
||||
// launch the second test: open the Library with PB enabled
|
||||
pb.privateBrowsingEnabled = true;
|
||||
openLibrary(testPBon);
|
||||
}
|
||||
|
||||
function testPBon(win) {
|
||||
let importMenuItem = win.document.getElementById("OrganizerCommand_browserImport");
|
||||
|
||||
// make sure the menu item is disabled in PB mode when opening the Library
|
||||
ok(importMenuItem.hasAttribute("disabled"),
|
||||
"Import From Another Browser menu item should be disabled in PB mode when opening the Libary");
|
||||
|
||||
// leave private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
ok(!importMenuItem.hasAttribute("disabled"),
|
||||
"Import From Another Browser menu item should not be disabled after leaving PB mode");
|
||||
|
||||
win.close();
|
||||
|
||||
// cleanup
|
||||
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -57,8 +57,6 @@ can reach it easily. -->
|
|||
<!ENTITY printCmd.label "Print…">
|
||||
<!ENTITY printCmd.accesskey "P">
|
||||
<!ENTITY printCmd.commandkey "p">
|
||||
<!ENTITY import.label "Import…">
|
||||
<!ENTITY import.accesskey "I">
|
||||
|
||||
<!ENTITY goOfflineCmd.label "Work Offline">
|
||||
<!ENTITY goOfflineCmd.accesskey "w">
|
||||
|
|
|
@ -28,10 +28,12 @@
|
|||
<!ENTITY cmd.findCurrent.label "Find in Current Collection…">
|
||||
<!ENTITY cmd.findCurrent.accesskey "i">
|
||||
|
||||
<!ENTITY cmd.exportHTML.label "Export HTML…">
|
||||
<!ENTITY cmd.exportHTML.accesskey "E">
|
||||
<!ENTITY cmd.importHTML.label "Import HTML…">
|
||||
<!ENTITY cmd.importHTML.accesskey "I">
|
||||
<!ENTITY importBookmarksFromHTML.label "Import Bookmarks from HTML…">
|
||||
<!ENTITY importBookmarksFromHTML.accesskey "I">
|
||||
<!ENTITY exportBookmarksToHTML.label "Export Bookmarks to HTML…">
|
||||
<!ENTITY exportBookmarksToHTML.accesskey "E">
|
||||
<!ENTITY importOtherBrowser.label "Import Data from Another Browser…">
|
||||
<!ENTITY importOtherBrowser.accesskey "A">
|
||||
|
||||
<!ENTITY cmd.backup.label "Backup…">
|
||||
<!ENTITY cmd.backup.accesskey "B">
|
||||
|
|
|
@ -142,8 +142,6 @@ html[dir=rtl] .expander {
|
|||
top: 100%;
|
||||
text-align: center;
|
||||
width: 94.5%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.stacked {
|
||||
|
|
|
@ -134,8 +134,6 @@ html[dir=rtl] .expander {
|
|||
bottom: -20px;
|
||||
text-align: center;
|
||||
width: 94.5%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-shadow: 0 1px rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,8 +139,6 @@ html[dir=rtl] .expander {
|
|||
bottom: -20px;
|
||||
text-align: center;
|
||||
width: 94.5%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-shadow: 0 1px rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
|
|
|
@ -2217,16 +2217,13 @@ nsXULElement::AddPopupListener(nsIAtom* aName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewXULPopupListener(this, isContext,
|
||||
getter_AddRefs(popupListener));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
popupListener = new nsXULPopupListener(this, isContext);
|
||||
|
||||
// Add the popup as a listener on this element.
|
||||
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_TRUE(manager, NS_ERROR_FAILURE);
|
||||
rv = SetProperty(listenerAtom, popupListener, PopupListenerPropertyDtor,
|
||||
PR_TRUE);
|
||||
nsresult rv = SetProperty(listenerAtom, popupListener,
|
||||
PopupListenerPropertyDtor, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Want the property to have a reference to the listener.
|
||||
nsIDOMEventListener* listener = nsnull;
|
||||
|
|
|
@ -104,39 +104,26 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXULPopupListener)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULPopupListener)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULPopupListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMContextMenuListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// nsIDOMMouseListener
|
||||
// nsIDOMEventListener
|
||||
|
||||
nsresult
|
||||
nsXULPopupListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if(!mIsContext)
|
||||
return PreLaunchPopup(aMouseEvent);
|
||||
else
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
|
||||
if(!((eventType.EqualsLiteral("mousedown") && !mIsContext) ||
|
||||
(eventType.EqualsLiteral("contextmenu") && mIsContext)))
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULPopupListener::ContextMenu(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if(mIsContext)
|
||||
return PreLaunchPopup(aMouseEvent);
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULPopupListener::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
PRUint16 button;
|
||||
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent;
|
||||
mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
|
||||
if (!mouseEvent) {
|
||||
//non-ui event passed in. bad things.
|
||||
return NS_OK;
|
||||
|
@ -223,7 +210,7 @@ nsXULPopupListener::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aEvent);
|
||||
|
||||
if (mIsContext) {
|
||||
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
|
||||
|
@ -240,9 +227,9 @@ nsXULPopupListener::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
}
|
||||
|
||||
// Open the popup and cancel the default handling of the event.
|
||||
LaunchPopup(aMouseEvent, targetContent);
|
||||
aMouseEvent->StopPropagation();
|
||||
aMouseEvent->PreventDefault();
|
||||
LaunchPopup(aEvent, targetContent);
|
||||
aEvent->StopPropagation();
|
||||
aEvent->PreventDefault();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -474,17 +461,3 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
nsresult
|
||||
NS_NewXULPopupListener(nsIDOMElement* aElement, PRBool aIsContext,
|
||||
nsIDOMEventListener** aListener)
|
||||
{
|
||||
nsXULPopupListener* pl = new nsXULPopupListener(aElement, aIsContext);
|
||||
if (!pl)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aListener = static_cast<nsIDOMMouseListener *>(pl);
|
||||
NS_ADDREF(*aListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -52,12 +52,10 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsXULPopupListener : public nsIDOMMouseListener,
|
||||
public nsIDOMContextMenuListener
|
||||
class nsXULPopupListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
// aElement is the element that the popup is attached to. If aIsContext is
|
||||
|
@ -69,25 +67,10 @@ public:
|
|||
|
||||
// nsISupports
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULPopupListener,
|
||||
nsIDOMMouseListener)
|
||||
|
||||
// nsIDOMMouseListener
|
||||
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
// nsIDOMContextMenuListener
|
||||
NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent);
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent) { return NS_OK; }
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsXULPopupListener)
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
protected:
|
||||
|
||||
// open the popup. aEvent is the event that triggered the popup such as
|
||||
// a mouse click and aTargetContent is the target of this event.
|
||||
virtual nsresult LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent);
|
||||
|
@ -96,12 +79,6 @@ protected:
|
|||
virtual void ClosePopup();
|
||||
|
||||
private:
|
||||
|
||||
// PreLaunchPopup is called before LaunchPopup to ensure that the event is
|
||||
// suitable and to initialize the XUL document's popupNode to the event
|
||||
// target.
|
||||
nsresult PreLaunchPopup(nsIDOMEvent* aMouseEvent);
|
||||
|
||||
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
|
||||
// When a context menu is opened, focus the target of the contextmenu event.
|
||||
nsresult FireFocusOnTargetContent(nsIDOMNode* aTargetNode);
|
||||
|
@ -117,11 +94,4 @@ private:
|
|||
PRBool mIsContext;
|
||||
};
|
||||
|
||||
// Construct a new nsXULPopupListener and return in aListener. See the
|
||||
// nsXULPopupListener constructor for details about the aElement and
|
||||
// aIsContext arguments.
|
||||
nsresult
|
||||
NS_NewXULPopupListener(nsIDOMElement* aElement, PRBool aIsContext,
|
||||
nsIDOMEventListener** aListener);
|
||||
|
||||
#endif // nsXULPopupListener_h___
|
||||
|
|
|
@ -446,6 +446,11 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
|||
mDevice->CreateRenderTargetView(tmpDSTexture, NULL, byRef(dsRTView));
|
||||
mDevice->CreateShaderResourceView(tmpDSTexture, NULL, byRef(dsSRView));
|
||||
|
||||
// We're not guaranteed the texture we created will be empty, we've
|
||||
// seen old content at least on NVidia drivers.
|
||||
float color[4] = { 0, 0, 0, 0 };
|
||||
mDevice->ClearRenderTargetView(dsRTView, color);
|
||||
|
||||
rtViews = dsRTView;
|
||||
mDevice->OMSetRenderTargets(1, &rtViews, NULL);
|
||||
|
||||
|
|
|
@ -943,7 +943,7 @@
|
|||
var self = this;
|
||||
this.muteButton.addEventListener("command", function() { self.toggleMute(); }, false);
|
||||
this.playButton.addEventListener("command", function() { self.togglePause(); }, false);
|
||||
this.controlsSpacer.addEventListener("click", function() { self.togglePause(); }, false);
|
||||
this.controlsSpacer.addEventListener("click", function(e) { if (e.button == 0) { self.togglePause(); } }, false);
|
||||
if (!this.isAudioOnly) {
|
||||
this.muteButton.addEventListener("mouseover", function(e) { self.onVolumeMouseInOut(e); }, false);
|
||||
this.muteButton.addEventListener("mouseout", function(e) { self.onVolumeMouseInOut(e); }, false);
|
||||
|
|
|
@ -3414,6 +3414,8 @@ public:
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
mCollector->GCIfNeeded(PR_FALSE);
|
||||
|
||||
MutexAutoLock autoLock(mLock);
|
||||
|
||||
if (!mRunning)
|
||||
|
@ -3426,8 +3428,6 @@ public:
|
|||
NS_ASSERTION(!mListener, "Should have cleared this already!");
|
||||
mListener = aListener;
|
||||
|
||||
mCollector->GCIfNeeded(PR_FALSE);
|
||||
|
||||
mRequest.Notify();
|
||||
mReply.Wait();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче