Merge m-c to b2g-inbound.

This commit is contained in:
Ryan VanderMeulen 2014-02-28 16:09:30 -05:00
commit 877b4b2eaa
202 changed files with 3259 additions and 2040 deletions

View File

@ -23,11 +23,11 @@
#include "nsEventStateManager.h" #include "nsEventStateManager.h"
#include "nsISelectionPrivate.h" #include "nsISelectionPrivate.h"
#include "nsISelectionController.h" #include "nsISelectionController.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "nsView.h" #include "nsView.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsDOMTouchEvent.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
@ -141,7 +141,7 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
nsIContent* aContent, nsIFrame* aFrame, nsIContent* aContent, nsIFrame* aFrame,
nsIPresShell* aPresShell, nsIWidget* aRootWidget) nsIPresShell* aPresShell, nsIWidget* aRootWidget)
{ {
if (!nsDOMTouchEvent::PrefEnabled()) if (!dom::TouchEvent::PrefEnabled())
return; return;
WidgetTouchEvent event(true, aEventType, aRootWidget); WidgetTouchEvent event(true, aEventType, aRootWidget);
@ -149,8 +149,7 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
event.time = PR_IntervalNow(); event.time = PR_IntervalNow();
// XXX: Touch has an identifier of -1 to hint that it is synthesized. // XXX: Touch has an identifier of -1 to hint that it is synthesized.
nsRefPtr<mozilla::dom::Touch> t = nsRefPtr<dom::Touch> t = new dom::Touch(-1, nsIntPoint(aX, aY),
new mozilla::dom::Touch(-1, nsIntPoint(aX, aY),
nsIntPoint(1, 1), 0.0f, 1.0f); nsIntPoint(1, 1), 0.0f, 1.0f);
t->SetTarget(aContent); t->SetTarget(aContent);
event.touches.AppendElement(t); event.touches.AppendElement(t);

View File

@ -933,7 +933,6 @@ Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
if (canvasFrame) { if (canvasFrame) {
*aBoundingFrame = canvasFrame; *aBoundingFrame = canvasFrame;
nsPresContext* presContext = mDoc->PresContext();
aTotalBounds = *hitRegionRect; aTotalBounds = *hitRegionRect;
return; return;

View File

@ -1791,7 +1791,6 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
return NS_OK; return NS_OK;
int32_t startHTOffset = 0, endHTOffset = 0; int32_t startHTOffset = 0, endHTOffset = 0;
nsresult rv = NS_OK;
for (int32_t idx = 0; idx < rangeCount; idx++) { for (int32_t idx = 0; idx < rangeCount; idx++) {
nsRange* range = domSel->GetRangeAt(idx); nsRange* range = domSel->GetRangeAt(idx);
if (range->Collapsed()) if (range->Collapsed())

View File

@ -50,6 +50,9 @@
<command id="cmd_findPrevious" <command id="cmd_findPrevious"
oncommand="gFindBar.onFindAgainCommand(true);" oncommand="gFindBar.onFindAgainCommand(true);"
observes="isImage"/> observes="isImage"/>
#ifdef XP_MACOSX
<command id="cmd_findSelection" oncommand="gFindBar.onFindSelectionCommand();"/>
#endif
<!-- work-around bug 392512 --> <!-- work-around bug 392512 -->
<command id="Browser:AddBookmarkAs" <command id="Browser:AddBookmarkAs"
oncommand="PlacesCommandHook.bookmarkCurrentPage(true, PlacesUtils.bookmarksMenuFolderId);"/> oncommand="PlacesCommandHook.bookmarkCurrentPage(true, PlacesUtils.bookmarksMenuFolderId);"/>
@ -350,6 +353,9 @@
<key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/> <key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/> <key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
<key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/> <key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
#ifdef XP_MACOSX
<key id="key_findSelection" key="&findSelectionCmd.commandkey;" command="cmd_findSelection" modifiers="accel"/>
#endif
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/> <key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findPrevious" modifiers="shift"/> <key keycode="&findAgainCmd.commandkey2;" command="cmd_findPrevious" modifiers="shift"/>

View File

@ -973,7 +973,8 @@
</toolbar> </toolbar>
<!-- This is a shim which will go away ASAP. See bug 749804 for details --> <!-- This is a shim which will go away ASAP. See bug 749804 for details -->
<toolbar id="addon-bar" toolbar-delegate="nav-bar" mode="icons" iconsize="small"> <toolbar id="addon-bar" toolbar-delegate="nav-bar" mode="icons" iconsize="small"
customizable="true">
<hbox id="addonbar-closebutton"/> <hbox id="addonbar-closebutton"/>
<statusbar id="status-bar"/> <statusbar id="status-bar"/>
</toolbar> </toolbar>

View File

@ -11,6 +11,9 @@ let texts = [
"To err is human; to forgive is not company policy." "To err is human; to forgive is not company policy."
]; ];
let Clipboard = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
let HasFindClipboard = Clipboard.supportsFindClipboard();
function addTabWithText(aText, aCallback) { function addTabWithText(aText, aCallback) {
let newTab = gBrowser.addTab("data:text/html,<h1 id='h1'>" + aText + "</h1>"); let newTab = gBrowser.addTab("data:text/html,<h1 id='h1'>" + aText + "</h1>");
tabs.push(newTab); tabs.push(newTab);
@ -19,6 +22,7 @@ function addTabWithText(aText, aCallback) {
function setFindString(aString) { function setFindString(aString) {
gFindBar.open(); gFindBar.open();
gFindBar._findField.focus();
gFindBar._findField.select(); gFindBar._findField.select();
EventUtils.sendString(aString); EventUtils.sendString(aString);
is(gFindBar._findField.value, aString, "Set the field correctly!"); is(gFindBar._findField.value, aString, "Set the field correctly!");
@ -61,6 +65,8 @@ function continueTests1() {
// Confirm the first tab is still correct, ensure re-hiding works as expected // Confirm the first tab is still correct, ensure re-hiding works as expected
gBrowser.selectedTab = tabs[0]; gBrowser.selectedTab = tabs[0];
ok(!gFindBar.hidden, "First tab shows find bar!"); ok(!gFindBar.hidden, "First tab shows find bar!");
// When the Find Clipboard is supported, this test not relevant.
if (!HasFindClipboard)
is(gFindBar._findField.value, texts[0], "First tab persists find value!"); is(gFindBar._findField.value, texts[0], "First tab persists find value!");
ok(gFindBar.getElement("highlight").checked, ok(gFindBar.getElement("highlight").checked,
"Highlight button state persists!"); "Highlight button state persists!");
@ -94,8 +100,11 @@ function continueTests2() {
ok(gFindBar.hidden, "Fourth tab doesn't show find bar!"); ok(gFindBar.hidden, "Fourth tab doesn't show find bar!");
is(gFindBar, gBrowser.getFindBar(), "Find bar is right one!"); is(gFindBar, gBrowser.getFindBar(), "Find bar is right one!");
gFindBar.open(); gFindBar.open();
// Disabled the following assertion due to intermittent failure on OSX 10.6 Debug.
if (!HasFindClipboard) {
is(gFindBar._findField.value, texts[1], is(gFindBar._findField.value, texts[1],
"Fourth tab has second tab's find value!"); "Fourth tab has second tab's find value!");
}
newWindow = gBrowser.replaceTabWithWindow(tabs.pop()); newWindow = gBrowser.replaceTabWithWindow(tabs.pop());
whenDelayedStartupFinished(newWindow, checkNewWindow); whenDelayedStartupFinished(newWindow, checkNewWindow);
@ -104,8 +113,11 @@ function continueTests2() {
// Test that findbar gets restored when a tab is moved to a new window. // Test that findbar gets restored when a tab is moved to a new window.
function checkNewWindow() { function checkNewWindow() {
ok(!newWindow.gFindBar.hidden, "New window shows find bar!"); ok(!newWindow.gFindBar.hidden, "New window shows find bar!");
// Disabled the following assertion due to intermittent failure on OSX 10.6 Debug.
if (!HasFindClipboard) {
is(newWindow.gFindBar._findField.value, texts[1], is(newWindow.gFindBar._findField.value, texts[1],
"New window find bar has correct find value!"); "New window find bar has correct find value!");
}
ok(!newWindow.gFindBar.getElement("find-next").disabled, ok(!newWindow.gFindBar.getElement("find-next").disabled,
"New window findbar has enabled buttons!"); "New window findbar has enabled buttons!");
newWindow.close(); newWindow.close();

View File

@ -2,7 +2,10 @@
* http://creativecommons.org/publicdomain/zero/1.0/ * http://creativecommons.org/publicdomain/zero/1.0/
*/ */
let Ci = Components.interfaces; const {Ci: interfaces, Cc: classes} = Components;
let Clipboard = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
let HasFindClipboard = Clipboard.supportsFindClipboard();
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
@ -37,6 +40,9 @@ function onFocus(win) {
let findBar = win.gFindBar; let findBar = win.gFindBar;
selectText(win.content); selectText(win.content);
findBar.onFindCommand(); findBar.onFindCommand();
// When the OS supports the Find Clipboard (OSX), the find field value is
// persisted across Fx sessions, thus not useful to test.
if (!HasFindClipboard)
is(findBar._findField.value, "Select Me", "Findbar is initialized with selection"); is(findBar._findField.value, "Select Me", "Findbar is initialized with selection");
findBar.close(); findBar.close();
win.close(); win.close();

View File

@ -153,6 +153,11 @@
<vbox id="PanelUI-developerItems" class="panel-subview-body"/> <vbox id="PanelUI-developerItems" class="panel-subview-body"/>
</panelview> </panelview>
<panelview id="PanelUI-sidebar" flex="1">
<label value="&appMenuSidebars.label;" class="panel-subview-header"/>
<vbox id="PanelUI-sidebarItems"/>
</panelview>
<panelview id="PanelUI-characterEncodingView" flex="1"> <panelview id="PanelUI-characterEncodingView" flex="1">
<label value="&charsetMenu.label;" class="panel-subview-header"/> <label value="&charsetMenu.label;" class="panel-subview-header"/>
<vbox class="panel-subview-body"> <vbox class="panel-subview-body">

View File

@ -320,6 +320,75 @@ const CustomizableWidgets = [{
parent.appendChild(items); parent.appendChild(items);
} }
}, { }, {
id: "sidebar-button",
type: "view",
viewId: "PanelUI-sidebar",
onViewShowing: function(aEvent) {
// Largely duplicated from the developer-button above with a couple minor
// alterations.
// Populate the subview with whatever menuitems are in the
// sidebar menu. We skip menu elements, because the menu panel has no way
// of dealing with those right now.
let doc = aEvent.target.ownerDocument;
let win = doc.defaultView;
let items = doc.getElementById("PanelUI-sidebarItems");
let menu = doc.getElementById("viewSidebarMenu");
// First clear any existing menuitems then populate. Social sidebar
// options may not have been added yet, so we do that here. Add it to the
// standard menu first, then copy all sidebar options to the panel.
win.SocialSidebar.clearProviderMenus();
let providerMenuSeps = menu.getElementsByClassName("social-provider-menu");
if (providerMenuSeps.length > 0)
win.SocialSidebar._populateProviderMenu(providerMenuSeps[0]);
let attrs = ["oncommand", "onclick", "label", "key", "disabled",
"command", "observes", "hidden", "class", "origin",
"image", "checked"];
let fragment = doc.createDocumentFragment();
let itemsToDisplay = [...menu.children];
for (let node of itemsToDisplay) {
if (node.hidden)
continue;
let item;
if (node.localName == "menuseparator") {
item = doc.createElementNS(kNSXUL, "menuseparator");
} else if (node.localName == "menuitem") {
item = doc.createElementNS(kNSXUL, "toolbarbutton");
} else {
continue;
}
for (let attr of attrs) {
let attrVal = node.getAttribute(attr);
if (attrVal)
item.setAttribute(attr, attrVal);
}
if (node.localName == "menuitem")
item.classList.add("subviewbutton");
fragment.appendChild(item);
}
items.appendChild(fragment);
},
onViewHiding: function(aEvent) {
let doc = aEvent.target.ownerDocument;
let win = doc.defaultView;
let items = doc.getElementById("PanelUI-sidebarItems");
let parent = items.parentNode;
// We'll take the container out of the document before cleaning it out
// to avoid reflowing each time we remove something.
parent.removeChild(items);
while (items.firstChild) {
items.firstChild.remove();
}
parent.appendChild(items);
}
}, {
id: "add-ons-button", id: "add-ons-button",
shortcutId: "key_openAddons", shortcutId: "key_openAddons",
tooltiptext: "add-ons-button.tooltiptext2", tooltiptext: "add-ons-button.tooltiptext2",
@ -831,7 +900,7 @@ const CustomizableWidgets = [{
#ifdef XP_WIN #ifdef XP_WIN
#ifdef MOZ_METRO #ifdef MOZ_METRO
if (Services.sysinfo.getProperty("hasWindowsTouchInterface")) { if (Services.metro && Services.metro.supported) {
let widgetArgs = {tooltiptext: "switch-to-metro-button2.tooltiptext"}; let widgetArgs = {tooltiptext: "switch-to-metro-button2.tooltiptext"};
let brandShortName = BrandBundle.GetStringFromName("brandShortName"); let brandShortName = BrandBundle.GetStringFromName("brandShortName");
let metroTooltip = CustomizableUI.getLocalizedProperty(widgetArgs, "tooltiptext", let metroTooltip = CustomizableUI.getLocalizedProperty(widgetArgs, "tooltiptext",

View File

@ -491,7 +491,7 @@ CustomizeMode.prototype = {
deck.addEventListener("transitionend", customizeTransitionEnd); deck.addEventListener("transitionend", customizeTransitionEnd);
if (gDisableAnimation) { if (gDisableAnimation) {
deck.setAttribute("fastcustomizeanimation", true); this.document.getElementById("tab-view-deck").setAttribute("fastcustomizeanimation", true);
} }
if (aEntering) { if (aEntering) {
this.document.documentElement.setAttribute("customizing", true); this.document.documentElement.setAttribute("customizing", true);

View File

@ -69,4 +69,5 @@ skip-if = os == "linux"
[browser_969661_character_encoding_navbar_disabled.js] [browser_969661_character_encoding_navbar_disabled.js]
[browser_970511_undo_restore_default.js] [browser_970511_undo_restore_default.js]
[browser_972267_customizationchange_events.js] [browser_972267_customizationchange_events.js]
[browser_973932_addonbar_currentset.js]
[browser_panel_toggle.js] [browser_panel_toggle.js]

View File

@ -0,0 +1,30 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
let addonbarID = CustomizableUI.AREA_ADDONBAR;
let addonbar = document.getElementById(addonbarID);
// Check that currentset is correctly updated after a reset:
add_task(function() {
let placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements");
ok(CustomizableUI.inDefaultState, "Should be in default state");
info("Adding a spring to add-on bar shim");
CustomizableUI.addWidgetToArea("spring", addonbarID, 1);
ok(addonbar.getElementsByTagName("toolbarspring").length, "There should be a spring in the toolbar");
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state");
placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match placements after spring addition");
yield startCustomizing();
yield gCustomizeMode.reset();
ok(CustomizableUI.inDefaultState, "Should be in default state after reset");
placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements after reset");
ok(!addonbar.getElementsByTagName("toolbarspring").length, "There should be no spring in the toolbar");
yield endCustomizing();
});

View File

@ -1692,7 +1692,7 @@ BrowserGlue.prototype = {
}, },
}; };
if (Services.sysinfo.getProperty("hasWindowsTouchInterface")) { if (Services.metro && Services.metro.supported) {
smartBookmarks.Windows8Touch = { smartBookmarks.Windows8Touch = {
title: bundle.GetStringFromName("windows8TouchTitle"), title: bundle.GetStringFromName("windows8TouchTitle"),
uri: NetUtil.newURI("place:folder=" + uri: NetUtil.newURI("place:folder=" +

View File

@ -63,10 +63,10 @@ let (XULAppInfo = {
} }
// Smart bookmarks constants. // Smart bookmarks constants.
let isWin8OrHigher = Services.sysinfo.getProperty("hasWindowsTouchInterface"); let isMetroSupported = Services.metro && Services.metro.supported;
const SMART_BOOKMARKS_VERSION = 6 const SMART_BOOKMARKS_VERSION = 6
const SMART_BOOKMARKS_ON_TOOLBAR = 1; const SMART_BOOKMARKS_ON_TOOLBAR = 1;
const SMART_BOOKMARKS_ON_MENU = isWin8OrHigher ? 4 : 3; // Takes in count the additional separator. const SMART_BOOKMARKS_ON_MENU = isMetroSupported ? 4 : 3; // Takes in count the additional separator.
// Default bookmarks constants. // Default bookmarks constants.
const DEFAULT_BOOKMARKS_ON_TOOLBAR = 1; const DEFAULT_BOOKMARKS_ON_TOOLBAR = 1;

View File

@ -89,7 +89,6 @@ const FRAME_TYPE = {
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource://gre/modules/devtools/event-emitter.js"); Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/SimpleListWidget.jsm"); Cu.import("resource:///modules/devtools/SimpleListWidget.jsm");
Cu.import("resource:///modules/devtools/BreadcrumbsWidget.jsm"); Cu.import("resource:///modules/devtools/BreadcrumbsWidget.jsm");
@ -139,13 +138,6 @@ let DebuggerController = {
this.shutdownDebugger = this.shutdownDebugger.bind(this); this.shutdownDebugger = this.shutdownDebugger.bind(this);
this._onTabNavigated = this._onTabNavigated.bind(this); this._onTabNavigated = this._onTabNavigated.bind(this);
this._onTabDetached = this._onTabDetached.bind(this); this._onTabDetached = this._onTabDetached.bind(this);
// Chrome debugging lives in a different process and needs to handle
// debugger startup and shutdown by itself.
if (window._isChromeDebugger) {
window.addEventListener("DOMContentLoaded", this.startupDebugger, true);
window.addEventListener("unload", this.shutdownDebugger, true);
}
}, },
/** /**
@ -159,20 +151,7 @@ let DebuggerController = {
return this._startup; return this._startup;
} }
// Chrome debugging lives in a different process and needs to handle return this._startup = DebuggerView.initialize();
// debugger startup by itself.
if (window._isChromeDebugger) {
window.removeEventListener("DOMContentLoaded", this.startupDebugger, true);
}
return this._startup = DebuggerView.initialize().then(() => {
// Chrome debugging needs to initiate the connection by itself.
if (window._isChromeDebugger) {
return this.connect();
} else {
return promise.resolve(null); // Done.
}
});
}, },
/** /**
@ -186,12 +165,6 @@ let DebuggerController = {
return this._shutdown; return this._shutdown;
} }
// Chrome debugging lives in a different process and needs to handle
// debugger shutdown by itself.
if (window._isChromeDebugger) {
window.removeEventListener("unload", this.shutdownDebugger, true);
}
return this._shutdown = DebuggerView.destroy().then(() => { return this._shutdown = DebuggerView.destroy().then(() => {
DebuggerView.destroy(); DebuggerView.destroy();
this.SourceScripts.disconnect(); this.SourceScripts.disconnect();
@ -199,22 +172,12 @@ let DebuggerController = {
this.ThreadState.disconnect(); this.ThreadState.disconnect();
this.Tracer.disconnect(); this.Tracer.disconnect();
this.disconnect(); this.disconnect();
// Chrome debugging needs to close its parent process on shutdown.
if (window._isChromeDebugger) {
return this._quitApp();
} else {
return promise.resolve(null); // Done.
}
}); });
}, },
/** /**
* Initiates remote or chrome debugging based on the current target, * Initiates remote debugging based on the current target, wiring event
* wiring event handlers as necessary. * handlers as necessary.
*
* In case of a chrome debugger living in a different process, a socket
* connection pipe is opened as well.
* *
* @return object * @return object
* A promise that is resolved when the debugger finishes connecting. * A promise that is resolved when the debugger finishes connecting.
@ -227,9 +190,8 @@ let DebuggerController = {
let startedDebugging = promise.defer(); let startedDebugging = promise.defer();
this._connection = startedDebugging.promise; this._connection = startedDebugging.promise;
if (!window._isChromeDebugger) {
let target = this._target; let target = this._target;
let { client, form: { chromeDebugger, traceActor }, threadActor } = target; let { client, form: { chromeDebugger, traceActor } } = target;
target.on("close", this._onTabDetached); target.on("close", this._onTabDetached);
target.on("navigate", this._onTabNavigated); target.on("navigate", this._onTabNavigated);
target.on("will-navigate", this._onTabNavigated); target.on("will-navigate", this._onTabNavigated);
@ -249,22 +211,6 @@ let DebuggerController = {
return promise.all([startedDebugging.promise, startedTracing.promise]); return promise.all([startedDebugging.promise, startedTracing.promise]);
} }
return startedDebugging.promise;
}
// Chrome debugging needs to make its own connection to the debuggee.
let transport = debuggerSocketConnect(
Prefs.chromeDebuggingHost, Prefs.chromeDebuggingPort);
let client = this.client = new DebuggerClient(transport);
client.addListener("tabNavigated", this._onTabNavigated);
client.addListener("tabDetached", this._onTabDetached);
client.connect(() => {
client.listTabs(aResponse => {
this._startChromeDebugging(aResponse.chromeDebugger, startedDebugging.resolve);
});
});
return startedDebugging.promise; return startedDebugging.promise;
}, },
@ -277,15 +223,6 @@ let DebuggerController = {
return; return;
} }
// When debugging local or a remote instance, the connection is closed by
// the RemoteTarget. Chrome debugging needs to specifically close its own
// connection to the debuggee.
if (window._isChromeDebugger) {
this.client.removeListener("tabNavigated", this._onTabNavigated);
this.client.removeListener("tabDetached", this._onTabDetached);
this.client.close();
}
this._connection = null; this._connection = null;
this.client = null; this.client = null;
this.activeThread = null; this.activeThread = null;
@ -450,33 +387,6 @@ let DebuggerController = {
}); });
}, },
/**
* Attempts to quit the current process if allowed.
*
* @return object
* A promise that is resolved if the app will quit successfully.
*/
_quitApp: function() {
let deferred = promise.defer();
// Quitting the app is synchronous. Give the returned promise consumers
// a chance to do their thing before killing the process.
Services.tm.currentThread.dispatch({ run: () => {
let quit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(quit, "quit-application-requested", null);
// Somebody canceled our quit request.
if (quit.data) {
deferred.reject(quit.data);
} else {
deferred.resolve(quit.data);
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
}}, 0);
return deferred.promise;
},
_startup: null, _startup: null,
_shutdown: null, _shutdown: null,
_connection: null, _connection: null,
@ -2200,8 +2110,6 @@ let L10N = new ViewHelpers.L10N(DBG_STRINGS_URI);
* Shortcuts for accessing various debugger preferences. * Shortcuts for accessing various debugger preferences.
*/ */
let Prefs = new ViewHelpers.Prefs("devtools", { let Prefs = new ViewHelpers.Prefs("devtools", {
chromeDebuggingHost: ["Char", "debugger.chrome-debugging-host"],
chromeDebuggingPort: ["Int", "debugger.chrome-debugging-port"],
sourcesWidth: ["Int", "debugger.ui.panes-sources-width"], sourcesWidth: ["Int", "debugger.ui.panes-sources-width"],
instrumentsWidth: ["Int", "debugger.ui.panes-instruments-width"], instrumentsWidth: ["Int", "debugger.ui.panes-instruments-width"],
panesVisibleOnStartup: ["Bool", "debugger.ui.panes-visible-on-startup"], panesVisibleOnStartup: ["Bool", "debugger.ui.panes-visible-on-startup"],
@ -2217,15 +2125,6 @@ let Prefs = new ViewHelpers.Prefs("devtools", {
editorTabSize: ["Int", "editor.tabsize"] editorTabSize: ["Int", "editor.tabsize"]
}); });
/**
* Returns true if this is a chrome debugger instance.
* @return boolean
*/
XPCOMUtils.defineLazyGetter(window, "_isChromeDebugger", function() {
// We're inside a single top level XUL window in a different process.
return !(window.frameElement instanceof XULElement);
});
/** /**
* Convenient way of emitting events from the panel window. * Convenient way of emitting events from the panel window.
*/ */

View File

@ -613,6 +613,9 @@ StyleEditorUI.prototype = {
let label = summary.querySelector(".stylesheet-name > label"); let label = summary.querySelector(".stylesheet-name > label");
label.setAttribute("value", editor.friendlyName); label.setAttribute("value", editor.friendlyName);
if (editor.styleSheet.href) {
label.setAttribute("tooltiptext", editor.styleSheet.href);
}
let linkedCSSFile = ""; let linkedCSSFile = "";
if (editor.linkedCSSFile) { if (editor.linkedCSSFile) {

View File

@ -614,6 +614,7 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY findAgainCmd.accesskey "g"> <!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.commandkey "g"> <!ENTITY findAgainCmd.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3"> <!ENTITY findAgainCmd.commandkey2 "VK_F3">
<!ENTITY findSelectionCmd.commandkey "e">
<!ENTITY spellAddDictionaries.label "Add Dictionaries…"> <!ENTITY spellAddDictionaries.label "Add Dictionaries…">
<!ENTITY spellAddDictionaries.accesskey "A"> <!ENTITY spellAddDictionaries.accesskey "A">

View File

@ -29,6 +29,9 @@ developer-button.label = Developer
# LOCALIZATION NOTE(developer-button.tooltiptext): %S is the keyboard shortcut # LOCALIZATION NOTE(developer-button.tooltiptext): %S is the keyboard shortcut
developer-button.tooltiptext = Web Developer Tools (%S) developer-button.tooltiptext = Web Developer Tools (%S)
sidebar-button.label = Sidebars
sidebar-button.tooltiptext = Show Sidebars
add-ons-button.label = Add-ons add-ons-button.label = Add-ons
# LOCALIZATION NOTE(add-ons-button.tooltiptext2): %S is the keyboard shortcut # LOCALIZATION NOTE(add-ons-button.tooltiptext2): %S is the keyboard shortcut
add-ons-button.tooltiptext2 = Open Add-ons Manager (%S) add-ons-button.tooltiptext2 = Open Add-ons Manager (%S)

View File

@ -5,6 +5,7 @@
#include "CEHHelper.h" #include "CEHHelper.h"
#include <tlhelp32.h> #include <tlhelp32.h>
#include "mozilla/widget/MetroD3DCheckHelper.h"
#ifdef SHOW_CONSOLE #ifdef SHOW_CONSOLE
#include <io.h> // _open_osfhandle #include <io.h> // _open_osfhandle
@ -139,73 +140,9 @@ IsDX10Available()
if (GetDWORDRegKey(metroDX10Available, isDX10Available)) { if (GetDWORDRegKey(metroDX10Available, isDX10Available)) {
return isDX10Available; return isDX10Available;
} }
bool check = D3DFeatureLevelCheck();
HMODULE dxgiModule = LoadLibraryA("dxgi.dll"); SetDWORDRegKey(metroDX10Available, check);
if (!dxgiModule) { return check;
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
decltype(CreateDXGIFactory1)* createDXGIFactory1 =
(decltype(CreateDXGIFactory1)*) GetProcAddress(dxgiModule, "CreateDXGIFactory1");
if (!createDXGIFactory1) {
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
HMODULE d3d10module = LoadLibraryA("d3d10_1.dll");
if (!d3d10module) {
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
decltype(D3D10CreateDevice1)* createD3DDevice =
(decltype(D3D10CreateDevice1)*) GetProcAddress(d3d10module,
"D3D10CreateDevice1");
if (!createD3DDevice) {
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
CComPtr<IDXGIFactory1> factory1;
if (FAILED(createDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory1))) {
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
CComPtr<IDXGIAdapter1> adapter1;
if (FAILED(factory1->EnumAdapters1(0, &adapter1))) {
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
CComPtr<ID3D10Device1> device;
// Try for DX10.1
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
D3D10_FEATURE_LEVEL_10_1,
D3D10_1_SDK_VERSION, &device))) {
// Try for DX10
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
D3D10_FEATURE_LEVEL_10_0,
D3D10_1_SDK_VERSION, &device))) {
// Try for DX9.3 (we fall back to cairo and cairo has support for D3D 9.3)
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
D3D10_FEATURE_LEVEL_9_3,
D3D10_1_SDK_VERSION, &device))) {
SetDWORDRegKey(metroDX10Available, 0);
return false;
}
}
}
SetDWORDRegKey(metroDX10Available, 1);
return true;
} }
bool bool

View File

@ -9,15 +9,11 @@
#define _WIN32_WINNT 0x602 #define _WIN32_WINNT 0x602
#include <windows.h> #include <windows.h>
#include <d3d10_1.h>
#include <dxgi.h>
#include <d3d10misc.h>
#include <atlbase.h> #include <atlbase.h>
#include <shlobj.h> #include <shlobj.h>
//#define SHOW_CONSOLE 1 //#define SHOW_CONSOLE 1
extern HANDLE sCon; extern HANDLE sCon;
extern LPCWSTR metroDX10Available;
void Log(const wchar_t *fmt, ...); void Log(const wchar_t *fmt, ...);

View File

@ -765,6 +765,11 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
return E_FAIL; return E_FAIL;
} }
if (!IsDX10Available()) {
Log(L"Can't launch in metro due to missing hardware acceleration features.");
mRequestType = DESKTOP_RESTART;
}
// Deal with metro restart for an update - launch desktop with a command // Deal with metro restart for an update - launch desktop with a command
// that tells it to run updater then launch the metro browser. // that tells it to run updater then launch the metro browser.
if (mRequestType == METRO_UPDATE) { if (mRequestType == METRO_UPDATE) {

View File

@ -77,7 +77,7 @@ XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREA_PLACEMENTS", function() {
result["PanelUI-contents"].push("characterencoding-button"); result["PanelUI-contents"].push("characterencoding-button");
} }
if (Services.sysinfo.getProperty("hasWindowsTouchInterface")) { if (Services.metro && Services.metro.supported) {
result["PanelUI-contents"].push("switch-to-metro-button"); result["PanelUI-contents"].push("switch-to-metro-button");
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -678,6 +678,10 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
-moz-image-region: rect(18px, 666px, 36px, 648px); -moz-image-region: rect(18px, 666px, 36px, 648px);
} }
#sidebar-button@toolbarButtonPressed@ {
-moz-image-region: rect(18px, 684px, 36px, 666px);
}
/** /**
* OSX has a unique set of icons when fullscreen is in the checked state. * OSX has a unique set of icons when fullscreen is in the checked state.
*/ */
@ -1001,6 +1005,14 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
-moz-image-region: rect(36px, 1332px, 72px, 1296px); -moz-image-region: rect(36px, 1332px, 72px, 1296px);
} }
#sidebar-button[cui-areatype="toolbar"] {
-moz-image-region: rect(0, 1368px, 36px, 1332px);
}
#sidebar-button[cui-areatype="toolbar"]:hover:active:not([disabled="true"]) {
-moz-image-region: rect(36px, 1368px, 72px, 1332px);
}
:-moz-any(@primaryToolbarButtons@) > .toolbarbutton-icon, :-moz-any(@primaryToolbarButtons@) > .toolbarbutton-icon,
:-moz-any(@primaryToolbarButtons@) > .toolbarbutton-menubutton-button > .toolbarbutton-icon { :-moz-any(@primaryToolbarButtons@) > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
width: 18px; width: 18px;
@ -1134,6 +1146,11 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
-moz-image-region: rect(0px, 1600px, 64px, 1536px); -moz-image-region: rect(0px, 1600px, 64px, 1536px);
} }
#sidebar-button[cui-areatype="menu-panel"],
toolbarpaletteitem[place="palette"] > #sidebar-button {
-moz-image-region: rect(0px, 1664px, 64px, 1600px);
}
/* Footer and wide panel control icons */ /* Footer and wide panel control icons */
#edit-controls@inAnyPanel@ > toolbarbutton, #edit-controls@inAnyPanel@ > toolbarbutton,
#zoom-controls@inAnyPanel@ > toolbarbutton, #zoom-controls@inAnyPanel@ > toolbarbutton,
@ -4132,7 +4149,7 @@ window > chatbox {
#main-window[customize-entered] #tab-view-deck { #main-window[customize-entered] #tab-view-deck {
background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"), background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"),
url("chrome://browser/skin/customizableui/background-noise-toolbar.png"), url("chrome://browser/skin/customizableui/background-noise-toolbar.png"),
linear-gradient(to bottom, rgb(233,233,233), rgb(178,178,178) 21px); linear-gradient(to bottom, rgb(233,233,233), rgb(178,178,178) 40px);
background-attachment: fixed; background-attachment: fixed;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -1,4 +1,4 @@
%filter substitution %filter substitution
%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button %define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button, #sidebar-button
%define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]),.overflowedItem) %define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]),.overflowedItem)

View File

@ -126,6 +126,11 @@ toolbarpaletteitem[place="palette"] > #email-link-button {
-moz-image-region: rect(0, 800px, 32px, 768px); -moz-image-region: rect(0, 800px, 32px, 768px);
} }
#sidebar-button[cui-areatype="menu-panel"],
toolbarpaletteitem[place="palette"] > #sidebar-button {
-moz-image-region: rect(0, 832px, 32px, 800px);
}
/* Wide panel control icons */ /* Wide panel control icons */
#edit-controls@inAnyPanel@ > toolbarbutton, #edit-controls@inAnyPanel@ > toolbarbutton,

View File

@ -68,6 +68,10 @@
-moz-image-region: rect(0, 666px, 18px, 648px); -moz-image-region: rect(0, 666px, 18px, 648px);
} }
#sidebar-button[cui-areatype="toolbar"] {
-moz-image-region: rect(0, 684px, 18px, 666px);
}
#characterencoding-button[cui-areatype="toolbar"]{ #characterencoding-button[cui-areatype="toolbar"]{
-moz-image-region: rect(0, 324px, 18px, 306px); -moz-image-region: rect(0, 324px, 18px, 306px);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -533,7 +533,7 @@ class Automation(object):
# will otherwise lead to OOM conditions on the current test slaves. # will otherwise lead to OOM conditions on the current test slaves.
if totalMemory <= 1024 * 1024 * 4: if totalMemory <= 1024 * 1024 * 4:
self.log.info("INFO | automation.py | ASan running in low-memory configuration") self.log.info("INFO | automation.py | ASan running in low-memory configuration")
env["ASAN_OPTIONS"] = "quarantine_size=50331648" env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5"
else: else:
self.log.info("INFO | automation.py | ASan running in default memory configuration") self.log.info("INFO | automation.py | ASan running in default memory configuration")
except OSError,err: except OSError,err:

View File

@ -479,7 +479,7 @@ def environment(xrePath, env=None, crashreporter=True, debugger=False, dmdPath=N
message = "INFO | runtests.py | ASan running in %s configuration" message = "INFO | runtests.py | ASan running in %s configuration"
if totalMemory <= 1024 * 1024 * 4: if totalMemory <= 1024 * 1024 * 4:
message = message % 'low-memory' message = message % 'low-memory'
env["ASAN_OPTIONS"] = "quarantine_size=50331648" env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5"
else: else:
message = message % 'default memory' message = message % 'default memory'
except OSError,err: except OSError,err:

View File

@ -32,7 +32,6 @@ class nsCSSStyleSheet;
class nsIDocShell; class nsIDocShell;
class nsDocShell; class nsDocShell;
class nsDOMNavigationTiming; class nsDOMNavigationTiming;
class nsDOMTouchList;
class nsEventStates; class nsEventStates;
class nsFrameLoader; class nsFrameLoader;
class nsHTMLCSSStyleSheet; class nsHTMLCSSStyleSheet;
@ -113,6 +112,7 @@ class NodeFilter;
class NodeIterator; class NodeIterator;
class ProcessingInstruction; class ProcessingInstruction;
class Touch; class Touch;
class TouchList;
class TreeWalker; class TreeWalker;
class UndoManager; class UndoManager;
class XPathEvaluator; class XPathEvaluator;
@ -2200,11 +2200,11 @@ public:
int32_t aScreenX, int32_t aScreenY, int32_t aClientX, int32_t aScreenX, int32_t aScreenY, int32_t aClientX,
int32_t aClientY, int32_t aRadiusX, int32_t aRadiusY, int32_t aClientY, int32_t aRadiusX, int32_t aRadiusY,
float aRotationAngle, float aForce); float aRotationAngle, float aForce);
already_AddRefed<nsDOMTouchList> CreateTouchList(); already_AddRefed<mozilla::dom::TouchList> CreateTouchList();
already_AddRefed<nsDOMTouchList> already_AddRefed<mozilla::dom::TouchList>
CreateTouchList(mozilla::dom::Touch& aTouch, CreateTouchList(mozilla::dom::Touch& aTouch,
const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches); const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
already_AddRefed<nsDOMTouchList> already_AddRefed<mozilla::dom::TouchList>
CreateTouchList(const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches); CreateTouchList(const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
void SetStyleSheetChangeEventsEnabled(bool aValue) void SetStyleSheetChangeEventsEnabled(bool aValue)

View File

@ -39,6 +39,7 @@
#include "mozilla/dom/HTMLTemplateElement.h" #include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/HTMLContentElement.h" #include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/TextDecoder.h" #include "mozilla/dom/TextDecoder.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/ShadowRoot.h"
#include "mozilla/InternalMutationEvent.h" #include "mozilla/InternalMutationEvent.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
@ -70,7 +71,6 @@
#include "mozilla/dom/DataTransfer.h" #include "mozilla/dom/DataTransfer.h"
#include "nsDOMJSUtils.h" #include "nsDOMJSUtils.h"
#include "nsDOMMutationObserver.h" #include "nsDOMMutationObserver.h"
#include "nsDOMTouchEvent.h"
#include "nsError.h" #include "nsError.h"
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsEventListenerManager.h" #include "nsEventListenerManager.h"

View File

@ -179,8 +179,8 @@
#include "mozilla/dom/HTMLElementBinding.h" #include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/SVGElementBinding.h" #include "mozilla/dom/SVGElementBinding.h"
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
#include "nsDOMTouchEvent.h"
#include "mozilla/dom/Touch.h" #include "mozilla/dom/Touch.h"
#include "mozilla/dom/TouchEvent.h"
#include "DictionaryHelpers.h" #include "DictionaryHelpers.h"
#include "GeneratedEvents.h" #include "GeneratedEvents.h"
@ -10013,18 +10013,18 @@ nsIDocument::CreateTouch(nsIDOMWindow* aView,
return touch.forget(); return touch.forget();
} }
already_AddRefed<nsDOMTouchList> already_AddRefed<TouchList>
nsIDocument::CreateTouchList() nsIDocument::CreateTouchList()
{ {
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this)); nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
return retval.forget(); return retval.forget();
} }
already_AddRefed<nsDOMTouchList> already_AddRefed<TouchList>
nsIDocument::CreateTouchList(Touch& aTouch, nsIDocument::CreateTouchList(Touch& aTouch,
const Sequence<OwningNonNull<Touch> >& aTouches) const Sequence<OwningNonNull<Touch> >& aTouches)
{ {
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this)); nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
retval->Append(&aTouch); retval->Append(&aTouch);
for (uint32_t i = 0; i < aTouches.Length(); ++i) { for (uint32_t i = 0; i < aTouches.Length(); ++i) {
retval->Append(aTouches[i].get()); retval->Append(aTouches[i].get());
@ -10032,10 +10032,10 @@ nsIDocument::CreateTouchList(Touch& aTouch,
return retval.forget(); return retval.forget();
} }
already_AddRefed<nsDOMTouchList> already_AddRefed<TouchList>
nsIDocument::CreateTouchList(const Sequence<OwningNonNull<Touch> >& aTouches) nsIDocument::CreateTouchList(const Sequence<OwningNonNull<Touch> >& aTouches)
{ {
nsRefPtr<nsDOMTouchList> retval = new nsDOMTouchList(ToSupports(this)); nsRefPtr<TouchList> retval = new TouchList(ToSupports(this));
for (uint32_t i = 0; i < aTouches.Length(); ++i) { for (uint32_t i = 0; i < aTouches.Length(); ++i) {
retval->Append(aTouches[i].get()); retval->Append(aTouches[i].get());
} }

View File

@ -97,9 +97,9 @@
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsTextFragment.h" #include "nsTextFragment.h"
#include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"
#include "nsHTMLDocument.h" #include "nsHTMLDocument.h"
#include "nsDOMTouchEvent.h"
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "mozilla/dom/HTMLBodyElement.h" #include "mozilla/dom/HTMLBodyElement.h"
#include "imgIContainer.h" #include "imgIContainer.h"
@ -1955,7 +1955,7 @@ nsGenericHTMLElement::SetUndoScopeInternal(bool aUndoScope)
bool bool
nsGenericHTMLElement::TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */) nsGenericHTMLElement::TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */)
{ {
return nsDOMTouchEvent::PrefEnabled(); return TouchEvent::PrefEnabled();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -268,7 +268,7 @@ protected:
TrackTicks aStart, TrackTicks aEnd) TrackTicks aStart, TrackTicks aEnd)
{ {
NS_ASSERTION(aStart <= aEnd, "Endpoints inverted"); NS_ASSERTION(aStart <= aEnd, "Endpoints inverted");
NS_ASSERTION(aStart >= 0 && aEnd <= aSource.mDuration, NS_WARN_IF_FALSE(aStart >= 0 && aEnd <= aSource.mDuration,
"Slice out of range"); "Slice out of range");
mDuration += aEnd - aStart; mDuration += aEnd - aStart;
TrackTicks offset = 0; TrackTicks offset = 0;

View File

@ -1239,7 +1239,7 @@ MediaStreamGraphImpl::RunThread()
} else { } else {
ps->ProduceOutput(prevComputedTime, mStateComputedTime, ps->ProduceOutput(prevComputedTime, mStateComputedTime,
ProcessedMediaStream::ALLOW_FINISH); ProcessedMediaStream::ALLOW_FINISH);
NS_ASSERTION(stream->mBuffer.GetEnd() >= NS_WARN_IF_FALSE(stream->mBuffer.GetEnd() >=
GraphTimeToStreamTime(stream, mStateComputedTime), GraphTimeToStreamTime(stream, mStateComputedTime),
"Stream did not produce enough data"); "Stream did not produce enough data");
} }

View File

@ -63,7 +63,7 @@ inline StreamTime TicksToTimeRound(TrackRate aRate, TrackTicks aTicks)
inline StreamTime TicksToTimeRoundDown(TrackRate aRate, TrackTicks aTicks) inline StreamTime TicksToTimeRoundDown(TrackRate aRate, TrackTicks aTicks)
{ {
NS_ASSERTION(0 < aRate && aRate <= TRACK_RATE_MAX, "Bad rate"); NS_ASSERTION(0 < aRate && aRate <= TRACK_RATE_MAX, "Bad rate");
NS_ASSERTION(0 <= aTicks && aTicks <= TRACK_TICKS_MAX, "Bad samples"); NS_WARN_IF_FALSE(0 <= aTicks && aTicks <= TRACK_TICKS_MAX, "Bad samples");
return (aTicks << MEDIA_TIME_FRAC_BITS)/aRate; return (aTicks << MEDIA_TIME_FRAC_BITS)/aRate;
} }

View File

@ -249,7 +249,7 @@ protected:
StreamTime outputEnd = GraphTimeToStreamTime(interval.mEnd); StreamTime outputEnd = GraphTimeToStreamTime(interval.mEnd);
TrackTicks startTicks = outputTrack->GetEnd(); TrackTicks startTicks = outputTrack->GetEnd();
StreamTime outputStart = GraphTimeToStreamTime(interval.mStart); StreamTime outputStart = GraphTimeToStreamTime(interval.mStart);
NS_ASSERTION(startTicks == TimeToTicksRoundUp(rate, outputStart), NS_WARN_IF_FALSE(startTicks == TimeToTicksRoundUp(rate, outputStart),
"Samples missing"); "Samples missing");
TrackTicks endTicks = TimeToTicksRoundUp(rate, outputEnd); TrackTicks endTicks = TimeToTicksRoundUp(rate, outputEnd);
TrackTicks ticks = endTicks - startTicks; TrackTicks ticks = endTicks - startTicks;

View File

@ -20,7 +20,7 @@ namespace dom {
SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner, SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetGUIEvent* aEvent) WidgetGUIEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, : UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetGUIEvent(false, NS_SVG_ZOOM, 0)) aEvent ? aEvent : new WidgetGUIEvent(false, NS_SVG_ZOOM, 0))
, mPreviousScale(0) , mPreviousScale(0)
, mNewScale(0) , mNewScale(0)

View File

@ -6,11 +6,11 @@
#ifndef mozilla_dom_SVGZoomEvent_h #ifndef mozilla_dom_SVGZoomEvent_h
#define mozilla_dom_SVGZoomEvent_h #define mozilla_dom_SVGZoomEvent_h
#include "nsAutoPtr.h"
#include "nsDOMUIEvent.h"
#include "DOMSVGPoint.h" #include "DOMSVGPoint.h"
#include "mozilla/EventForwards.h" #include "mozilla/dom/UIEvent.h"
#include "mozilla/dom/SVGZoomEventBinding.h" #include "mozilla/dom/SVGZoomEventBinding.h"
#include "mozilla/EventForwards.h"
#include "nsAutoPtr.h"
class nsPresContext; class nsPresContext;
@ -20,14 +20,14 @@ class nsISVGPoint;
namespace dom { namespace dom {
class SVGZoomEvent MOZ_FINAL : public nsDOMUIEvent class SVGZoomEvent MOZ_FINAL : public UIEvent
{ {
public: public:
SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext, SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext,
WidgetGUIEvent* aEvent); WidgetGUIEvent* aEvent);
// Forward to base class // Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -136,7 +136,7 @@
#include "nsIEventListenerService.h" #include "nsIEventListenerService.h"
#include "nsIMessageManager.h" #include "nsIMessageManager.h"
#include "nsDOMTouchEvent.h" #include "mozilla/dom/TouchEvent.h"
#include "nsWrapperCacheInlines.h" #include "nsWrapperCacheInlines.h"
#include "mozilla/dom/HTMLCollectionBinding.h" #include "mozilla/dom/HTMLCollectionBinding.h"
@ -868,7 +868,7 @@ nsDOMClassInfo::RegisterExternalClasses()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) \
DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) \ DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) \
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \ DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
nsDOMTouchEvent::PrefEnabled()) TouchEvent::PrefEnabled())
#else // !MOZ_B2G #else // !MOZ_B2G
#define DOM_CLASSINFO_WINDOW_MAP_ENTRIES \ #define DOM_CLASSINFO_WINDOW_MAP_ENTRIES \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) \
@ -878,7 +878,7 @@ nsDOMClassInfo::RegisterExternalClasses()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) \ DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance) \
DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) \ DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor) \
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \ DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
nsDOMTouchEvent::PrefEnabled()) TouchEvent::PrefEnabled())
#endif // MOZ_B2G #endif // MOZ_B2G
nsresult nsresult

View File

@ -64,7 +64,8 @@ DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \
/* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \ /* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent, \ DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent, \
nsDOMEventBase, 10, _extra) \ nsDOMEventBase, 10, _extra) \
DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra) \ DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::UIEvent, \
nsDOMEventBase, 11, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra) DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES // Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
@ -79,6 +80,7 @@ namespace dom {
class Element; class Element;
class EventTarget; class EventTarget;
class MouseEvent; class MouseEvent;
class UIEvent;
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

View File

@ -721,19 +721,8 @@ static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal"; static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency"; static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
#endif #endif
static const char js_typeinfer_content_str[] = JS_OPTIONS_DOT_STR "typeinference.content";
static const char js_typeinfer_chrome_str[] = JS_OPTIONS_DOT_STR "typeinference.chrome";
static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log"; static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log";
static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify"; static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify";
static const char js_asmjs_content_str[] = JS_OPTIONS_DOT_STR "asmjs";
static const char js_baselinejit_content_str[] = JS_OPTIONS_DOT_STR "baselinejit.content";
static const char js_baselinejit_chrome_str[] = JS_OPTIONS_DOT_STR "baselinejit.chrome";
static const char js_baselinejit_eager_str[] = JS_OPTIONS_DOT_STR "baselinejit.unsafe_eager_compilation";
static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content";
static const char js_ion_chrome_str[] = JS_OPTIONS_DOT_STR "ion.chrome";
static const char js_ion_eager_str[] = JS_OPTIONS_DOT_STR "ion.unsafe_eager_compilation";
static const char js_parallel_parsing_str[] = JS_OPTIONS_DOT_STR "parallel_parsing";
static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation";
void void
nsJSContext::JSOptionChangedCallback(const char *pref, void *data) nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
@ -756,39 +745,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
nsCOMPtr<nsIDOMWindow> contentWindow(do_QueryInterface(global)); nsCOMPtr<nsIDOMWindow> contentWindow(do_QueryInterface(global));
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global)); nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
bool useTypeInference = Preferences::GetBool((chromeWindow || !contentWindow) ?
js_typeinfer_chrome_str :
js_typeinfer_content_str);
bool useBaselineJIT = Preferences::GetBool((chromeWindow || !contentWindow) ?
js_baselinejit_chrome_str :
js_baselinejit_content_str);
bool useBaselineJITEager = Preferences::GetBool(js_baselinejit_eager_str);
bool useIon = Preferences::GetBool((chromeWindow || !contentWindow) ?
js_ion_chrome_str :
js_ion_content_str);
bool useIonEager = Preferences::GetBool(js_ion_eager_str);
bool useAsmJS = Preferences::GetBool(js_asmjs_content_str);
bool parallelParsing = Preferences::GetBool(js_parallel_parsing_str);
bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
bool safeMode = false;
xr->GetInSafeMode(&safeMode);
if (safeMode) {
useTypeInference = false;
useBaselineJIT = false;
useBaselineJITEager = false;
useIon = false;
useIonEager = false;
useAsmJS = false;
}
}
JS::ContextOptionsRef(cx).setTypeInference(useTypeInference)
.setBaseline(useBaselineJIT)
.setIon(useIon)
.setAsmJS(useAsmJS);
#ifdef DEBUG #ifdef DEBUG
// In debug builds, warnings are enabled in chrome context if // In debug builds, warnings are enabled in chrome context if
// javascript.options.strict.debug is true // javascript.options.strict.debug is true
@ -800,15 +756,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
JS::ContextOptionsRef(cx).setWerror(Preferences::GetBool(js_werror_option_str)); JS::ContextOptionsRef(cx).setWerror(Preferences::GetBool(js_werror_option_str));
::JS_SetParallelParsingEnabled(context->mContext, parallelParsing);
::JS_SetParallelIonCompilationEnabled(context->mContext, parallelIonCompilation);
::JS_SetGlobalJitCompilerOption(context->mContext, JSJITCOMPILER_BASELINE_USECOUNT_TRIGGER,
(useBaselineJITEager ? 0 : -1));
::JS_SetGlobalJitCompilerOption(context->mContext, JSJITCOMPILER_ION_USECOUNT_TRIGGER,
(useIonEager ? 0 : -1));
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
int32_t zeal = Preferences::GetInt(js_zeal_option_str, -1); int32_t zeal = Preferences::GetInt(js_zeal_option_str, -1);
int32_t frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ); int32_t frequency = Preferences::GetInt(js_zeal_frequency_str, JS_DEFAULT_ZEAL_FREQ);

View File

@ -340,10 +340,11 @@ public:
// keep the same document active but create a new window. // keep the same document active but create a new window.
bool HasActiveDocument() bool HasActiveDocument()
{ {
MOZ_ASSERT(IsInnerWindow());
return IsCurrentInnerWindow() || return IsCurrentInnerWindow() ||
(GetOuterWindow() && (mOuterWindow &&
GetOuterWindow()->GetCurrentInnerWindow() && mOuterWindow->GetCurrentInnerWindow() &&
GetOuterWindow()->GetCurrentInnerWindow()->GetDoc() == mDoc); mOuterWindow->GetCurrentInnerWindow()->GetDoc() == mDoc);
} }
bool IsOuterWindow() const bool IsOuterWindow() const

View File

@ -222,64 +222,6 @@ nsScreen::GetLockOrientationPermission() const
return doc->MozFullScreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED; return doc->MozFullScreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
} }
NS_IMETHODIMP
nsScreen::MozLockOrientation(JS::Handle<JS::Value> aOrientation, JSContext* aCx,
bool* aReturn)
{
if (aOrientation.isObject()) {
JS::Rooted<JSObject*> seq(aCx, &aOrientation.toObject());
if (IsArrayLike(aCx, seq)) {
uint32_t length;
// JS_GetArrayLength actually works on all objects
if (!JS_GetArrayLength(aCx, seq, &length)) {
return NS_ERROR_FAILURE;
}
Sequence<nsString> orientations;
if (!orientations.SetCapacity(length)) {
return NS_ERROR_OUT_OF_MEMORY;
}
for (uint32_t i = 0; i < length; ++i) {
JS::Rooted<JS::Value> temp(aCx);
if (!JS_GetElement(aCx, seq, i, &temp)) {
return NS_ERROR_FAILURE;
}
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, temp));
if (!jsString) {
return NS_ERROR_FAILURE;
}
nsDependentJSString str;
if (!str.init(aCx, jsString)) {
return NS_ERROR_FAILURE;
}
*orientations.AppendElement() = str;
}
ErrorResult rv;
*aReturn = MozLockOrientation(orientations, rv);
return rv.ErrorCode();
}
}
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, aOrientation));
if (!jsString) {
return NS_ERROR_FAILURE;
}
nsDependentJSString orientation;
if (!orientation.init(aCx, jsString)) {
return NS_ERROR_FAILURE;
}
ErrorResult rv;
*aReturn = MozLockOrientation(orientation, rv);
return rv.ErrorCode();
}
bool bool
nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv) nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv)
{ {
@ -365,13 +307,6 @@ nsScreen::MozUnlockOrientation()
hal::UnlockScreenOrientation(); hal::UnlockScreenOrientation();
} }
NS_IMETHODIMP
nsScreen::SlowMozUnlockOrientation()
{
MozUnlockOrientation();
return NS_OK;
}
bool bool
nsScreen::IsDeviceSizePageSize() nsScreen::IsDeviceSizePageSize()
{ {

View File

@ -263,12 +263,6 @@ IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> obj)
return !JS_ObjectIsDate(cx, obj) && !JS_ObjectIsRegExp(cx, obj); return !JS_ObjectIsDate(cx, obj) && !JS_ObjectIsRegExp(cx, obj);
} }
MOZ_ALWAYS_INLINE bool
IsArrayLike(JSContext* cx, JS::Handle<JSObject*> obj)
{
return IsNotDateOrRegExp(cx, obj);
}
MOZ_ALWAYS_INLINE bool MOZ_ALWAYS_INLINE bool
IsObjectValueConvertibleToDictionary(JSContext* cx, IsObjectValueConvertibleToDictionary(JSContext* cx,
JS::Handle<JS::Value> objVal) JS::Handle<JS::Value> objVal)

View File

@ -97,10 +97,6 @@ DOMInterfaces = {
'concrete': False 'concrete': False
}, },
'AnimationEvent': {
'nativeType': 'mozilla::dom::AnimationEvent',
},
'ArchiveReader': { 'ArchiveReader': {
'nativeType': 'mozilla::dom::file::ArchiveReader', 'nativeType': 'mozilla::dom::file::ArchiveReader',
}, },
@ -140,10 +136,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'inputBuffer', 'outputBuffer' ], 'resultNotAddRefed': [ 'inputBuffer', 'outputBuffer' ],
}, },
'BeforeUnloadEvent': {
'nativeType': 'mozilla::dom::BeforeUnloadEvent',
},
'BarProp': { 'BarProp': {
'headerFile': 'mozilla/dom/BarProps.h', 'headerFile': 'mozilla/dom/BarProps.h',
}, },
@ -233,18 +225,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'item' ] 'resultNotAddRefed': [ 'item' ]
}, },
'ClipboardEvent': {
'nativeType': 'mozilla::dom::ClipboardEvent',
},
'CommandEvent': {
'nativeType': 'mozilla::dom::CommandEvent',
},
'CompositionEvent': {
'nativeType': 'mozilla::dom::CompositionEvent',
},
'Console': { 'Console': {
'implicitJSContext': [ 'trace', 'time', 'timeEnd' ], 'implicitJSContext': [ 'trace', 'time', 'timeEnd' ],
}, },
@ -303,10 +283,6 @@ DOMInterfaces = {
'nativeType': 'nsDOMDataChannel', 'nativeType': 'nsDOMDataChannel',
}, },
'DataContainerEvent': {
'nativeType': 'mozilla::dom::DataContainerEvent',
},
'DedicatedWorkerGlobalScope': { 'DedicatedWorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h', 'headerFile': 'mozilla/dom/WorkerScope.h',
'workers': True, 'workers': True,
@ -852,14 +828,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'item' ] 'resultNotAddRefed': [ 'item' ]
}, },
'NotifyPaintEvent': {
'nativeType': 'nsDOMNotifyPaintEvent',
},
'NotifyAudioAvailableEvent': {
'nativeType': 'nsDOMNotifyAudioAvailableEvent',
},
'OfflineAudioCompletionEvent': { 'OfflineAudioCompletionEvent': {
'resultNotAddRefed': [ 'renderedBuffer' ], 'resultNotAddRefed': [ 'renderedBuffer' ],
}, },
@ -958,10 +926,6 @@ DOMInterfaces = {
'nativeType': 'nsScreen', 'nativeType': 'nsScreen',
}, },
'ScrollAreaEvent': {
'nativeType': 'nsDOMScrollAreaEvent',
},
'Selection': { 'Selection': {
'nativeType': 'mozilla::Selection', 'nativeType': 'mozilla::Selection',
'resultNotAddRefed': [ 'anchorNode', 'focusNode', 'getRangeAt' ], 'resultNotAddRefed': [ 'anchorNode', 'focusNode', 'getRangeAt' ],
@ -1247,25 +1211,12 @@ DOMInterfaces = {
'nativeOwnership': 'owned', 'nativeOwnership': 'owned',
}, },
'TimeEvent': {
'nativeType': 'nsDOMTimeEvent',
},
'TimeRanges': { 'TimeRanges': {
'wrapperCache': False 'wrapperCache': False
}, },
'TouchEvent': {
'nativeType': 'nsDOMTouchEvent',
},
'TouchList': { 'TouchList': {
'nativeType': 'nsDOMTouchList', 'headerFile': 'mozilla/dom/TouchEvent.h',
'headerFile': 'nsDOMTouchEvent.h',
},
'TransitionEvent': {
'nativeType': 'nsDOMTransitionEvent',
}, },
'TreeColumns': { 'TreeColumns': {
@ -1277,10 +1228,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'root', 'currentNode' ], 'resultNotAddRefed': [ 'root', 'currentNode' ],
}, },
'UIEvent': {
'nativeType': 'nsDOMUIEvent',
},
'UndoManager': { 'UndoManager': {
'implicitJSContext' : [ 'undo', 'redo', 'transact' ], 'implicitJSContext' : [ 'undo', 'redo', 'transact' ],
}, },
@ -1478,10 +1425,6 @@ DOMInterfaces = {
'headerFile': 'WebSocket.h', 'headerFile': 'WebSocket.h',
}, },
'WheelEvent': {
'nativeType': 'mozilla::dom::WheelEvent',
},
'Window': { 'Window': {
'nativeType': 'nsGlobalWindow', 'nativeType': 'nsGlobalWindow',
# When turning on Window, remember to drop the "'register': False" # When turning on Window, remember to drop the "'register': False"
@ -1579,10 +1522,6 @@ DOMInterfaces = {
'headerFile': 'XULDocument.h' 'headerFile': 'XULDocument.h'
}, },
'XULCommandEvent': {
'nativeType': 'nsDOMXULCommandEvent',
},
'XULElement': { 'XULElement': {
'nativeType': 'nsXULElement', 'nativeType': 'nsXULElement',
'resultNotAddRefed': [ 'controllers', 'style' ] 'resultNotAddRefed': [ 'controllers', 'style' ]

View File

@ -3105,31 +3105,35 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
arrayRef = "${declName}" arrayRef = "${declName}"
# NOTE: Keep this in sync with variadic conversions as needed # NOTE: Keep this in sync with variadic conversions as needed
templateBody = ("""JS::Rooted<JSObject*> seq(cx, &${val}.toObject());\n templateBody = ("""JS::ForOfIterator iter(cx);
if (!IsArrayLike(cx, seq)) { if (!iter.init(${val}, JS::ForOfIterator::AllowNonIterable)) {
%s %s
} }
uint32_t length; if (!iter.valueIsIterable()) {
// JS_GetArrayLength actually works on all objects
if (!JS_GetArrayLength(cx, seq, &length)) {
%s %s
} }
%s &arr = %s; %s &arr = %s;
if (!arr.SetCapacity(length)) { JS::Rooted<JS::Value> temp(cx);
while (true) {
bool done;
if (!iter.next(&temp, &done)) {
%s
}
if (done) {
break;
}
%s* slotPtr = arr.AppendElement();
if (!slotPtr) {
JS_ReportOutOfMemory(cx); JS_ReportOutOfMemory(cx);
%s %s
} }
for (uint32_t i = 0; i < length; ++i) { %s& slot = *slotPtr;
JS::Rooted<JS::Value> temp(cx); """ % (exceptionCodeIndented.define(),
if (!JS_GetElement(cx, seq, i, &temp)) { CGIndenter(CGGeneric(notSequence)).define(),
%s
}
%s& slot = *arr.AppendElement();
""" % (CGIndenter(CGGeneric(notSequence)).define(),
exceptionCodeIndented.define(),
sequenceType, sequenceType,
arrayRef, arrayRef,
exceptionCodeIndented.define(), CGIndenter(exceptionCodeIndented).define(),
elementInfo.declType.define(),
CGIndenter(exceptionCodeIndented).define(), CGIndenter(exceptionCodeIndented).define(),
elementInfo.declType.define())) elementInfo.declType.define()))
@ -3196,12 +3200,7 @@ for (uint32_t i = 0; i < length; ++i) {
arrayObjectMemberTypes = filter(lambda t: t.isArray() or t.isSequence(), memberTypes) arrayObjectMemberTypes = filter(lambda t: t.isArray() or t.isSequence(), memberTypes)
if len(arrayObjectMemberTypes) > 0: if len(arrayObjectMemberTypes) > 0:
assert len(arrayObjectMemberTypes) == 1 raise TypeError("Bug 767924: We don't support sequences in unions yet")
memberType = arrayObjectMemberTypes[0]
name = memberType.name
arrayObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${val}, ${mutableVal}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, argObj)")
names.append(name)
else: else:
arrayObject = None arrayObject = None

View File

@ -36,7 +36,6 @@ using namespace mozilla::dom;
using namespace mozilla::idl; using namespace mozilla::idl;
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaStream) NS_INTERFACE_MAP_ENTRY(nsIDOMMediaStream)
NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream) NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
@ -44,53 +43,25 @@ NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
NS_IMPL_ADDREF_INHERITED(nsDOMCameraControl, DOMMediaStream) NS_IMPL_ADDREF_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_IMPL_RELEASE_INHERITED(nsDOMCameraControl, DOMMediaStream) NS_IMPL_RELEASE_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMCameraControl) NS_IMPL_CYCLE_COLLECTION_INHERITED_18(nsDOMCameraControl, DOMMediaStream,
mCapabilities,
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMCameraControl, DOMMediaStream) mWindow,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCapabilities) mGetCameraOnSuccessCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow) mGetCameraOnErrorCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGetCameraOnSuccessCb) mAutoFocusOnSuccessCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGetCameraOnErrorCb) mAutoFocusOnErrorCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAutoFocusOnSuccessCb) mTakePictureOnSuccessCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAutoFocusOnErrorCb) mTakePictureOnErrorCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTakePictureOnSuccessCb) mStartRecordingOnSuccessCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTakePictureOnErrorCb) mStartRecordingOnErrorCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStartRecordingOnSuccessCb) mReleaseOnSuccessCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStartRecordingOnErrorCb) mReleaseOnErrorCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReleaseOnSuccessCb) mSetConfigurationOnSuccessCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReleaseOnErrorCb) mSetConfigurationOnErrorCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSetConfigurationOnSuccessCb) mOnShutterCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSetConfigurationOnErrorCb) mOnClosedCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnShutterCb) mOnRecorderStateChangeCb,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnClosedCb) mOnPreviewStateChangeCb)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnRecorderStateChangeCb)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOnPreviewStateChangeCb)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCapabilities)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGetCameraOnSuccessCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGetCameraOnErrorCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAutoFocusOnSuccessCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAutoFocusOnErrorCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTakePictureOnSuccessCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTakePictureOnErrorCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStartRecordingOnSuccessCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStartRecordingOnErrorCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReleaseOnSuccessCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReleaseOnErrorCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSetConfigurationOnSuccessCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSetConfigurationOnErrorCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnShutterCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnClosedCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnRecorderStateChangeCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnPreviewStateChangeCb)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsDOMCameraControl)
class mozilla::StartRecordingHelper : public nsIDOMEventListener class mozilla::StartRecordingHelper : public nsIDOMEventListener
{ {

View File

@ -37,7 +37,7 @@ class StartRecordingHelper;
class nsDOMCameraControl MOZ_FINAL : public DOMMediaStream class nsDOMCameraControl MOZ_FINAL : public DOMMediaStream
{ {
public: public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
nsDOMCameraControl(uint32_t aCameraId, nsDOMCameraControl(uint32_t aCameraId,

View File

@ -681,12 +681,15 @@ var steps = [
req.onerror = onFailure; req.onerror = onFailure;
}, },
function() { function() {
ok(true, "Test setting array properties to scalar values") ok(true, "Test that after setting array properties to scalar values the property os not a non-array")
const FIELDS = ["email","url","adr","tel","impp"]; const FIELDS = ["email","url","adr","tel","impp"];
createResult1 = new mozContact(); createResult1 = new mozContact();
for (var prop of FIELDS) { for (var prop of FIELDS) {
try {
createResult1[prop] = {type: ["foo"]}; createResult1[prop] = {type: ["foo"]};
ok(Array.isArray(createResult1[prop]), prop + " is array"); } catch (e) {}
ok(createResult1[prop] === null ||
Array.isArray(createResult1[prop]), prop + " is array");
} }
next(); next();
}, },

View File

@ -14,8 +14,8 @@ namespace dom {
CompositionEvent::CompositionEvent(EventTarget* aOwner, CompositionEvent::CompositionEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetCompositionEvent* aEvent) WidgetCompositionEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent : : UIEvent(aOwner, aPresContext,
new WidgetCompositionEvent(false, 0, nullptr)) aEvent ? aEvent : new WidgetCompositionEvent(false, 0, nullptr))
{ {
NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT, NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
"event type mismatch"); "event type mismatch");
@ -36,12 +36,12 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
// TODO: Native event should have locale information. // TODO: Native event should have locale information.
} }
NS_IMPL_ADDREF_INHERITED(CompositionEvent, nsDOMUIEvent) NS_IMPL_ADDREF_INHERITED(CompositionEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(CompositionEvent, nsDOMUIEvent) NS_IMPL_RELEASE_INHERITED(CompositionEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(CompositionEvent) NS_INTERFACE_MAP_BEGIN(CompositionEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_IMETHODIMP NS_IMETHODIMP
CompositionEvent::GetData(nsAString& aData) CompositionEvent::GetData(nsAString& aData)
@ -65,8 +65,7 @@ CompositionEvent::InitCompositionEvent(const nsAString& aType,
const nsAString& aData, const nsAString& aData,
const nsAString& aLocale) const nsAString& aLocale)
{ {
nsresult rv = nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mData = aData; mData = aData;

View File

@ -7,15 +7,15 @@
#ifndef mozilla_dom_CompositionEvent_h_ #ifndef mozilla_dom_CompositionEvent_h_
#define mozilla_dom_CompositionEvent_h_ #define mozilla_dom_CompositionEvent_h_
#include "nsDOMUIEvent.h"
#include "nsIDOMCompositionEvent.h"
#include "mozilla/dom/CompositionEventBinding.h" #include "mozilla/dom/CompositionEventBinding.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "nsIDOMCompositionEvent.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class CompositionEvent : public nsDOMUIEvent, class CompositionEvent : public UIEvent,
public nsIDOMCompositionEvent public nsIDOMCompositionEvent
{ {
public: public:
@ -24,7 +24,7 @@ public:
WidgetCompositionEvent* aEvent); WidgetCompositionEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
NS_DECL_NSIDOMCOMPOSITIONEVENT NS_DECL_NSIDOMCOMPOSITIONEVENT
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,

View File

@ -320,7 +320,7 @@ NS_IMETHODIMP
DataTransfer::GetFiles(nsIDOMFileList** aFileList) DataTransfer::GetFiles(nsIDOMFileList** aFileList)
{ {
ErrorResult rv; ErrorResult rv;
*aFileList = GetFiles(rv); NS_IF_ADDREF(*aFileList = GetFiles(rv));
return rv.ErrorCode(); return rv.ErrorCode();
} }

View File

@ -87,7 +87,6 @@ DragEvent::InitDragEvent(const nsAString& aType,
nsIDOMDataTransfer* aDataTransfer) nsIDOMDataTransfer* aDataTransfer)
{ {
nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer); nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer);
NS_ENSURE_ARG(dataTransfer);
nsresult rv = nsresult rv =
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail, MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,

View File

@ -10,14 +10,13 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, nsDOMUIEvent, nsIDOMFocusEvent) NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, UIEvent, nsIDOMFocusEvent)
FocusEvent::FocusEvent(EventTarget* aOwner, FocusEvent::FocusEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
InternalFocusEvent* aEvent) InternalFocusEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, : UIEvent(aOwner, aPresContext,
aEvent ? aEvent : aEvent ? aEvent : new InternalFocusEvent(false, NS_FOCUS_CONTENT))
new InternalFocusEvent(false, NS_FOCUS_CONTENT))
{ {
if (aEvent) { if (aEvent) {
mEventIsInternal = false; mEventIsInternal = false;
@ -50,7 +49,8 @@ FocusEvent::InitFocusEvent(const nsAString& aType,
int32_t aDetail, int32_t aDetail,
EventTarget* aRelatedTarget) EventTarget* aRelatedTarget)
{ {
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail); nsresult rv =
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget; mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget;
return NS_OK; return NS_OK;

View File

@ -5,15 +5,15 @@
#ifndef mozilla_dom_FocusEvent_h_ #ifndef mozilla_dom_FocusEvent_h_
#define mozilla_dom_FocusEvent_h_ #define mozilla_dom_FocusEvent_h_
#include "nsDOMUIEvent.h"
#include "nsIDOMFocusEvent.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/FocusEventBinding.h" #include "mozilla/dom/FocusEventBinding.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMFocusEvent.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class FocusEvent : public nsDOMUIEvent, class FocusEvent : public UIEvent,
public nsIDOMFocusEvent public nsIDOMFocusEvent
{ {
public: public:
@ -21,7 +21,7 @@ public:
NS_DECL_NSIDOMFOCUSEVENT NS_DECL_NSIDOMFOCUSEVENT
// Forward to base class // Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -13,8 +13,8 @@ namespace dom {
KeyboardEvent::KeyboardEvent(EventTarget* aOwner, KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetKeyboardEvent* aEvent) WidgetKeyboardEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent : : UIEvent(aOwner, aPresContext,
new WidgetKeyboardEvent(false, 0, nullptr)) aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
{ {
NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch"); NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch");
@ -28,12 +28,12 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
} }
} }
NS_IMPL_ADDREF_INHERITED(KeyboardEvent, nsDOMUIEvent) NS_IMPL_ADDREF_INHERITED(KeyboardEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, nsDOMUIEvent) NS_IMPL_RELEASE_INHERITED(KeyboardEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(KeyboardEvent) NS_INTERFACE_MAP_BEGIN(KeyboardEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(UIEvent)
bool bool
KeyboardEvent::AltKey() KeyboardEvent::AltKey()
@ -212,7 +212,7 @@ KeyboardEvent::InitKeyEvent(const nsAString& aType,
uint32_t aKeyCode, uint32_t aKeyCode,
uint32_t aCharCode) uint32_t aCharCode)
{ {
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0); nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent(); WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();

View File

@ -6,15 +6,15 @@
#ifndef mozilla_dom_KeyboardEvent_h_ #ifndef mozilla_dom_KeyboardEvent_h_
#define mozilla_dom_KeyboardEvent_h_ #define mozilla_dom_KeyboardEvent_h_
#include "nsIDOMKeyEvent.h" #include "mozilla/dom/UIEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/KeyboardEventBinding.h" #include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMKeyEvent.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class KeyboardEvent : public nsDOMUIEvent, class KeyboardEvent : public UIEvent,
public nsIDOMKeyEvent public nsIDOMKeyEvent
{ {
public: public:
@ -28,7 +28,7 @@ public:
NS_DECL_NSIDOMKEYEVENT NS_DECL_NSIDOMKEYEVENT
// Forward to base class // Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -15,8 +15,8 @@ namespace dom {
MouseEvent::MouseEvent(EventTarget* aOwner, MouseEvent::MouseEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetMouseEventBase* aEvent) WidgetMouseEventBase* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent : : UIEvent(aOwner, aPresContext,
new WidgetMouseEvent(false, 0, nullptr, aEvent ? aEvent : new WidgetMouseEvent(false, 0, nullptr,
WidgetMouseEvent::eReal)) WidgetMouseEvent::eReal))
{ {
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent. // There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
@ -41,12 +41,12 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
} }
} }
NS_IMPL_ADDREF_INHERITED(MouseEvent, nsDOMUIEvent) NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(MouseEvent, nsDOMUIEvent) NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(MouseEvent) NS_INTERFACE_MAP_BEGIN(MouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_IMETHODIMP NS_IMETHODIMP
MouseEvent::InitMouseEvent(const nsAString& aType, MouseEvent::InitMouseEvent(const nsAString& aType,
@ -65,7 +65,8 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
uint16_t aButton, uint16_t aButton,
nsIDOMEventTarget* aRelatedTarget) nsIDOMEventTarget* aRelatedTarget)
{ {
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail); nsresult rv =
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
switch(mEvent->eventStructType) { switch(mEvent->eventStructType) {

View File

@ -6,15 +6,15 @@
#ifndef mozilla_dom_MouseEvent_h_ #ifndef mozilla_dom_MouseEvent_h_
#define mozilla_dom_MouseEvent_h_ #define mozilla_dom_MouseEvent_h_
#include "nsIDOMMouseEvent.h" #include "mozilla/dom/UIEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "nsIDOMMouseEvent.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class MouseEvent : public nsDOMUIEvent, class MouseEvent : public UIEvent,
public nsIDOMMouseEvent public nsIDOMMouseEvent
{ {
public: public:
@ -28,7 +28,7 @@ public:
NS_DECL_NSIDOMMOUSEEVENT NS_DECL_NSIDOMMOUSEEVENT
// Forward to base class // Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
@ -121,6 +121,6 @@ protected:
#define NS_FORWARD_TO_MOUSEEVENT \ #define NS_FORWARD_TO_MOUSEEVENT \
NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \ NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
#endif // mozilla_dom_MouseEvent_h_ #endif // mozilla_dom_MouseEvent_h_

View File

@ -0,0 +1,182 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/NotifyAudioAvailableEvent.h"
#include "mozilla/HoldDropJSObjects.h"
#include "nsError.h"
#include "jsfriendapi.h"
namespace mozilla {
namespace dom {
NotifyAudioAvailableEvent::NotifyAudioAvailableEvent(
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime)
: nsDOMEvent(aOwner, aPresContext, aEvent)
, mFrameBuffer(aFrameBuffer)
, mFrameBufferLength(aFrameBufferLength)
, mTime(aTime)
, mCachedArray(nullptr)
, mAllowAudioData(false)
{
MOZ_COUNT_CTOR(NotifyAudioAvailableEvent);
if (mEvent) {
mEvent->message = aEventType;
}
}
NS_IMPL_ADDREF_INHERITED(NotifyAudioAvailableEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(NotifyAudioAvailableEvent, nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_CLASS(NotifyAudioAvailableEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(NotifyAudioAvailableEvent,
nsDOMEvent)
if (tmp->mCachedArray) {
tmp->mCachedArray = nullptr;
DropJSObjects(tmp);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(NotifyAudioAvailableEvent,
nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(NotifyAudioAvailableEvent,
nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCachedArray)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(NotifyAudioAvailableEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyAudioAvailableEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NotifyAudioAvailableEvent::~NotifyAudioAvailableEvent()
{
MOZ_COUNT_DTOR(NotifyAudioAvailableEvent);
if (mCachedArray) {
mCachedArray = nullptr;
mozilla::DropJSObjects(this);
}
}
NS_IMETHODIMP
NotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx,
JS::MutableHandle<JS::Value> aResult)
{
if (!mAllowAudioData) {
// Media is not same-origin, don't allow the data out.
return NS_ERROR_DOM_SECURITY_ERR;
}
if (mCachedArray) {
aResult.setObject(*mCachedArray);
return NS_OK;
}
// Cache this array so we don't recreate on next call.
mozilla::HoldJSObjects(this);
mCachedArray = JS_NewFloat32Array(aCx, mFrameBufferLength);
if (!mCachedArray) {
mozilla::DropJSObjects(this);
return NS_ERROR_FAILURE;
}
memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(),
mFrameBufferLength * sizeof(float));
aResult.setObject(*mCachedArray);
return NS_OK;
}
NS_IMETHODIMP
NotifyAudioAvailableEvent::GetTime(float* aRetVal)
{
*aRetVal = Time();
return NS_OK;
}
NS_IMETHODIMP
NotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime,
bool aAllowAudioData)
{
// Auto manage the memory which stores the frame buffer. This ensures
// that if we exit due to some error, the memory will be freed. Otherwise,
// the framebuffer's memory will be freed when this event is destroyed.
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
NS_ENSURE_SUCCESS(rv, rv);
mFrameBuffer = frameBuffer.forget();
mFrameBufferLength = aFrameBufferLength;
mTime = aTime;
mAllowAudioData = aAllowAudioData;
mCachedArray = nullptr;
return NS_OK;
}
void
NotifyAudioAvailableEvent::InitAudioAvailableEvent(
const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const Nullable<Sequence<float> >& aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime,
bool aAllowAudioData,
ErrorResult& aRv)
{
if ((aFrameBuffer.IsNull() && aFrameBufferLength > 0) ||
(!aFrameBuffer.IsNull() &&
aFrameBuffer.Value().Length() < aFrameBufferLength)) {
aRv = NS_ERROR_UNEXPECTED;
return;
}
nsAutoArrayPtr<float> buffer;
if (!aFrameBuffer.IsNull()) {
buffer = new float[aFrameBufferLength];
memcpy(buffer.get(), aFrameBuffer.Value().Elements(),
aFrameBufferLength * sizeof(float));
}
aRv = InitAudioAvailableEvent(aType, aCanBubble, aCancelable,
buffer.forget(),
aFrameBufferLength,
aTime, aAllowAudioData);
}
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime)
{
NotifyAudioAvailableEvent* it =
new NotifyAudioAvailableEvent(aOwner, aPresContext, aEvent, aEventType,
aFrameBuffer, aFrameBufferLength, aTime);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -0,0 +1,78 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_NotifyAudioAvailableEvent_h_
#define mozilla_dom_NotifyAudioAvailableEvent_h_
#include "nsIDOMNotifyAudioAvailableEvent.h"
#include "nsDOMEvent.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
class nsPresContext;
namespace mozilla {
namespace dom {
class NotifyAudioAvailableEvent : public nsDOMEvent,
public nsIDOMNotifyAudioAvailableEvent
{
public:
NotifyAudioAvailableEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
NotifyAudioAvailableEvent, nsDOMEvent)
NS_DECL_NSIDOMNOTIFYAUDIOAVAILABLEEVENT
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
~NotifyAudioAvailableEvent();
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
}
JSObject* GetFrameBuffer(JSContext* aCx, ErrorResult& aRv)
{
JS::Rooted<JS::Value> dummy(aCx);
aRv = GetFrameBuffer(aCx, &dummy);
return mCachedArray;
}
float Time()
{
return mTime;
}
void InitAudioAvailableEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const Nullable<Sequence<float> >& aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime,
bool aAllowAudioData,
ErrorResult& aRv);
private:
nsAutoArrayPtr<float> mFrameBuffer;
uint32_t mFrameBufferLength;
float mTime;
JS::Heap<JSObject*> mCachedArray;
bool mAllowAudioData;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_NotifyAudioAvailableEvent_h_

View File

@ -5,16 +5,16 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/NotifyPaintEvent.h"
#include "mozilla/GfxMessageUtils.h" #include "mozilla/GfxMessageUtils.h"
#include "nsDOMNotifyPaintEvent.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsPaintRequest.h" #include "nsPaintRequest.h"
#include "mozilla/dom/DOMRect.h"
using namespace mozilla; namespace mozilla {
using namespace mozilla::dom; namespace dom {
nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner, NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetEvent* aEvent, WidgetEvent* aEvent,
uint32_t aEventType, uint32_t aEventType,
@ -29,15 +29,15 @@ nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
} }
} }
NS_INTERFACE_MAP_BEGIN(nsDOMNotifyPaintEvent) NS_INTERFACE_MAP_BEGIN(NotifyPaintEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyPaintEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyPaintEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMNotifyPaintEvent, nsDOMEvent) NS_IMPL_ADDREF_INHERITED(NotifyPaintEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMNotifyPaintEvent, nsDOMEvent) NS_IMPL_RELEASE_INHERITED(NotifyPaintEvent, nsDOMEvent)
nsRegion nsRegion
nsDOMNotifyPaintEvent::GetRegion() NotifyPaintEvent::GetRegion()
{ {
nsRegion r; nsRegion r;
if (!nsContentUtils::IsCallerChrome()) { if (!nsContentUtils::IsCallerChrome()) {
@ -51,14 +51,14 @@ nsDOMNotifyPaintEvent::GetRegion()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMNotifyPaintEvent::GetBoundingClientRect(nsIDOMClientRect** aResult) NotifyPaintEvent::GetBoundingClientRect(nsIDOMClientRect** aResult)
{ {
*aResult = BoundingClientRect().get(); *aResult = BoundingClientRect().get();
return NS_OK; return NS_OK;
} }
already_AddRefed<DOMRect> already_AddRefed<DOMRect>
nsDOMNotifyPaintEvent::BoundingClientRect() NotifyPaintEvent::BoundingClientRect()
{ {
nsRefPtr<DOMRect> rect = new DOMRect(ToSupports(this)); nsRefPtr<DOMRect> rect = new DOMRect(ToSupports(this));
@ -70,14 +70,14 @@ nsDOMNotifyPaintEvent::BoundingClientRect()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMNotifyPaintEvent::GetClientRects(nsIDOMClientRectList** aResult) NotifyPaintEvent::GetClientRects(nsIDOMClientRectList** aResult)
{ {
*aResult = ClientRects().get(); *aResult = ClientRects().get();
return NS_OK; return NS_OK;
} }
already_AddRefed<DOMRectList> already_AddRefed<DOMRectList>
nsDOMNotifyPaintEvent::ClientRects() NotifyPaintEvent::ClientRects()
{ {
nsISupports* parent = ToSupports(this); nsISupports* parent = ToSupports(this);
nsRefPtr<DOMRectList> rectList = new DOMRectList(parent); nsRefPtr<DOMRectList> rectList = new DOMRectList(parent);
@ -95,7 +95,7 @@ nsDOMNotifyPaintEvent::ClientRects()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMNotifyPaintEvent::GetPaintRequests(nsISupports** aResult) NotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
{ {
nsRefPtr<nsPaintRequestList> requests = PaintRequests(); nsRefPtr<nsPaintRequestList> requests = PaintRequests();
requests.forget(aResult); requests.forget(aResult);
@ -103,7 +103,7 @@ nsDOMNotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
} }
already_AddRefed<nsPaintRequestList> already_AddRefed<nsPaintRequestList>
nsDOMNotifyPaintEvent::PaintRequests() NotifyPaintEvent::PaintRequests()
{ {
nsDOMEvent* parent = this; nsDOMEvent* parent = this;
nsRefPtr<nsPaintRequestList> requests = new nsPaintRequestList(parent); nsRefPtr<nsPaintRequestList> requests = new nsPaintRequestList(parent);
@ -120,7 +120,7 @@ nsDOMNotifyPaintEvent::PaintRequests()
} }
NS_IMETHODIMP_(void) NS_IMETHODIMP_(void)
nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg, NotifyPaintEvent::Serialize(IPC::Message* aMsg,
bool aSerializeInterfaceType) bool aSerializeInterfaceType)
{ {
if (aSerializeInterfaceType) { if (aSerializeInterfaceType) {
@ -138,7 +138,7 @@ nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
} }
NS_IMETHODIMP_(bool) NS_IMETHODIMP_(bool)
nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter) NotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
{ {
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false); NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
@ -155,16 +155,21 @@ nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
return true; return true;
} }
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult, } // namespace dom
mozilla::dom::EventTarget* aOwner, } // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetEvent* aEvent, WidgetEvent* aEvent,
uint32_t aEventType, uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests) nsInvalidateRequestList* aInvalidateRequests)
{ {
nsDOMNotifyPaintEvent* it = NotifyPaintEvent* it = new NotifyPaintEvent(aOwner, aPresContext, aEvent,
new nsDOMNotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType, aEventType, aInvalidateRequests);
aInvalidateRequests);
return CallQueryInterface(it, aInstancePtrResult); return CallQueryInterface(it, aInstancePtrResult);
} }

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMNotifyPaintEvent_h_ #ifndef mozilla_dom_NotifyPaintEvent_h_
#define nsDOMNotifyPaintEvent_h_ #define mozilla_dom_NotifyPaintEvent_h_
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "nsIDOMNotifyPaintEvent.h" #include "nsIDOMNotifyPaintEvent.h"
@ -16,21 +16,18 @@ class nsPaintRequestList;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class DOMRect; class DOMRect;
class DOMRectList; class DOMRectList;
}
}
class nsDOMNotifyPaintEvent : public nsDOMEvent, class NotifyPaintEvent : public nsDOMEvent,
public nsIDOMNotifyPaintEvent public nsIDOMNotifyPaintEvent
{ {
typedef mozilla::dom::DOMRect DOMRect;
typedef mozilla::dom::DOMRectList DOMRectList;
public: public:
nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner, NotifyPaintEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent, WidgetEvent* aEvent,
uint32_t aEventType, uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests); nsInvalidateRequestList* aInvalidateRequests);
@ -50,7 +47,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::NotifyPaintEventBinding::Wrap(aCx, aScope, this); return NotifyPaintEventBinding::Wrap(aCx, aScope, this);
} }
already_AddRefed<DOMRectList> ClientRects(); already_AddRefed<DOMRectList> ClientRects();
@ -64,4 +61,7 @@ private:
nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests; nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests;
}; };
#endif // nsDOMNotifyPaintEvent_h_ } // namespace dom
} // namespace mozilla
#endif // mozilla_dom_NotifyPaintEvent_h_

View File

@ -5,33 +5,33 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/ScrollAreaEvent.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "nsDOMScrollAreaEvent.h" namespace mozilla {
#include "mozilla/dom/DOMRect.h" namespace dom {
using namespace mozilla; ScrollAreaEvent::ScrollAreaEvent(EventTarget* aOwner,
nsDOMScrollAreaEvent::nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
InternalScrollAreaEvent* aEvent) InternalScrollAreaEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent) : UIEvent(aOwner, aPresContext, aEvent)
, mClientArea(nullptr) , mClientArea(nullptr)
{ {
mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect()); mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
} }
NS_IMPL_ADDREF_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent) NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent) NS_IMPL_RELEASE_INHERITED(ScrollAreaEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMScrollAreaEvent) NS_INTERFACE_MAP_BEGIN(ScrollAreaEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(UIEvent)
#define FORWARD_GETTER(_name) \ #define FORWARD_GETTER(_name) \
NS_IMETHODIMP \ NS_IMETHODIMP \
nsDOMScrollAreaEvent::Get ## _name(float* aResult) \ ScrollAreaEvent::Get ## _name(float* aResult) \
{ \ { \
*aResult = _name(); \ *aResult = _name(); \
return NS_OK; \ return NS_OK; \
@ -43,15 +43,18 @@ FORWARD_GETTER(Width)
FORWARD_GETTER(Height) FORWARD_GETTER(Height)
NS_IMETHODIMP NS_IMETHODIMP
nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType, ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
bool aCanBubble, bool aCanBubble,
bool aCancelable, bool aCancelable,
nsIDOMWindow* aView, nsIDOMWindow* aView,
int32_t aDetail, int32_t aDetail,
float aX, float aY, float aX,
float aWidth, float aHeight) float aY,
float aWidth,
float aHeight)
{ {
nsresult rv = nsDOMUIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail); nsresult rv =
UIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mClientArea.SetRect(aX, aY, aWidth, aHeight); mClientArea.SetRect(aX, aY, aWidth, aHeight);
@ -60,7 +63,7 @@ nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
} }
NS_IMETHODIMP_(void) NS_IMETHODIMP_(void)
nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg, ScrollAreaEvent::Serialize(IPC::Message* aMsg,
bool aSerializeInterfaceType) bool aSerializeInterfaceType)
{ {
if (aSerializeInterfaceType) { if (aSerializeInterfaceType) {
@ -76,7 +79,7 @@ nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
} }
NS_IMETHODIMP_(bool) NS_IMETHODIMP_(bool)
nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter) ScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
{ {
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false); NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
@ -90,13 +93,18 @@ nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
return true; return true;
} }
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult nsresult
NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult, NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner, EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
InternalScrollAreaEvent* aEvent) InternalScrollAreaEvent* aEvent)
{ {
nsDOMScrollAreaEvent* ev = ScrollAreaEvent* ev = new ScrollAreaEvent(aOwner, aPresContext, aEvent);
new nsDOMScrollAreaEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(ev, aInstancePtrResult); return CallQueryInterface(ev, aInstancePtrResult);
} }

View File

@ -3,32 +3,32 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMScrollAreaEvent_h__ #ifndef mozilla_dom_ScrollAreaEvent_h_
#define nsDOMScrollAreaEvent_h__ #define mozilla_dom_ScrollAreaEvent_h_
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMScrollAreaEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/ScrollAreaEventBinding.h" #include "mozilla/dom/ScrollAreaEventBinding.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMScrollAreaEvent.h"
class nsDOMScrollAreaEvent : public nsDOMUIEvent, namespace mozilla {
namespace dom {
class ScrollAreaEvent : public UIEvent,
public nsIDOMScrollAreaEvent public nsIDOMScrollAreaEvent
{ {
typedef mozilla::dom::DOMRect DOMRect;
public: public:
nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner, ScrollAreaEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
mozilla::InternalScrollAreaEvent* aEvent); InternalScrollAreaEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSCROLLAREAEVENT NS_DECL_NSIDOMSCROLLAREAEVENT
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
NS_IMETHOD DuplicatePrivateData() NS_IMETHOD DuplicatePrivateData()
@ -41,7 +41,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::ScrollAreaEventBinding::Wrap(aCx, aScope, this); return ScrollAreaEventBinding::Wrap(aCx, aScope, this);
} }
float X() const float X() const
@ -71,7 +71,7 @@ public:
int32_t aDetail, int32_t aDetail,
float aX, float aY, float aX, float aY,
float aWidth, float aHeight, float aWidth, float aHeight,
mozilla::ErrorResult& aRv) ErrorResult& aRv)
{ {
aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView, aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView,
aDetail, aX, aY, aWidth, aHeight); aDetail, aX, aY, aWidth, aHeight);
@ -81,4 +81,7 @@ protected:
DOMRect mClientArea; DOMRect mClientArea;
}; };
#endif // nsDOMScrollAreaEvent_h__ } // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ScrollAreaEvent_h_

View File

@ -7,14 +7,14 @@
#include "mozilla/dom/EventTarget.h" #include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/TouchBinding.h" #include "mozilla/dom/TouchBinding.h"
#include "mozilla/dom/TouchEvent.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsDOMTouchEvent.h"
#include "nsIContent.h" #include "nsIContent.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
Touch::Touch(mozilla::dom::EventTarget* aTarget, Touch::Touch(EventTarget* aTarget,
int32_t aIdentifier, int32_t aIdentifier,
int32_t aPageX, int32_t aPageX,
int32_t aPageY, int32_t aPageY,
@ -71,10 +71,11 @@ Touch::~Touch()
{ {
} }
/* static */ bool // static
bool
Touch::PrefEnabled(JSContext* aCx, JSObject* aGlobal) Touch::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{ {
return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal); return TouchEvent::PrefEnabled(aCx, aGlobal);
} }
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
@ -117,7 +118,7 @@ Touch::InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent)
} }
void void
Touch::SetTarget(mozilla::dom::EventTarget* aTarget) Touch::SetTarget(EventTarget* aTarget)
{ {
mTarget = aTarget; mTarget = aTarget;
} }
@ -132,7 +133,7 @@ Touch::Equals(Touch* aTouch)
mRadius.y == aTouch->RadiusY(); mRadius.y == aTouch->RadiusY();
} }
/* virtual */ JSObject* JSObject*
Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{ {
return TouchBinding::Wrap(aCx, aScope, this); return TouchBinding::Wrap(aCx, aScope, this);

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_Touch_h #ifndef mozilla_dom_Touch_h_
#define mozilla_dom_Touch_h #define mozilla_dom_Touch_h_
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
@ -27,7 +27,7 @@ class Touch MOZ_FINAL : public nsISupports
public: public:
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal); static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
Touch(mozilla::dom::EventTarget* aTarget, Touch(EventTarget* aTarget,
int32_t aIdentifier, int32_t aIdentifier,
int32_t aPageX, int32_t aPageX,
int32_t aPageY, int32_t aPageY,
@ -52,7 +52,7 @@ public:
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent); void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
void SetTarget(mozilla::dom::EventTarget* aTarget); void SetTarget(EventTarget* aTarget);
bool Equals(Touch* aTouch); bool Equals(Touch* aTouch);
@ -92,4 +92,4 @@ protected:
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
#endif // mozilla_dom_Touch_h #endif // mozilla_dom_Touch_h_

View File

@ -4,42 +4,52 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMTouchEvent.h" #include "mozilla/dom/TouchEvent.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Touch.h" #include "mozilla/dom/Touch.h"
#include "mozilla/dom/TouchListBinding.h" #include "mozilla/dom/TouchListBinding.h"
#include "mozilla/Preferences.h"
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "nsContentUtils.h"
using namespace mozilla; namespace mozilla {
using namespace mozilla::dom;
// TouchList #ifdef XP_WIN
namespace widget {
extern int32_t IsTouchDeviceSupportPresent();
} // namespace widget
#endif // #ifdef XP_WIN
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchList) namespace dom {
/******************************************************************************
* TouchList
*****************************************************************************/
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TouchList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsDOMTouchList, mParent, mPoints) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(TouchList, mParent, mPoints)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchList) NS_IMPL_CYCLE_COLLECTING_ADDREF(TouchList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTouchList) NS_IMPL_CYCLE_COLLECTING_RELEASE(TouchList)
/* virtual */ JSObject* JSObject*
nsDOMTouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) TouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{ {
return TouchListBinding::Wrap(aCx, aScope, this); return TouchListBinding::Wrap(aCx, aScope, this);
} }
/* static */ bool // static
nsDOMTouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal) bool
TouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{ {
return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal); return TouchEvent::PrefEnabled(aCx, aGlobal);
} }
Touch* Touch*
nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const TouchList::IdentifiedTouch(int32_t aIdentifier) const
{ {
for (uint32_t i = 0; i < mPoints.Length(); ++i) { for (uint32_t i = 0; i < mPoints.Length(); ++i) {
Touch* point = mPoints[i]; Touch* point = mPoints[i];
@ -50,12 +60,14 @@ nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
return nullptr; return nullptr;
} }
// TouchEvent /******************************************************************************
* TouchEvent
*****************************************************************************/
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner, TouchEvent::TouchEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetTouchEvent* aEvent) WidgetTouchEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, : UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr)) aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
{ {
if (aEvent) { if (aEvent) {
@ -71,20 +83,19 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
} }
} }
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(nsDOMTouchEvent, nsDOMUIEvent, NS_IMPL_CYCLE_COLLECTION_INHERITED_3(TouchEvent, UIEvent,
mTouches, mTouches,
mTargetTouches, mTargetTouches,
mChangedTouches) mChangedTouches)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTouchEvent) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TouchEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(TouchEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(TouchEvent, UIEvent)
void void
nsDOMTouchEvent::InitTouchEvent(const nsAString& aType, TouchEvent::InitTouchEvent(const nsAString& aType,
bool aCanBubble, bool aCanBubble,
bool aCancelable, bool aCancelable,
nsIDOMWindow* aView, nsIDOMWindow* aView,
@ -93,16 +104,12 @@ nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
bool aAltKey, bool aAltKey,
bool aShiftKey, bool aShiftKey,
bool aMetaKey, bool aMetaKey,
nsDOMTouchList* aTouches, TouchList* aTouches,
nsDOMTouchList* aTargetTouches, TouchList* aTargetTouches,
nsDOMTouchList* aChangedTouches, TouchList* aChangedTouches,
mozilla::ErrorResult& aRv) ErrorResult& aRv)
{ {
aRv = nsDOMUIEvent::InitUIEvent(aType, aRv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
aCanBubble,
aCancelable,
aView,
aDetail);
if (aRv.Failed()) { if (aRv.Failed()) {
return; return;
} }
@ -114,8 +121,8 @@ nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
mChangedTouches = aChangedTouches; mChangedTouches = aChangedTouches;
} }
nsDOMTouchList* TouchList*
nsDOMTouchEvent::Touches() TouchEvent::Touches()
{ {
if (!mTouches) { if (!mTouches) {
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent(); WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
@ -128,16 +135,16 @@ nsDOMTouchEvent::Touches()
unchangedTouches.AppendElement(touches[i]); unchangedTouches.AppendElement(touches[i]);
} }
} }
mTouches = new nsDOMTouchList(ToSupports(this), unchangedTouches); mTouches = new TouchList(ToSupports(this), unchangedTouches);
} else { } else {
mTouches = new nsDOMTouchList(ToSupports(this), touchEvent->touches); mTouches = new TouchList(ToSupports(this), touchEvent->touches);
} }
} }
return mTouches; return mTouches;
} }
nsDOMTouchList* TouchList*
nsDOMTouchEvent::TargetTouches() TouchEvent::TargetTouches()
{ {
if (!mTargetTouches) { if (!mTargetTouches) {
nsTArray< nsRefPtr<Touch> > targetTouches; nsTArray< nsRefPtr<Touch> > targetTouches;
@ -153,13 +160,13 @@ nsDOMTouchEvent::TargetTouches()
} }
} }
} }
mTargetTouches = new nsDOMTouchList(ToSupports(this), targetTouches); mTargetTouches = new TouchList(ToSupports(this), targetTouches);
} }
return mTargetTouches; return mTargetTouches;
} }
nsDOMTouchList* TouchList*
nsDOMTouchEvent::ChangedTouches() TouchEvent::ChangedTouches()
{ {
if (!mChangedTouches) { if (!mChangedTouches) {
nsTArray< nsRefPtr<Touch> > changedTouches; nsTArray< nsRefPtr<Touch> > changedTouches;
@ -170,20 +177,14 @@ nsDOMTouchEvent::ChangedTouches()
changedTouches.AppendElement(touches[i]); changedTouches.AppendElement(touches[i]);
} }
} }
mChangedTouches = new nsDOMTouchList(ToSupports(this), changedTouches); mChangedTouches = new TouchList(ToSupports(this), changedTouches);
} }
return mChangedTouches; return mChangedTouches;
} }
#ifdef XP_WIN // static
namespace mozilla {
namespace widget {
extern int32_t IsTouchDeviceSupportPresent();
} }
#endif
bool bool
nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal) TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{ {
bool prefValue = false; bool prefValue = false;
int32_t flag = 0; int32_t flag = 0;
@ -196,7 +197,7 @@ nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
// On Windows we auto-detect based on device support. // On Windows we auto-detect based on device support.
if (!sDidCheckTouchDeviceSupport) { if (!sDidCheckTouchDeviceSupport) {
sDidCheckTouchDeviceSupport = true; sDidCheckTouchDeviceSupport = true;
sIsTouchDeviceSupportPresent = mozilla::widget::IsTouchDeviceSupportPresent(); sIsTouchDeviceSupportPresent = widget::IsTouchDeviceSupportPresent();
} }
prefValue = sIsTouchDeviceSupportPresent; prefValue = sIsTouchDeviceSupportPresent;
#else #else
@ -214,35 +215,41 @@ nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
} }
bool bool
nsDOMTouchEvent::AltKey() TouchEvent::AltKey()
{ {
return mEvent->AsTouchEvent()->IsAlt(); return mEvent->AsTouchEvent()->IsAlt();
} }
bool bool
nsDOMTouchEvent::MetaKey() TouchEvent::MetaKey()
{ {
return mEvent->AsTouchEvent()->IsMeta(); return mEvent->AsTouchEvent()->IsMeta();
} }
bool bool
nsDOMTouchEvent::CtrlKey() TouchEvent::CtrlKey()
{ {
return mEvent->AsTouchEvent()->IsControl(); return mEvent->AsTouchEvent()->IsControl();
} }
bool bool
nsDOMTouchEvent::ShiftKey() TouchEvent::ShiftKey()
{ {
return mEvent->AsTouchEvent()->IsShift(); return mEvent->AsTouchEvent()->IsShift();
} }
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult nsresult
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult, NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner, EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetTouchEvent* aEvent) WidgetTouchEvent* aEvent)
{ {
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent); TouchEvent* it = new TouchEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult); return CallQueryInterface(it, aInstancePtrResult);
} }

View File

@ -2,37 +2,37 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMTouchEvent_h_ #ifndef mozilla_dom_TouchEvent_h_
#define nsDOMTouchEvent_h_ #define mozilla_dom_TouchEvent_h_
#include "nsDOMUIEvent.h" #include "mozilla/dom/Touch.h"
#include "nsTArray.h" #include "mozilla/dom/TouchEventBinding.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "nsJSEnvironment.h" #include "nsJSEnvironment.h"
#include "mozilla/dom/Touch.h" #include "nsTArray.h"
#include "mozilla/dom/TouchEventBinding.h"
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
class nsAString; class nsAString;
class nsDOMTouchList MOZ_FINAL : public nsISupports namespace mozilla {
namespace dom {
class TouchList MOZ_FINAL : public nsISupports
, public nsWrapperCache , public nsWrapperCache
{ {
typedef mozilla::dom::Touch Touch;
public: public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTouchList) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TouchList)
nsDOMTouchList(nsISupports* aParent) TouchList(nsISupports* aParent)
: mParent(aParent) : mParent(aParent)
{ {
SetIsDOMBinding(); SetIsDOMBinding();
nsJSContext::LikelyShortLivingObjectCreated(); nsJSContext::LikelyShortLivingObjectCreated();
} }
nsDOMTouchList(nsISupports* aParent, TouchList(nsISupports* aParent,
const nsTArray<nsRefPtr<Touch> >& aTouches) const nsTArray<nsRefPtr<Touch> >& aTouches)
: mParent(aParent) : mParent(aParent)
, mPoints(aTouches) , mPoints(aTouches)
@ -46,15 +46,16 @@ public:
mPoints.AppendElement(aPoint); mPoints.AppendElement(aPoint);
} }
virtual JSObject* virtual JSObject* WrapObject(JSContext* aCx,
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE; JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
nsISupports* GetParentObject() const nsISupports* GetParentObject() const
{ {
return mParent; return mParent;
} }
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr); static bool PrefEnabled(JSContext* aCx = nullptr,
JSObject* aGlobal = nullptr);
uint32_t Length() const uint32_t Length() const
{ {
@ -79,25 +80,25 @@ protected:
nsTArray<nsRefPtr<Touch> > mPoints; nsTArray<nsRefPtr<Touch> > mPoints;
}; };
class nsDOMTouchEvent : public nsDOMUIEvent class TouchEvent : public UIEvent
{ {
public: public:
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner, TouchEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
mozilla::WidgetTouchEvent* aEvent); WidgetTouchEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMTouchEvent, nsDOMUIEvent) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TouchEvent, UIEvent)
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::TouchEventBinding::Wrap(aCx, aScope, this); return TouchEventBinding::Wrap(aCx, aScope, this);
} }
nsDOMTouchList* Touches(); TouchList* Touches();
nsDOMTouchList* TargetTouches(); TouchList* TargetTouches();
nsDOMTouchList* ChangedTouches(); TouchList* ChangedTouches();
bool AltKey(); bool AltKey();
bool MetaKey(); bool MetaKey();
@ -113,16 +114,20 @@ public:
bool aAltKey, bool aAltKey,
bool aShiftKey, bool aShiftKey,
bool aMetaKey, bool aMetaKey,
nsDOMTouchList* aTouches, TouchList* aTouches,
nsDOMTouchList* aTargetTouches, TouchList* aTargetTouches,
nsDOMTouchList* aChangedTouches, TouchList* aChangedTouches,
mozilla::ErrorResult& aRv); ErrorResult& aRv);
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr); static bool PrefEnabled(JSContext* aCx = nullptr,
JSObject* aGlobal = nullptr);
protected: protected:
nsRefPtr<nsDOMTouchList> mTouches; nsRefPtr<TouchList> mTouches;
nsRefPtr<nsDOMTouchList> mTargetTouches; nsRefPtr<TouchList> mTargetTouches;
nsRefPtr<nsDOMTouchList> mChangedTouches; nsRefPtr<TouchList> mChangedTouches;
}; };
#endif /* !defined(nsDOMTouchEvent_h_) */ } // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TouchEvent_h_

View File

@ -3,13 +3,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMTransitionEvent.h" #include "mozilla/dom/TransitionEvent.h"
#include "prtime.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "prtime.h"
using namespace mozilla; namespace mozilla {
namespace dom {
nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner, TransitionEvent::TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
InternalTransitionEvent* aEvent) InternalTransitionEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext, : nsDOMEvent(aOwner, aPresContext,
@ -24,22 +25,22 @@ nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
} }
} }
NS_INTERFACE_MAP_BEGIN(nsDOMTransitionEvent) NS_INTERFACE_MAP_BEGIN(TransitionEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMTransitionEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMTransitionEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMTransitionEvent, nsDOMEvent) NS_IMPL_ADDREF_INHERITED(TransitionEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMTransitionEvent, nsDOMEvent) NS_IMPL_RELEASE_INHERITED(TransitionEvent, nsDOMEvent)
// static // static
already_AddRefed<nsDOMTransitionEvent> already_AddRefed<TransitionEvent>
nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal, TransitionEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType, const nsAString& aType,
const mozilla::dom::TransitionEventInit& aParam, const TransitionEventInit& aParam,
mozilla::ErrorResult& aRv) ErrorResult& aRv)
{ {
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports()); nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<nsDOMTransitionEvent> e = new nsDOMTransitionEvent(t, nullptr, nullptr); nsRefPtr<TransitionEvent> e = new TransitionEvent(t, nullptr, nullptr);
bool trusted = e->Init(t); bool trusted = e->Init(t);
aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable); aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
@ -54,39 +55,44 @@ nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMTransitionEvent::GetPropertyName(nsAString & aPropertyName) TransitionEvent::GetPropertyName(nsAString& aPropertyName)
{ {
aPropertyName = mEvent->AsTransitionEvent()->propertyName; aPropertyName = mEvent->AsTransitionEvent()->propertyName;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMTransitionEvent::GetElapsedTime(float *aElapsedTime) TransitionEvent::GetElapsedTime(float* aElapsedTime)
{ {
*aElapsedTime = ElapsedTime(); *aElapsedTime = ElapsedTime();
return NS_OK; return NS_OK;
} }
float float
nsDOMTransitionEvent::ElapsedTime() TransitionEvent::ElapsedTime()
{ {
return mEvent->AsTransitionEvent()->elapsedTime; return mEvent->AsTransitionEvent()->elapsedTime;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMTransitionEvent::GetPseudoElement(nsAString& aPseudoElement) TransitionEvent::GetPseudoElement(nsAString& aPseudoElement)
{ {
aPseudoElement = mEvent->AsTransitionEvent()->pseudoElement; aPseudoElement = mEvent->AsTransitionEvent()->pseudoElement;
return NS_OK; return NS_OK;
} }
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult nsresult
NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult, NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner, EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
InternalTransitionEvent* aEvent) InternalTransitionEvent* aEvent)
{ {
nsDOMTransitionEvent *it = TransitionEvent *it = new TransitionEvent(aOwner, aPresContext, aEvent);
new nsDOMTransitionEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult); return CallQueryInterface(it, aInstancePtrResult);
} }

View File

@ -2,8 +2,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMTransitionEvent_h_ #ifndef mozilla_dom_TransitionEvent_h_
#define nsDOMTransitionEvent_h_ #define mozilla_dom_TransitionEvent_h_
#include "nsDOMEvent.h" #include "nsDOMEvent.h"
#include "nsIDOMTransitionEvent.h" #include "nsIDOMTransitionEvent.h"
@ -12,28 +12,31 @@
class nsAString; class nsAString;
class nsDOMTransitionEvent : public nsDOMEvent, namespace mozilla {
namespace dom {
class TransitionEvent : public nsDOMEvent,
public nsIDOMTransitionEvent public nsIDOMTransitionEvent
{ {
public: public:
nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner, TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
mozilla::InternalTransitionEvent* aEvent); InternalTransitionEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_TO_NSDOMEVENT NS_FORWARD_TO_NSDOMEVENT
NS_DECL_NSIDOMTRANSITIONEVENT NS_DECL_NSIDOMTRANSITIONEVENT
static already_AddRefed<nsDOMTransitionEvent> static already_AddRefed<TransitionEvent>
Constructor(const mozilla::dom::GlobalObject& aGlobal, Constructor(const GlobalObject& aGlobal,
const nsAString& aType, const nsAString& aType,
const mozilla::dom::TransitionEventInit& aParam, const TransitionEventInit& aParam,
mozilla::ErrorResult& aRv); ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::TransitionEventBinding::Wrap(aCx, aScope, this); return TransitionEventBinding::Wrap(aCx, aScope, this);
} }
// xpidl implementation // xpidl implementation
@ -43,4 +46,7 @@ public:
float ElapsedTime(); float ElapsedTime();
}; };
#endif /* !defined(nsDOMTransitionEvent_h_) */ } // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TransitionEvent_h_

View File

@ -5,28 +5,33 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "nsCOMPtr.h" #include "mozilla/dom/UIEvent.h"
#include "nsDOMUIEvent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMWindow.h"
#include "nsIDOMNode.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsEventStateManager.h"
#include "nsIContent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMWindow.h"
#include "nsIDOMNode.h"
#include "nsIFrame.h"
#include "prtime.h" #include "prtime.h"
using namespace mozilla; namespace mozilla {
namespace dom {
nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner, UIEvent::UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext, WidgetGUIEvent* aEvent) nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext, : nsDOMEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, 0)) aEvent ? aEvent : new InternalUIEvent(false, 0))
, mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0), mMovementPoint(0, 0) , mClientPoint(0, 0)
, mLayerPoint(0, 0)
, mPagePoint(0, 0)
, mMovementPoint(0, 0)
, mIsPointerLocked(nsEventStateManager::sIsPointerLocked) , mIsPointerLocked(nsEventStateManager::sIsPointerLocked)
, mLastClientPoint(nsEventStateManager::sLastClientPoint) , mLastClientPoint(nsEventStateManager::sLastClientPoint)
{ {
@ -74,14 +79,14 @@ nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
} }
// static // static
already_AddRefed<nsDOMUIEvent> already_AddRefed<UIEvent>
nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal, UIEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType, const nsAString& aType,
const mozilla::dom::UIEventInit& aParam, const UIEventInit& aParam,
mozilla::ErrorResult& aRv) ErrorResult& aRv)
{ {
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports()); nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<nsDOMUIEvent> e = new nsDOMUIEvent(t, nullptr, nullptr); nsRefPtr<UIEvent> e = new UIEvent(t, nullptr, nullptr);
bool trusted = e->Init(t); bool trusted = e->Init(t);
aRv = e->InitUIEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView, aRv = e->InitUIEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
aParam.mDetail); aParam.mDetail);
@ -89,13 +94,13 @@ nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
return e.forget(); return e.forget();
} }
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMUIEvent, nsDOMEvent, NS_IMPL_CYCLE_COLLECTION_INHERITED_1(UIEvent, nsDOMEvent,
mView) mView)
NS_IMPL_ADDREF_INHERITED(nsDOMUIEvent, nsDOMEvent) NS_IMPL_ADDREF_INHERITED(UIEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent, nsDOMEvent) NS_IMPL_RELEASE_INHERITED(UIEvent, nsDOMEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(UIEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
@ -108,7 +113,7 @@ DevPixelsToCSSPixels(const LayoutDeviceIntPoint& aPoint,
} }
nsIntPoint nsIntPoint
nsDOMUIEvent::GetMovementPoint() UIEvent::GetMovementPoint()
{ {
if (mPrivateDataDuplicated) { if (mPrivateDataDuplicated) {
return mMovementPoint; return mMovementPoint;
@ -132,7 +137,7 @@ nsDOMUIEvent::GetMovementPoint()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetView(nsIDOMWindow** aView) UIEvent::GetView(nsIDOMWindow** aView)
{ {
*aView = mView; *aView = mView;
NS_IF_ADDREF(*aView); NS_IF_ADDREF(*aView);
@ -140,14 +145,14 @@ nsDOMUIEvent::GetView(nsIDOMWindow** aView)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetDetail(int32_t* aDetail) UIEvent::GetDetail(int32_t* aDetail)
{ {
*aDetail = mDetail; *aDetail = mDetail;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::InitUIEvent(const nsAString& typeArg, UIEvent::InitUIEvent(const nsAString& typeArg,
bool canBubbleArg, bool canBubbleArg,
bool cancelableArg, bool cancelableArg,
nsIDOMWindow* viewArg, nsIDOMWindow* viewArg,
@ -166,9 +171,8 @@ nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
return NS_OK; return NS_OK;
} }
// ---- nsDOMNSUIEvent implementation -------------------
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetPageX(int32_t* aPageX) UIEvent::GetPageX(int32_t* aPageX)
{ {
NS_ENSURE_ARG_POINTER(aPageX); NS_ENSURE_ARG_POINTER(aPageX);
*aPageX = PageX(); *aPageX = PageX();
@ -176,7 +180,7 @@ nsDOMUIEvent::GetPageX(int32_t* aPageX)
} }
int32_t int32_t
nsDOMUIEvent::PageX() const UIEvent::PageX() const
{ {
if (mPrivateDataDuplicated) { if (mPrivateDataDuplicated) {
return mPagePoint.x; return mPagePoint.x;
@ -189,7 +193,7 @@ nsDOMUIEvent::PageX() const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetPageY(int32_t* aPageY) UIEvent::GetPageY(int32_t* aPageY)
{ {
NS_ENSURE_ARG_POINTER(aPageY); NS_ENSURE_ARG_POINTER(aPageY);
*aPageY = PageY(); *aPageY = PageY();
@ -197,7 +201,7 @@ nsDOMUIEvent::GetPageY(int32_t* aPageY)
} }
int32_t int32_t
nsDOMUIEvent::PageY() const UIEvent::PageY() const
{ {
if (mPrivateDataDuplicated) { if (mPrivateDataDuplicated) {
return mPagePoint.y; return mPagePoint.y;
@ -210,7 +214,7 @@ nsDOMUIEvent::PageY() const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetWhich(uint32_t* aWhich) UIEvent::GetWhich(uint32_t* aWhich)
{ {
NS_ENSURE_ARG_POINTER(aWhich); NS_ENSURE_ARG_POINTER(aWhich);
*aWhich = Which(); *aWhich = Which();
@ -218,7 +222,7 @@ nsDOMUIEvent::GetWhich(uint32_t* aWhich)
} }
already_AddRefed<nsINode> already_AddRefed<nsINode>
nsDOMUIEvent::GetRangeParent() UIEvent::GetRangeParent()
{ {
nsIFrame* targetFrame = nullptr; nsIFrame* targetFrame = nullptr;
@ -243,7 +247,7 @@ nsDOMUIEvent::GetRangeParent()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent) UIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
{ {
NS_ENSURE_ARG_POINTER(aRangeParent); NS_ENSURE_ARG_POINTER(aRangeParent);
*aRangeParent = nullptr; *aRangeParent = nullptr;
@ -255,7 +259,7 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset) UIEvent::GetRangeOffset(int32_t* aRangeOffset)
{ {
NS_ENSURE_ARG_POINTER(aRangeOffset); NS_ENSURE_ARG_POINTER(aRangeOffset);
*aRangeOffset = RangeOffset(); *aRangeOffset = RangeOffset();
@ -263,7 +267,7 @@ nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
} }
int32_t int32_t
nsDOMUIEvent::RangeOffset() const UIEvent::RangeOffset() const
{ {
if (!mPresContext) { if (!mPresContext) {
return 0; return 0;
@ -280,7 +284,7 @@ nsDOMUIEvent::RangeOffset() const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble) UIEvent::GetCancelBubble(bool* aCancelBubble)
{ {
NS_ENSURE_ARG_POINTER(aCancelBubble); NS_ENSURE_ARG_POINTER(aCancelBubble);
*aCancelBubble = CancelBubble(); *aCancelBubble = CancelBubble();
@ -288,14 +292,14 @@ nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::SetCancelBubble(bool aCancelBubble) UIEvent::SetCancelBubble(bool aCancelBubble)
{ {
mEvent->mFlags.mPropagationStopped = aCancelBubble; mEvent->mFlags.mPropagationStopped = aCancelBubble;
return NS_OK; return NS_OK;
} }
nsIntPoint nsIntPoint
nsDOMUIEvent::GetLayerPoint() const UIEvent::GetLayerPoint() const
{ {
if (!mEvent || if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT && (mEvent->eventStructType != NS_MOUSE_EVENT &&
@ -320,7 +324,7 @@ nsDOMUIEvent::GetLayerPoint() const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetLayerX(int32_t* aLayerX) UIEvent::GetLayerX(int32_t* aLayerX)
{ {
NS_ENSURE_ARG_POINTER(aLayerX); NS_ENSURE_ARG_POINTER(aLayerX);
*aLayerX = GetLayerPoint().x; *aLayerX = GetLayerPoint().x;
@ -328,7 +332,7 @@ nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetLayerY(int32_t* aLayerY) UIEvent::GetLayerY(int32_t* aLayerY)
{ {
NS_ENSURE_ARG_POINTER(aLayerY); NS_ENSURE_ARG_POINTER(aLayerY);
*aLayerY = GetLayerPoint().y; *aLayerY = GetLayerPoint().y;
@ -336,14 +340,14 @@ nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::GetIsChar(bool* aIsChar) UIEvent::GetIsChar(bool* aIsChar)
{ {
*aIsChar = IsChar(); *aIsChar = IsChar();
return NS_OK; return NS_OK;
} }
bool bool
nsDOMUIEvent::IsChar() const UIEvent::IsChar() const
{ {
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent(); WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
if (keyEvent) { if (keyEvent) {
@ -354,7 +358,7 @@ nsDOMUIEvent::IsChar() const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMUIEvent::DuplicatePrivateData() UIEvent::DuplicatePrivateData()
{ {
mClientPoint = nsDOMEvent::GetClientCoords(mPresContext, mClientPoint = nsDOMEvent::GetClientCoords(mPresContext,
mEvent, mEvent,
@ -378,7 +382,7 @@ nsDOMUIEvent::DuplicatePrivateData()
} }
NS_IMETHODIMP_(void) NS_IMETHODIMP_(void)
nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) UIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
{ {
if (aSerializeInterfaceType) { if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent")); IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
@ -392,7 +396,7 @@ nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
} }
NS_IMETHODIMP_(bool) NS_IMETHODIMP_(bool)
nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter) UIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
{ {
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false); NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), false); NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), false);
@ -400,14 +404,14 @@ nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
} }
// XXX Following struct and array are used only in // XXX Following struct and array are used only in
// nsDOMUIEvent::ComputeModifierState(), but if we define them in it, // UIEvent::ComputeModifierState(), but if we define them in it,
// we fail to build on Mac at calling mozilla::ArrayLength(). // we fail to build on Mac at calling mozilla::ArrayLength().
struct nsModifierPair struct ModifierPair
{ {
mozilla::Modifier modifier; Modifier modifier;
const char* name; const char* name;
}; };
static const nsModifierPair kPairs[] = { static const ModifierPair kPairs[] = {
{ MODIFIER_ALT, NS_DOM_KEYNAME_ALT }, { MODIFIER_ALT, NS_DOM_KEYNAME_ALT },
{ MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH }, { MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH },
{ MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK }, { MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK },
@ -421,9 +425,9 @@ static const nsModifierPair kPairs[] = {
{ MODIFIER_OS, NS_DOM_KEYNAME_OS } { MODIFIER_OS, NS_DOM_KEYNAME_OS }
}; };
/* static */ // static
mozilla::Modifiers Modifiers
nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList) UIEvent::ComputeModifierState(const nsAString& aModifiersList)
{ {
if (aModifiersList.IsEmpty()) { if (aModifiersList.IsEmpty()) {
return 0; return 0;
@ -439,7 +443,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
aModifiersList.BeginReading(listStart); aModifiersList.BeginReading(listStart);
aModifiersList.EndReading(listEnd); aModifiersList.EndReading(listEnd);
for (uint32_t i = 0; i < mozilla::ArrayLength(kPairs); i++) { for (uint32_t i = 0; i < ArrayLength(kPairs); i++) {
nsAString::const_iterator start(listStart), end(listEnd); nsAString::const_iterator start(listStart), end(listEnd);
if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) { if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) {
continue; continue;
@ -456,7 +460,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
} }
bool bool
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey) UIEvent::GetModifierStateInternal(const nsAString& aKey)
{ {
WidgetInputEvent* inputEvent = mEvent->AsInputEvent(); WidgetInputEvent* inputEvent = mEvent->AsInputEvent();
MOZ_ASSERT(inputEvent, "mEvent must be WidgetInputEvent or derived class"); MOZ_ASSERT(inputEvent, "mEvent must be WidgetInputEvent or derived class");
@ -499,12 +503,18 @@ nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
return false; return false;
} }
} // namespace dom
} // namespace mozilla
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, using namespace mozilla;
mozilla::dom::EventTarget* aOwner, using namespace mozilla::dom;
nsresult
NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetGUIEvent* aEvent) WidgetGUIEvent* aEvent)
{ {
nsDOMUIEvent* it = new nsDOMUIEvent(aOwner, aPresContext, aEvent); UIEvent* it = new UIEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult); return CallQueryInterface(it, aInstancePtrResult);
} }

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMUIEvent_h #ifndef mozilla_dom_UIEvent_h_
#define nsDOMUIEvent_h #define mozilla_dom_UIEvent_h_
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "nsIDOMUIEvent.h" #include "nsIDOMUIEvent.h"
@ -16,17 +16,19 @@
class nsINode; class nsINode;
class nsDOMUIEvent : public nsDOMEvent, namespace mozilla {
namespace dom {
class UIEvent : public nsDOMEvent,
public nsIDOMUIEvent public nsIDOMUIEvent
{ {
typedef mozilla::CSSIntPoint CSSIntPoint;
public: public:
nsDOMUIEvent(mozilla::dom::EventTarget* aOwner, UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent); WidgetGUIEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMUIEvent, nsDOMEvent) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, nsDOMEvent)
// nsIDOMUIEvent Interface // nsIDOMUIEvent Interface
NS_DECL_NSIDOMUIEVENT NS_DECL_NSIDOMUIEVENT
@ -37,9 +39,8 @@ public:
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE; NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE; NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
static nsIntPoint static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
CalculateScreenPoint(nsPresContext* aPresContext, WidgetEvent* aEvent)
mozilla::WidgetEvent* aEvent)
{ {
if (!aEvent || if (!aEvent ||
(aEvent->eventStructType != NS_MOUSE_EVENT && (aEvent->eventStructType != NS_MOUSE_EVENT &&
@ -51,20 +52,21 @@ public:
return nsIntPoint(0, 0); return nsIntPoint(0, 0);
} }
mozilla::WidgetGUIEvent* event = aEvent->AsGUIEvent(); WidgetGUIEvent* event = aEvent->AsGUIEvent();
if (!event->widget) { if (!event->widget) {
return mozilla::LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint); return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
} }
mozilla::LayoutDeviceIntPoint offset = aEvent->refPoint + LayoutDeviceIntPoint offset = aEvent->refPoint +
mozilla::LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset()); LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
nscoord factor = aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel(); nscoord factor =
aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor), return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor)); nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
} }
static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext, static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent, WidgetEvent* aEvent,
CSSIntPoint* aDefaultClientPoint) CSSIntPoint* aDefaultClientPoint)
{ {
if (!aEvent || if (!aEvent ||
@ -95,15 +97,15 @@ public:
return CSSIntPoint::FromAppUnitsRounded(pt); return CSSIntPoint::FromAppUnitsRounded(pt);
} }
static already_AddRefed<nsDOMUIEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal, static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
const nsAString& aType, const nsAString& aType,
const mozilla::dom::UIEventInit& aParam, const UIEventInit& aParam,
mozilla::ErrorResult& aRv); ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::UIEventBinding::Wrap(aCx, aScope, this); return UIEventBinding::Wrap(aCx, aScope, this);
} }
nsIDOMWindow* GetView() const nsIDOMWindow* GetView() const
@ -164,27 +166,29 @@ protected:
bool mIsPointerLocked; bool mIsPointerLocked;
CSSIntPoint mLastClientPoint; CSSIntPoint mLastClientPoint;
typedef mozilla::Modifiers Modifiers;
static Modifiers ComputeModifierState(const nsAString& aModifiersList); static Modifiers ComputeModifierState(const nsAString& aModifiersList);
bool GetModifierStateInternal(const nsAString& aKey); bool GetModifierStateInternal(const nsAString& aKey);
}; };
#define NS_FORWARD_TO_NSDOMUIEVENT \ } // namespace dom
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \ } // namespace mozilla
#define NS_FORWARD_TO_UIEVENT \
NS_FORWARD_NSIDOMUIEVENT(UIEvent::) \
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION \ NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION \
NS_IMETHOD DuplicatePrivateData() \ NS_IMETHOD DuplicatePrivateData() \
{ \ { \
return nsDOMUIEvent::DuplicatePrivateData(); \ return UIEvent::DuplicatePrivateData(); \
} \ } \
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, \ NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, \
bool aSerializeInterfaceType) \ bool aSerializeInterfaceType) \
{ \ { \
nsDOMUIEvent::Serialize(aMsg, aSerializeInterfaceType); \ UIEvent::Serialize(aMsg, aSerializeInterfaceType); \
} \ } \
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \ NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \
void** aIter) \ void** aIter) \
{ \ { \
return nsDOMUIEvent::Deserialize(aMsg, aIter); \ return UIEvent::Deserialize(aMsg, aIter); \
} }
#endif // nsDOMUIEvent_h #endif // mozilla_dom_UIEvent_h_

View File

@ -0,0 +1,139 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XULCommandEvent.h"
#include "prtime.h"
namespace mozilla {
namespace dom {
XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
}
}
NS_IMPL_ADDREF_INHERITED(XULCommandEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(XULCommandEvent, UIEvent)
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(XULCommandEvent, UIEvent,
mSourceEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULCommandEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMXULCommandEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
bool
XULCommandEvent::AltKey()
{
return mEvent->AsInputEvent()->IsAlt();
}
NS_IMETHODIMP
XULCommandEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = AltKey();
return NS_OK;
}
bool
XULCommandEvent::CtrlKey()
{
return mEvent->AsInputEvent()->IsControl();
}
NS_IMETHODIMP
XULCommandEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = CtrlKey();
return NS_OK;
}
bool
XULCommandEvent::ShiftKey()
{
return mEvent->AsInputEvent()->IsShift();
}
NS_IMETHODIMP
XULCommandEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ShiftKey();
return NS_OK;
}
bool
XULCommandEvent::MetaKey()
{
return mEvent->AsInputEvent()->IsMeta();
}
NS_IMETHODIMP
XULCommandEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = MetaKey();
return NS_OK;
}
NS_IMETHODIMP
XULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
{
NS_ENSURE_ARG_POINTER(aSourceEvent);
*aSourceEvent = GetSourceEvent().get();
return NS_OK;
}
NS_IMETHODIMP
XULCommandEvent::InitCommandEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
nsIDOMEvent* aSourceEvent)
{
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
aShiftKey, aMetaKey);
mSourceEvent = aSourceEvent;
return NS_OK;
}
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetInputEvent* aEvent)
{
XULCommandEvent* it = new XULCommandEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -6,32 +6,35 @@
// This class implements a XUL "command" event. See nsIDOMXULCommandEvent.idl // This class implements a XUL "command" event. See nsIDOMXULCommandEvent.idl
#ifndef nsDOMXULCommandEvent_h_ #ifndef mozilla_dom_XULCommandEvent_h_
#define nsDOMXULCommandEvent_h_ #define mozilla_dom_XULCommandEvent_h_
#include "nsDOMUIEvent.h" #include "mozilla/dom/UIEvent.h"
#include "nsIDOMXULCommandEvent.h"
#include "mozilla/dom/XULCommandEventBinding.h" #include "mozilla/dom/XULCommandEventBinding.h"
#include "nsIDOMXULCommandEvent.h"
class nsDOMXULCommandEvent : public nsDOMUIEvent, namespace mozilla {
namespace dom {
class XULCommandEvent : public UIEvent,
public nsIDOMXULCommandEvent public nsIDOMXULCommandEvent
{ {
public: public:
nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner, XULCommandEvent(EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
mozilla::WidgetInputEvent* aEvent); WidgetInputEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
NS_DECL_NSIDOMXULCOMMANDEVENT NS_DECL_NSIDOMXULCOMMANDEVENT
// Forward our inherited virtual methods to the base class // Forward our inherited virtual methods to the base class
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::XULCommandEventBinding::Wrap(aCx, aScope, this); return XULCommandEventBinding::Wrap(aCx, aScope, this);
} }
bool AltKey(); bool AltKey();
@ -53,7 +56,7 @@ public:
bool aCtrlKey, bool aAltKey, bool aCtrlKey, bool aAltKey,
bool aShiftKey, bool aMetaKey, bool aShiftKey, bool aMetaKey,
nsDOMEvent* aSourceEvent, nsDOMEvent* aSourceEvent,
mozilla::ErrorResult& aRv) ErrorResult& aRv)
{ {
aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail, aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail,
aCtrlKey, aAltKey, aShiftKey, aMetaKey, aCtrlKey, aAltKey, aShiftKey, aMetaKey,
@ -64,4 +67,7 @@ protected:
nsCOMPtr<nsIDOMEvent> mSourceEvent; nsCOMPtr<nsIDOMEvent> mSourceEvent;
}; };
#endif // nsDOMXULCommandEvent_h_ } // namespace dom
} // namespace mozilla
#endif // mozilla_dom_XULCommandEvent_h_

View File

@ -18,8 +18,6 @@ EXPORTS += [
'nsDOMEvent.h', 'nsDOMEvent.h',
'nsDOMEventTargetHelper.h', 'nsDOMEventTargetHelper.h',
'nsDOMKeyNameList.h', 'nsDOMKeyNameList.h',
'nsDOMTouchEvent.h',
'nsDOMUIEvent.h',
'nsEventDispatcher.h', 'nsEventDispatcher.h',
'nsEventListenerManager.h', 'nsEventListenerManager.h',
'nsEventNameList.h', 'nsEventNameList.h',
@ -52,10 +50,17 @@ EXPORTS.mozilla.dom += [
'MouseEvent.h', 'MouseEvent.h',
'MouseScrollEvent.h', 'MouseScrollEvent.h',
'MutationEvent.h', 'MutationEvent.h',
'NotifyAudioAvailableEvent.h',
'NotifyPaintEvent.h',
'PointerEvent.h', 'PointerEvent.h',
'ScrollAreaEvent.h',
'SimpleGestureEvent.h', 'SimpleGestureEvent.h',
'Touch.h', 'Touch.h',
'TouchEvent.h',
'TransitionEvent.h',
'UIEvent.h',
'WheelEvent.h', 'WheelEvent.h',
'XULCommandEvent.h',
] ]
if CONFIG['MOZ_WEBSPEECH']: if CONFIG['MOZ_WEBSPEECH']:
@ -78,14 +83,11 @@ UNIFIED_SOURCES += [
'MouseEvent.cpp', 'MouseEvent.cpp',
'MouseScrollEvent.cpp', 'MouseScrollEvent.cpp',
'MutationEvent.cpp', 'MutationEvent.cpp',
'NotifyAudioAvailableEvent.cpp',
'nsAsyncDOMEvent.cpp', 'nsAsyncDOMEvent.cpp',
'nsContentEventHandler.cpp', 'nsContentEventHandler.cpp',
'nsDOMEventTargetHelper.cpp', 'nsDOMEventTargetHelper.cpp',
'nsDOMNotifyAudioAvailableEvent.cpp',
'nsDOMTextEvent.cpp', 'nsDOMTextEvent.cpp',
'nsDOMTouchEvent.cpp',
'nsDOMTransitionEvent.cpp',
'nsDOMXULCommandEvent.cpp',
'nsEventDispatcher.cpp', 'nsEventDispatcher.cpp',
'nsEventListenerService.cpp', 'nsEventListenerService.cpp',
'nsIMEStateManager.cpp', 'nsIMEStateManager.cpp',
@ -96,28 +98,31 @@ UNIFIED_SOURCES += [
'SimpleGestureEvent.cpp', 'SimpleGestureEvent.cpp',
'TextComposition.cpp', 'TextComposition.cpp',
'Touch.cpp', 'Touch.cpp',
'TouchEvent.cpp',
'TransitionEvent.cpp',
'WheelEvent.cpp', 'WheelEvent.cpp',
'XULCommandEvent.cpp',
] ]
SOURCES += [ SOURCES += [
# nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'NotifyPaintEvent.cpp',
# nsDOMEvent.cpp should be built separately because it includes # nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h. # ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'nsDOMEvent.cpp', 'nsDOMEvent.cpp',
# nsDOMEvent.cpp should be built separately because it includes # nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'nsDOMNotifyPaintEvent.cpp',
# nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'nsDOMScrollAreaEvent.cpp',
# nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'nsDOMUIEvent.cpp',
# nsDOMEvent.cpp should be built separately because it includes
# mozilla/HalSensor.h, which includes ipc/IPCMessageUtils.h, which # mozilla/HalSensor.h, which includes ipc/IPCMessageUtils.h, which
# on Windows includes windows.h. # on Windows includes windows.h.
'nsEventListenerManager.cpp', 'nsEventListenerManager.cpp',
# nsEventStateManager.cpp should be built separately because of Mac OS X headers. # nsEventStateManager.cpp should be built separately because of Mac OS X headers.
'nsEventStateManager.cpp', 'nsEventStateManager.cpp',
# nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'ScrollAreaEvent.cpp',
# nsDOMEvent.cpp should be built separately because it includes
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
'UIEvent.cpp',
] ]
if CONFIG['MOZ_WEBSPEECH']: if CONFIG['MOZ_WEBSPEECH']:

View File

@ -1,169 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMNotifyAudioAvailableEvent.h"
#include "nsError.h"
#include "mozilla/HoldDropJSObjects.h"
#include "jsfriendapi.h"
using namespace mozilla;
using namespace mozilla::dom;
nsDOMNotifyAudioAvailableEvent::nsDOMNotifyAudioAvailableEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime)
: nsDOMEvent(aOwner, aPresContext, aEvent),
mFrameBuffer(aFrameBuffer),
mFrameBufferLength(aFrameBufferLength),
mTime(aTime),
mCachedArray(nullptr),
mAllowAudioData(false)
{
MOZ_COUNT_CTOR(nsDOMNotifyAudioAvailableEvent);
if (mEvent) {
mEvent->message = aEventType;
}
}
NS_IMPL_ADDREF_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMNotifyAudioAvailableEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
if (tmp->mCachedArray) {
tmp->mCachedArray = nullptr;
mozilla::DropJSObjects(tmp);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCachedArray)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMNotifyAudioAvailableEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNotifyAudioAvailableEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
nsDOMNotifyAudioAvailableEvent::~nsDOMNotifyAudioAvailableEvent()
{
MOZ_COUNT_DTOR(nsDOMNotifyAudioAvailableEvent);
if (mCachedArray) {
mCachedArray = nullptr;
mozilla::DropJSObjects(this);
}
}
NS_IMETHODIMP
nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, JS::MutableHandle<JS::Value> aResult)
{
if (!mAllowAudioData) {
// Media is not same-origin, don't allow the data out.
return NS_ERROR_DOM_SECURITY_ERR;
}
if (mCachedArray) {
aResult.setObject(*mCachedArray);
return NS_OK;
}
// Cache this array so we don't recreate on next call.
mozilla::HoldJSObjects(this);
mCachedArray = JS_NewFloat32Array(aCx, mFrameBufferLength);
if (!mCachedArray) {
mozilla::DropJSObjects(this);
return NS_ERROR_FAILURE;
}
memcpy(JS_GetFloat32ArrayData(mCachedArray), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
aResult.setObject(*mCachedArray);
return NS_OK;
}
NS_IMETHODIMP
nsDOMNotifyAudioAvailableEvent::GetTime(float *aRetVal)
{
*aRetVal = Time();
return NS_OK;
}
NS_IMETHODIMP
nsDOMNotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime,
bool aAllowAudioData)
{
// Auto manage the memory which stores the frame buffer. This ensures
// that if we exit due to some error, the memory will be freed. Otherwise,
// the framebuffer's memory will be freed when this event is destroyed.
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
NS_ENSURE_SUCCESS(rv, rv);
mFrameBuffer = frameBuffer.forget();
mFrameBufferLength = aFrameBufferLength;
mTime = aTime;
mAllowAudioData = aAllowAudioData;
mCachedArray = nullptr;
return NS_OK;
}
void
nsDOMNotifyAudioAvailableEvent::InitAudioAvailableEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const Nullable<Sequence<float> >& aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime,
bool aAllowAudioData,
ErrorResult& aRv)
{
if ((aFrameBuffer.IsNull() && aFrameBufferLength > 0) ||
(!aFrameBuffer.IsNull() &&
aFrameBuffer.Value().Length() < aFrameBufferLength)) {
aRv = NS_ERROR_UNEXPECTED;
return;
}
nsAutoArrayPtr<float> buffer;
if (!aFrameBuffer.IsNull()) {
buffer = new float[aFrameBufferLength];
memcpy(buffer.get(), aFrameBuffer.Value().Elements(),
aFrameBufferLength * sizeof(float));
}
aRv = InitAudioAvailableEvent(aType, aCanBubble, aCancelable,
buffer.forget(),
aFrameBufferLength,
aTime, aAllowAudioData);
}
nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
float* aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime)
{
nsDOMNotifyAudioAvailableEvent* it =
new nsDOMNotifyAudioAvailableEvent(aOwner, aPresContext, aEvent, aEventType,
aFrameBuffer, aFrameBufferLength, aTime);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMNotifyAudioAvailableEvent_h_
#define nsDOMNotifyAudioAvailableEvent_h_
#include "nsIDOMNotifyAudioAvailableEvent.h"
#include "nsDOMEvent.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
class nsPresContext;
class nsDOMNotifyAudioAvailableEvent : public nsDOMEvent,
public nsIDOMNotifyAudioAvailableEvent
{
public:
nsDOMNotifyAudioAvailableEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
uint32_t aEventType, float * aFrameBuffer,
uint32_t aFrameBufferLength, float aTime);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMNotifyAudioAvailableEvent,
nsDOMEvent)
NS_DECL_NSIDOMNOTIFYAUDIOAVAILABLEEVENT
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
nsresult NS_NewDOMAudioAvailableEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
uint32_t aEventType,
float * aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime);
~nsDOMNotifyAudioAvailableEvent();
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::NotifyAudioAvailableEventBinding::Wrap(aCx, aScope, this);
}
JSObject* GetFrameBuffer(JSContext* aCx, mozilla::ErrorResult& aRv)
{
JS::Rooted<JS::Value> dummy(aCx);
aRv = GetFrameBuffer(aCx, &dummy);
return mCachedArray;
}
float Time()
{
return mTime;
}
void InitAudioAvailableEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const mozilla::dom::Nullable<mozilla::dom::Sequence<float> >& aFrameBuffer,
uint32_t aFrameBufferLength,
float aTime,
bool aAllowAudioData,
mozilla::ErrorResult& aRv);
private:
nsAutoArrayPtr<float> mFrameBuffer;
uint32_t mFrameBufferLength;
float mTime;
JS::Heap<JSObject*> mCachedArray;
bool mAllowAudioData;
};
#endif // nsDOMNotifyAudioAvailableEvent_h_

View File

@ -10,11 +10,12 @@
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom;
nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner, nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
WidgetTextEvent* aEvent) WidgetTextEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, : UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr)) aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
{ {
NS_ASSERTION(mEvent->eventStructType == NS_TEXT_EVENT, "event type mismatch"); NS_ASSERTION(mEvent->eventStructType == NS_TEXT_EVENT, "event type mismatch");
@ -53,12 +54,12 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
} }
} }
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, nsDOMUIEvent) NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, nsDOMUIEvent) NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMTextEvent) NS_INTERFACE_MAP_BEGIN(nsDOMTextEvent)
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent) NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_METHOD nsDOMTextEvent::GetText(nsString& aText) NS_METHOD nsDOMTextEvent::GetText(nsString& aText)
{ {

View File

@ -6,15 +6,17 @@
#ifndef nsDOMTextEvent_h__ #ifndef nsDOMTextEvent_h__
#define nsDOMTextEvent_h__ #define nsDOMTextEvent_h__
#include "mozilla/dom/UIEvent.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "nsDOMUIEvent.h"
#include "nsIPrivateTextEvent.h" #include "nsIPrivateTextEvent.h"
#include "nsPrivateTextRange.h" #include "nsPrivateTextRange.h"
class nsDOMTextEvent : public nsDOMUIEvent, class nsDOMTextEvent : public mozilla::dom::UIEvent,
public nsIPrivateTextEvent public nsIPrivateTextEvent
{ {
typedef mozilla::dom::UIEvent UIEvent;
public: public:
nsDOMTextEvent(mozilla::dom::EventTarget* aOwner, nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@ -23,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
// Forward to base class // Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT NS_FORWARD_TO_UIEVENT
// nsIPrivateTextEvent interface // nsIPrivateTextEvent interface
NS_IMETHOD GetText(nsString& aText) MOZ_OVERRIDE; NS_IMETHOD GetText(nsString& aText) MOZ_OVERRIDE;

View File

@ -1,130 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMXULCommandEvent.h"
#include "prtime.h"
using namespace mozilla;
nsDOMXULCommandEvent::nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetInputEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
}
}
NS_IMPL_ADDREF_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMXULCommandEvent, nsDOMUIEvent,
mSourceEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMXULCommandEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMXULCommandEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
bool
nsDOMXULCommandEvent::AltKey()
{
return mEvent->AsInputEvent()->IsAlt();
}
NS_IMETHODIMP
nsDOMXULCommandEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = AltKey();
return NS_OK;
}
bool
nsDOMXULCommandEvent::CtrlKey()
{
return mEvent->AsInputEvent()->IsControl();
}
NS_IMETHODIMP
nsDOMXULCommandEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = CtrlKey();
return NS_OK;
}
bool
nsDOMXULCommandEvent::ShiftKey()
{
return mEvent->AsInputEvent()->IsShift();
}
NS_IMETHODIMP
nsDOMXULCommandEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ShiftKey();
return NS_OK;
}
bool
nsDOMXULCommandEvent::MetaKey()
{
return mEvent->AsInputEvent()->IsMeta();
}
NS_IMETHODIMP
nsDOMXULCommandEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = MetaKey();
return NS_OK;
}
NS_IMETHODIMP
nsDOMXULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
{
NS_ENSURE_ARG_POINTER(aSourceEvent);
*aSourceEvent = GetSourceEvent().get();
return NS_OK;
}
NS_IMETHODIMP
nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType,
bool aCanBubble, bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
bool aCtrlKey, bool aAltKey,
bool aShiftKey, bool aMetaKey,
nsIDOMEvent* aSourceEvent)
{
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
aShiftKey, aMetaKey);
mSourceEvent = aSourceEvent;
return NS_OK;
}
nsresult NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetInputEvent* aEvent)
{
nsDOMXULCommandEvent* it =
new nsDOMXULCommandEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -14,11 +14,11 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsINode.h" #include "nsINode.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsDOMTouchEvent.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#include "GeneratedEvents.h" #include "GeneratedEvents.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "mozilla/dom/EventTarget.h" #include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/InternalMutationEvent.h" #include "mozilla/InternalMutationEvent.h"
#include "mozilla/MiscEvents.h" #include "mozilla/MiscEvents.h"
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
@ -818,7 +818,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
if (aEventType.LowerCaseEqualsLiteral("closeevent")) if (aEventType.LowerCaseEqualsLiteral("closeevent"))
return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr); return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr);
if (aEventType.LowerCaseEqualsLiteral("touchevent") && if (aEventType.LowerCaseEqualsLiteral("touchevent") &&
nsDOMTouchEvent::PrefEnabled()) TouchEvent::PrefEnabled())
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext, nullptr); return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext, nullptr);
if (aEventType.LowerCaseEqualsLiteral("hashchangeevent")) if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
return NS_NewDOMHashChangeEvent(aDOMEvent, aOwner, aPresContext, nullptr); return NS_NewDOMHashChangeEvent(aDOMEvent, aOwner, aPresContext, nullptr);

View File

@ -11,6 +11,7 @@
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "mozilla/dom/TabParent.h" #include "mozilla/dom/TabParent.h"
#include "mozilla/dom/UIEvent.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsEventStateManager.h" #include "nsEventStateManager.h"
@ -50,7 +51,6 @@
#include "nsIDOMWheelEvent.h" #include "nsIDOMWheelEvent.h"
#include "nsIDOMDragEvent.h" #include "nsIDOMDragEvent.h"
#include "nsIDOMUIEvent.h" #include "nsIDOMUIEvent.h"
#include "nsDOMUIEvent.h"
#include "nsIMozBrowserFrame.h" #include "nsIMozBrowserFrame.h"
#include "nsSubDocumentFrame.h" #include "nsSubDocumentFrame.h"
@ -1030,9 +1030,9 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
aEvent->eventStructType == NS_WHEEL_EVENT) && aEvent->eventStructType == NS_WHEEL_EVENT) &&
!sIsPointerLocked) { !sIsPointerLocked) {
sLastScreenPoint = sLastScreenPoint =
nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent); UIEvent::CalculateScreenPoint(aPresContext, aEvent);
sLastClientPoint = sLastClientPoint =
nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr); UIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
} }
// Do not take account NS_MOUSE_ENTER/EXIT so that loading a page // Do not take account NS_MOUSE_ENTER/EXIT so that loading a page
@ -2337,9 +2337,9 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
// target of the mouse event. If one wasn't set in the // target of the mouse event. If one wasn't set in the
// aDataTransfer during the event handler, just use the original // aDataTransfer during the event handler, just use the original
// target instead. // target instead.
nsCOMPtr<Element> dragTarget = aDataTransfer->GetDragTarget(); nsCOMPtr<nsIContent> dragTarget = aDataTransfer->GetDragTarget();
if (!dragTarget) { if (!dragTarget) {
dragTarget = do_QueryInterface(aDragTarget); dragTarget = aDragTarget;
if (!dragTarget) if (!dragTarget)
return false; return false;
} }
@ -4332,7 +4332,7 @@ nsEventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
// Returns the center point of the window's inner content area. // Returns the center point of the window's inner content area.
// This is in widget coordinates, i.e. relative to the widget's top // This is in widget coordinates, i.e. relative to the widget's top
// left corner, not in screen coordinates, the same units that // left corner, not in screen coordinates, the same units that
// nsDOMUIEvent::refPoint is in. // UIEvent::refPoint is in.
// //
// XXX Hack alert: XXX // XXX Hack alert: XXX
// However, we do the computation in integer CSS pixels, NOT device pix, // However, we do the computation in integer CSS pixels, NOT device pix,
@ -4386,7 +4386,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
case NS_MOUSE_MOVE: case NS_MOUSE_MOVE:
{ {
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields. // Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
// Movement is calculated in nsDOMUIEvent::GetMovementPoint() as: // Movement is calculated in UIEvent::GetMovementPoint() as:
// previous_mousemove_refPoint - current_mousemove_refPoint. // previous_mousemove_refPoint - current_mousemove_refPoint.
if (sIsPointerLocked && aMouseEvent->widget) { if (sIsPointerLocked && aMouseEvent->widget) {
// The pointer is locked. If the pointer is not located at the center of // The pointer is locked. If the pointer is not located at the center of

View File

@ -198,6 +198,7 @@ function testOnPointerProperty()
iframeBody.onpointerover = function (e) { gOnPointerPropHandled["pointerover"] = true; } iframeBody.onpointerover = function (e) { gOnPointerPropHandled["pointerover"] = true; }
iframeBody.onpointerenter = function (e) { gOnPointerPropHandled["pointerenter"] = true; } iframeBody.onpointerenter = function (e) { gOnPointerPropHandled["pointerenter"] = true; }
iframeBody.onpointerleave = function (e) { gOnPointerPropHandled["pointerleave"] = true; } iframeBody.onpointerleave = function (e) { gOnPointerPropHandled["pointerleave"] = true; }
iframeBody.onpointercancel = function (e) { gOnPointerPropHandled["pointercancel"] = true; }
iframeBody.dispatchEvent(getDefaultArgEvent("pointerdown")); iframeBody.dispatchEvent(getDefaultArgEvent("pointerdown"));
is(gOnPointerPropHandled['pointerdown'], true, "pointerdown property is performed"); is(gOnPointerPropHandled['pointerdown'], true, "pointerdown property is performed");
@ -220,6 +221,9 @@ function testOnPointerProperty()
iframeBody.dispatchEvent(getDefaultArgEvent("pointerleave")); iframeBody.dispatchEvent(getDefaultArgEvent("pointerleave"));
is(gOnPointerPropHandled['pointerleave'], true, "pointerleave property is performed"); is(gOnPointerPropHandled['pointerleave'], true, "pointerleave property is performed");
iframeBody.dispatchEvent(getDefaultArgEvent("pointercancel"));
is(gOnPointerPropHandled['pointercancel'], true, "pointercancel property is performed");
nextTest(); nextTest();
} }

View File

@ -166,7 +166,7 @@ function penter(evt) {
is(evt.target.id, t, "Wrong event target!"); is(evt.target.id, t, "Wrong event target!");
} }
is(evt.bubbles, false, evt.type + " should not bubble!"); is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, true, evt.type + " is cancelable!"); is(evt.cancelable, false, evt.type + " is cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!"); is(evt.target, evt.currentTarget, "Wrong event target!");
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument, ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
"Leaking nodes to another document?"); "Leaking nodes to another document?");
@ -183,7 +183,7 @@ function pleave(evt) {
is(evt.target.id, t, "Wrong event target!"); is(evt.target.id, t, "Wrong event target!");
} }
is(evt.bubbles, false, evt.type + " should not bubble!"); is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, true, evt.type + " is cancelable!"); is(evt.cancelable, false, evt.type + " is cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!"); is(evt.target, evt.currentTarget, "Wrong event target!");
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument, ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
"Leaking nodes to another document?"); "Leaking nodes to another document?");

Some files were not shown because too many files have changed in this diff Show More