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

View File

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

View File

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

View File

@ -50,6 +50,9 @@
<command id="cmd_findPrevious"
oncommand="gFindBar.onFindAgainCommand(true);"
observes="isImage"/>
#ifdef XP_MACOSX
<command id="cmd_findSelection" oncommand="gFindBar.onFindSelectionCommand();"/>
#endif
<!-- work-around bug 392512 -->
<command id="Browser:AddBookmarkAs"
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_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
<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_findPrevious" modifiers="shift"/>

View File

@ -973,7 +973,8 @@
</toolbar>
<!-- 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"/>
<statusbar id="status-bar"/>
</toolbar>

View File

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

View File

@ -2,7 +2,10 @@
* 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() {
waitForExplicitFinish();
@ -37,7 +40,10 @@ function onFocus(win) {
let findBar = win.gFindBar;
selectText(win.content);
findBar.onFindCommand();
is(findBar._findField.value, "Select Me", "Findbar is initialized with selection");
// 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");
findBar.close();
win.close();
finish();

View File

@ -153,6 +153,11 @@
<vbox id="PanelUI-developerItems" class="panel-subview-body"/>
</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">
<label value="&charsetMenu.label;" class="panel-subview-header"/>
<vbox class="panel-subview-body">

View File

@ -320,6 +320,75 @@ const CustomizableWidgets = [{
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",
shortcutId: "key_openAddons",
tooltiptext: "add-ons-button.tooltiptext2",
@ -831,7 +900,7 @@ const CustomizableWidgets = [{
#ifdef XP_WIN
#ifdef MOZ_METRO
if (Services.sysinfo.getProperty("hasWindowsTouchInterface")) {
if (Services.metro && Services.metro.supported) {
let widgetArgs = {tooltiptext: "switch-to-metro-button2.tooltiptext"};
let brandShortName = BrandBundle.GetStringFromName("brandShortName");
let metroTooltip = CustomizableUI.getLocalizedProperty(widgetArgs, "tooltiptext",

View File

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

View File

@ -69,4 +69,5 @@ skip-if = os == "linux"
[browser_969661_character_encoding_navbar_disabled.js]
[browser_970511_undo_restore_default.js]
[browser_972267_customizationchange_events.js]
[browser_973932_addonbar_currentset.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 = {
title: bundle.GetStringFromName("windows8TouchTitle"),
uri: NetUtil.newURI("place:folder=" +

View File

@ -63,10 +63,10 @@ let (XULAppInfo = {
}
// Smart bookmarks constants.
let isWin8OrHigher = Services.sysinfo.getProperty("hasWindowsTouchInterface");
let isMetroSupported = Services.metro && Services.metro.supported;
const SMART_BOOKMARKS_VERSION = 6
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.
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/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/SimpleListWidget.jsm");
Cu.import("resource:///modules/devtools/BreadcrumbsWidget.jsm");
@ -139,13 +138,6 @@ let DebuggerController = {
this.shutdownDebugger = this.shutdownDebugger.bind(this);
this._onTabNavigated = this._onTabNavigated.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;
}
// Chrome debugging lives in a different process and needs to handle
// 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.
}
});
return this._startup = DebuggerView.initialize();
},
/**
@ -186,12 +165,6 @@ let DebuggerController = {
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(() => {
DebuggerView.destroy();
this.SourceScripts.disconnect();
@ -199,22 +172,12 @@ let DebuggerController = {
this.ThreadState.disconnect();
this.Tracer.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,
* wiring event handlers as necessary.
*
* In case of a chrome debugger living in a different process, a socket
* connection pipe is opened as well.
* Initiates remote debugging based on the current target, wiring event
* handlers as necessary.
*
* @return object
* A promise that is resolved when the debugger finishes connecting.
@ -227,44 +190,27 @@ let DebuggerController = {
let startedDebugging = promise.defer();
this._connection = startedDebugging.promise;
if (!window._isChromeDebugger) {
let target = this._target;
let { client, form: { chromeDebugger, traceActor }, threadActor } = target;
target.on("close", this._onTabDetached);
target.on("navigate", this._onTabNavigated);
target.on("will-navigate", this._onTabNavigated);
this.client = client;
let target = this._target;
let { client, form: { chromeDebugger, traceActor } } = target;
target.on("close", this._onTabDetached);
target.on("navigate", this._onTabNavigated);
target.on("will-navigate", this._onTabNavigated);
this.client = client;
if (target.chrome) {
this._startChromeDebugging(chromeDebugger, startedDebugging.resolve);
if (target.chrome) {
this._startChromeDebugging(chromeDebugger, startedDebugging.resolve);
} else {
this._startDebuggingTab(startedDebugging.resolve);
const startedTracing = promise.defer();
if (Prefs.tracerEnabled && traceActor) {
this._startTracingTab(traceActor, startedTracing.resolve);
} else {
this._startDebuggingTab(startedDebugging.resolve);
const startedTracing = promise.defer();
if (Prefs.tracerEnabled && traceActor) {
this._startTracingTab(traceActor, startedTracing.resolve);
} else {
startedTracing.resolve();
}
return promise.all([startedDebugging.promise, startedTracing.promise]);
startedTracing.resolve();
}
return startedDebugging.promise;
return promise.all([startedDebugging.promise, startedTracing.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;
},
@ -277,15 +223,6 @@ let DebuggerController = {
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.client = 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,
_shutdown: null,
_connection: null,
@ -2200,8 +2110,6 @@ let L10N = new ViewHelpers.L10N(DBG_STRINGS_URI);
* Shortcuts for accessing various debugger preferences.
*/
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"],
instrumentsWidth: ["Int", "debugger.ui.panes-instruments-width"],
panesVisibleOnStartup: ["Bool", "debugger.ui.panes-visible-on-startup"],
@ -2217,15 +2125,6 @@ let Prefs = new ViewHelpers.Prefs("devtools", {
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.
*/

View File

@ -613,6 +613,9 @@ StyleEditorUI.prototype = {
let label = summary.querySelector(".stylesheet-name > label");
label.setAttribute("value", editor.friendlyName);
if (editor.styleSheet.href) {
label.setAttribute("tooltiptext", editor.styleSheet.href);
}
let 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.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
<!ENTITY findSelectionCmd.commandkey "e">
<!ENTITY spellAddDictionaries.label "Add Dictionaries…">
<!ENTITY spellAddDictionaries.accesskey "A">

View File

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

View File

@ -5,6 +5,7 @@
#include "CEHHelper.h"
#include <tlhelp32.h>
#include "mozilla/widget/MetroD3DCheckHelper.h"
#ifdef SHOW_CONSOLE
#include <io.h> // _open_osfhandle
@ -139,73 +140,9 @@ IsDX10Available()
if (GetDWORDRegKey(metroDX10Available, isDX10Available)) {
return isDX10Available;
}
HMODULE dxgiModule = LoadLibraryA("dxgi.dll");
if (!dxgiModule) {
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 check = D3DFeatureLevelCheck();
SetDWORDRegKey(metroDX10Available, check);
return check;
}
bool

View File

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

View File

@ -765,6 +765,11 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
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
// that tells it to run updater then launch the metro browser.
if (mRequestType == METRO_UPDATE) {

View File

@ -77,7 +77,7 @@ XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREA_PLACEMENTS", function() {
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");
}

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);
}
#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.
*/
@ -1001,6 +1005,14 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
-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-menubutton-button > .toolbarbutton-icon {
width: 18px;
@ -1134,6 +1146,11 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
-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 */
#edit-controls@inAnyPanel@ > toolbarbutton,
#zoom-controls@inAnyPanel@ > toolbarbutton,
@ -4132,7 +4149,7 @@ window > chatbox {
#main-window[customize-entered] #tab-view-deck {
background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.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;
}

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
%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)

View File

@ -126,6 +126,11 @@ toolbarpaletteitem[place="palette"] > #email-link-button {
-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 */
#edit-controls@inAnyPanel@ > toolbarbutton,

View File

@ -68,6 +68,10 @@
-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"]{
-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.
if totalMemory <= 1024 * 1024 * 4:
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:
self.log.info("INFO | automation.py | ASan running in default memory configuration")
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"
if totalMemory <= 1024 * 1024 * 4:
message = message % 'low-memory'
env["ASAN_OPTIONS"] = "quarantine_size=50331648"
env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5"
else:
message = message % 'default memory'
except OSError,err:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,8 @@ DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \
/* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent, \
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)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
@ -79,6 +80,7 @@ namespace dom {
class Element;
class EventTarget;
class MouseEvent;
class UIEvent;
} // namespace dom
} // 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_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
#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_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
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<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
// In debug builds, warnings are enabled in chrome context if
// 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_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
int32_t zeal = Preferences::GetInt(js_zeal_option_str, -1);
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.
bool HasActiveDocument()
{
MOZ_ASSERT(IsInnerWindow());
return IsCurrentInnerWindow() ||
(GetOuterWindow() &&
GetOuterWindow()->GetCurrentInnerWindow() &&
GetOuterWindow()->GetCurrentInnerWindow()->GetDoc() == mDoc);
(mOuterWindow &&
mOuterWindow->GetCurrentInnerWindow() &&
mOuterWindow->GetCurrentInnerWindow()->GetDoc() == mDoc);
}
bool IsOuterWindow() const

View File

@ -222,64 +222,6 @@ nsScreen::GetLockOrientationPermission() const
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
nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv)
{
@ -365,13 +307,6 @@ nsScreen::MozUnlockOrientation()
hal::UnlockScreenOrientation();
}
NS_IMETHODIMP
nsScreen::SlowMozUnlockOrientation()
{
MozUnlockOrientation();
return NS_OK;
}
bool
nsScreen::IsDeviceSizePageSize()
{

View File

@ -263,12 +263,6 @@ IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> 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
IsObjectValueConvertibleToDictionary(JSContext* cx,
JS::Handle<JS::Value> objVal)

View File

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

View File

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

View File

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

View File

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

View File

@ -681,12 +681,15 @@ var steps = [
req.onerror = onFailure;
},
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"];
createResult1 = new mozContact();
for (var prop of FIELDS) {
createResult1[prop] = {type: ["foo"]};
ok(Array.isArray(createResult1[prop]), prop + " is array");
try {
createResult1[prop] = {type: ["foo"]};
} catch (e) {}
ok(createResult1[prop] === null ||
Array.isArray(createResult1[prop]), prop + " is array");
}
next();
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,8 +13,8 @@ namespace dom {
KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetKeyboardEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
new WidgetKeyboardEvent(false, 0, nullptr))
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
{
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_RELEASE_INHERITED(KeyboardEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(KeyboardEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(KeyboardEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
bool
KeyboardEvent::AltKey()
@ -212,7 +212,7 @@ KeyboardEvent::InitKeyEvent(const nsAString& aType,
uint32_t aKeyCode,
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);
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();

View File

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

View File

@ -15,9 +15,9 @@ namespace dom {
MouseEvent::MouseEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEventBase* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
new WidgetMouseEvent(false, 0, nullptr,
WidgetMouseEvent::eReal))
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetMouseEvent(false, 0, nullptr,
WidgetMouseEvent::eReal))
{
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
// It's not that important, though, since a scroll event is not a real
@ -41,12 +41,12 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(MouseEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(MouseEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(MouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_IMETHODIMP
MouseEvent::InitMouseEvent(const nsAString& aType,
@ -65,7 +65,8 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
uint16_t aButton,
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);
switch(mEvent->eventStructType) {

View File

@ -6,15 +6,15 @@
#ifndef mozilla_dom_MouseEvent_h_
#define mozilla_dom_MouseEvent_h_
#include "nsIDOMMouseEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMMouseEvent.h"
namespace mozilla {
namespace dom {
class MouseEvent : public nsDOMUIEvent,
class MouseEvent : public UIEvent,
public nsIDOMMouseEvent
{
public:
@ -28,7 +28,7 @@ public:
NS_DECL_NSIDOMMOUSEEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT
NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
@ -121,6 +121,6 @@ protected:
#define NS_FORWARD_TO_MOUSEEVENT \
NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
NS_FORWARD_TO_NSDOMUIEVENT
NS_FORWARD_TO_UIEVENT
#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,20 +5,20 @@
#include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/NotifyPaintEvent.h"
#include "mozilla/GfxMessageUtils.h"
#include "nsDOMNotifyPaintEvent.h"
#include "nsContentUtils.h"
#include "nsPaintRequest.h"
#include "mozilla/dom/DOMRect.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
namespace dom {
nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests)
NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests)
: nsDOMEvent(aOwner, aPresContext, aEvent)
{
if (mEvent) {
@ -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_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMNotifyPaintEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMNotifyPaintEvent, nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(NotifyPaintEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(NotifyPaintEvent, nsDOMEvent)
nsRegion
nsDOMNotifyPaintEvent::GetRegion()
NotifyPaintEvent::GetRegion()
{
nsRegion r;
if (!nsContentUtils::IsCallerChrome()) {
@ -51,14 +51,14 @@ nsDOMNotifyPaintEvent::GetRegion()
}
NS_IMETHODIMP
nsDOMNotifyPaintEvent::GetBoundingClientRect(nsIDOMClientRect** aResult)
NotifyPaintEvent::GetBoundingClientRect(nsIDOMClientRect** aResult)
{
*aResult = BoundingClientRect().get();
return NS_OK;
}
already_AddRefed<DOMRect>
nsDOMNotifyPaintEvent::BoundingClientRect()
NotifyPaintEvent::BoundingClientRect()
{
nsRefPtr<DOMRect> rect = new DOMRect(ToSupports(this));
@ -70,14 +70,14 @@ nsDOMNotifyPaintEvent::BoundingClientRect()
}
NS_IMETHODIMP
nsDOMNotifyPaintEvent::GetClientRects(nsIDOMClientRectList** aResult)
NotifyPaintEvent::GetClientRects(nsIDOMClientRectList** aResult)
{
*aResult = ClientRects().get();
return NS_OK;
}
already_AddRefed<DOMRectList>
nsDOMNotifyPaintEvent::ClientRects()
NotifyPaintEvent::ClientRects()
{
nsISupports* parent = ToSupports(this);
nsRefPtr<DOMRectList> rectList = new DOMRectList(parent);
@ -95,7 +95,7 @@ nsDOMNotifyPaintEvent::ClientRects()
}
NS_IMETHODIMP
nsDOMNotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
NotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
{
nsRefPtr<nsPaintRequestList> requests = PaintRequests();
requests.forget(aResult);
@ -103,7 +103,7 @@ nsDOMNotifyPaintEvent::GetPaintRequests(nsISupports** aResult)
}
already_AddRefed<nsPaintRequestList>
nsDOMNotifyPaintEvent::PaintRequests()
NotifyPaintEvent::PaintRequests()
{
nsDOMEvent* parent = this;
nsRefPtr<nsPaintRequestList> requests = new nsPaintRequestList(parent);
@ -120,8 +120,8 @@ nsDOMNotifyPaintEvent::PaintRequests()
}
NS_IMETHODIMP_(void)
nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
bool aSerializeInterfaceType)
NotifyPaintEvent::Serialize(IPC::Message* aMsg,
bool aSerializeInterfaceType)
{
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("notifypaintevent"));
@ -138,7 +138,7 @@ nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
}
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);
@ -155,16 +155,21 @@ nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
return true;
}
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests)
{
nsDOMNotifyPaintEvent* it =
new nsDOMNotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType,
aInvalidateRequests);
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests)
{
NotifyPaintEvent* it = new NotifyPaintEvent(aOwner, aPresContext, aEvent,
aEventType, aInvalidateRequests);
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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMNotifyPaintEvent_h_
#define nsDOMNotifyPaintEvent_h_
#ifndef mozilla_dom_NotifyPaintEvent_h_
#define mozilla_dom_NotifyPaintEvent_h_
#include "mozilla/Attributes.h"
#include "nsIDOMNotifyPaintEvent.h"
@ -16,23 +16,20 @@ class nsPaintRequestList;
namespace mozilla {
namespace dom {
class DOMRect;
class DOMRectList;
}
}
class nsDOMNotifyPaintEvent : public nsDOMEvent,
public nsIDOMNotifyPaintEvent
class NotifyPaintEvent : public nsDOMEvent,
public nsIDOMNotifyPaintEvent
{
typedef mozilla::dom::DOMRect DOMRect;
typedef mozilla::dom::DOMRectList DOMRectList;
public:
nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests);
NotifyPaintEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
uint32_t aEventType,
nsInvalidateRequestList* aInvalidateRequests);
NS_DECL_ISUPPORTS_INHERITED
@ -50,7 +47,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::NotifyPaintEventBinding::Wrap(aCx, aScope, this);
return NotifyPaintEventBinding::Wrap(aCx, aScope, this);
}
already_AddRefed<DOMRectList> ClientRects();
@ -64,4 +61,7 @@ private:
nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests;
};
#endif // nsDOMNotifyPaintEvent_h_
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_NotifyPaintEvent_h_

View File

@ -5,36 +5,36 @@
#include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/ScrollAreaEvent.h"
#include "mozilla/ContentEvents.h"
#include "nsDOMScrollAreaEvent.h"
#include "mozilla/dom/DOMRect.h"
namespace mozilla {
namespace dom {
using namespace mozilla;
nsDOMScrollAreaEvent::nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext *aPresContext,
InternalScrollAreaEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent)
ScrollAreaEvent::ScrollAreaEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalScrollAreaEvent* aEvent)
: UIEvent(aOwner, aPresContext, aEvent)
, mClientArea(nullptr)
{
mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
}
NS_IMPL_ADDREF_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(ScrollAreaEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMScrollAreaEvent)
NS_INTERFACE_MAP_BEGIN(ScrollAreaEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
#define FORWARD_GETTER(_name) \
NS_IMETHODIMP \
nsDOMScrollAreaEvent::Get ## _name(float* aResult) \
{ \
*aResult = _name(); \
return NS_OK; \
#define FORWARD_GETTER(_name) \
NS_IMETHODIMP \
ScrollAreaEvent::Get ## _name(float* aResult) \
{ \
*aResult = _name(); \
return NS_OK; \
}
FORWARD_GETTER(X)
@ -43,15 +43,18 @@ FORWARD_GETTER(Width)
FORWARD_GETTER(Height)
NS_IMETHODIMP
nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow *aView,
int32_t aDetail,
float aX, float aY,
float aWidth, float aHeight)
ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
float aX,
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);
mClientArea.SetRect(aX, aY, aWidth, aHeight);
@ -60,8 +63,8 @@ nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
}
NS_IMETHODIMP_(void)
nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
bool aSerializeInterfaceType)
ScrollAreaEvent::Serialize(IPC::Message* aMsg,
bool aSerializeInterfaceType)
{
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
@ -76,7 +79,7 @@ nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
}
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);
@ -90,13 +93,18 @@ nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
return true;
}
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext *aPresContext,
NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
InternalScrollAreaEvent* aEvent)
{
nsDOMScrollAreaEvent* ev =
new nsDOMScrollAreaEvent(aOwner, aPresContext, aEvent);
ScrollAreaEvent* ev = new ScrollAreaEvent(aOwner, aPresContext, aEvent);
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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMScrollAreaEvent_h__
#define nsDOMScrollAreaEvent_h__
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMScrollAreaEvent.h"
#include "nsDOMUIEvent.h"
#ifndef mozilla_dom_ScrollAreaEvent_h_
#define mozilla_dom_ScrollAreaEvent_h_
#include "mozilla/dom/DOMRect.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,
public nsIDOMScrollAreaEvent
namespace mozilla {
namespace dom {
class ScrollAreaEvent : public UIEvent,
public nsIDOMScrollAreaEvent
{
typedef mozilla::dom::DOMRect DOMRect;
public:
nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext *aPresContext,
mozilla::InternalScrollAreaEvent* aEvent);
ScrollAreaEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalScrollAreaEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSCROLLAREAEVENT
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::)
NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
NS_IMETHOD DuplicatePrivateData()
@ -41,7 +41,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::ScrollAreaEventBinding::Wrap(aCx, aScope, this);
return ScrollAreaEventBinding::Wrap(aCx, aScope, this);
}
float X() const
@ -71,7 +71,7 @@ public:
int32_t aDetail,
float aX, float aY,
float aWidth, float aHeight,
mozilla::ErrorResult& aRv)
ErrorResult& aRv)
{
aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView,
aDetail, aX, aY, aWidth, aHeight);
@ -81,4 +81,7 @@ protected:
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/TouchBinding.h"
#include "mozilla/dom/TouchEvent.h"
#include "nsContentUtils.h"
#include "nsDOMTouchEvent.h"
#include "nsIContent.h"
namespace mozilla {
namespace dom {
Touch::Touch(mozilla::dom::EventTarget* aTarget,
Touch::Touch(EventTarget* aTarget,
int32_t aIdentifier,
int32_t aPageX,
int32_t aPageY,
@ -71,10 +71,11 @@ Touch::~Touch()
{
}
/* static */ bool
// static
bool
Touch::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{
return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
return TouchEvent::PrefEnabled(aCx, aGlobal);
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
@ -117,7 +118,7 @@ Touch::InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent)
}
void
Touch::SetTarget(mozilla::dom::EventTarget* aTarget)
Touch::SetTarget(EventTarget* aTarget)
{
mTarget = aTarget;
}
@ -132,7 +133,7 @@ Touch::Equals(Touch* aTouch)
mRadius.y == aTouch->RadiusY();
}
/* virtual */ JSObject*
JSObject*
Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_Touch_h
#define mozilla_dom_Touch_h
#ifndef mozilla_dom_Touch_h_
#define mozilla_dom_Touch_h_
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
@ -27,7 +27,7 @@ class Touch MOZ_FINAL : public nsISupports
public:
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
Touch(mozilla::dom::EventTarget* aTarget,
Touch(EventTarget* aTarget,
int32_t aIdentifier,
int32_t aPageX,
int32_t aPageY,
@ -52,7 +52,7 @@ public:
void InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent);
void SetTarget(mozilla::dom::EventTarget* aTarget);
void SetTarget(EventTarget* aTarget);
bool Equals(Touch* aTouch);
@ -92,4 +92,4 @@ protected:
} // namespace dom
} // 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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMTouchEvent.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/dom/TouchListBinding.h"
#include "mozilla/Preferences.h"
#include "mozilla/TouchEvents.h"
#include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
// 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_INTERFACE_MAP_ENTRY(nsISupports)
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_RELEASE(nsDOMTouchList)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TouchList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TouchList)
/* virtual */ JSObject*
nsDOMTouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
JSObject*
TouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return TouchListBinding::Wrap(aCx, aScope, this);
}
/* static */ bool
nsDOMTouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
// static
bool
TouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{
return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
return TouchEvent::PrefEnabled(aCx, aGlobal);
}
Touch*
nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
TouchList::IdentifiedTouch(int32_t aIdentifier) const
{
for (uint32_t i = 0; i < mPoints.Length(); ++i) {
Touch* point = mPoints[i];
@ -50,13 +60,15 @@ nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
return nullptr;
}
// TouchEvent
/******************************************************************************
* TouchEvent
*****************************************************************************/
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetTouchEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
TouchEvent::TouchEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetTouchEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@ -71,38 +83,33 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
}
}
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(nsDOMTouchEvent, nsDOMUIEvent,
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(TouchEvent, UIEvent,
mTouches,
mTargetTouches,
mChangedTouches)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTouchEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMTouchEvent, nsDOMUIEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TouchEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_IMPL_ADDREF_INHERITED(TouchEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(TouchEvent, UIEvent)
void
nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
nsDOMTouchList* aTouches,
nsDOMTouchList* aTargetTouches,
nsDOMTouchList* aChangedTouches,
mozilla::ErrorResult& aRv)
TouchEvent::InitTouchEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
TouchList* aTouches,
TouchList* aTargetTouches,
TouchList* aChangedTouches,
ErrorResult& aRv)
{
aRv = nsDOMUIEvent::InitUIEvent(aType,
aCanBubble,
aCancelable,
aView,
aDetail);
aRv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
if (aRv.Failed()) {
return;
}
@ -114,8 +121,8 @@ nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
mChangedTouches = aChangedTouches;
}
nsDOMTouchList*
nsDOMTouchEvent::Touches()
TouchList*
TouchEvent::Touches()
{
if (!mTouches) {
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
@ -128,16 +135,16 @@ nsDOMTouchEvent::Touches()
unchangedTouches.AppendElement(touches[i]);
}
}
mTouches = new nsDOMTouchList(ToSupports(this), unchangedTouches);
mTouches = new TouchList(ToSupports(this), unchangedTouches);
} else {
mTouches = new nsDOMTouchList(ToSupports(this), touchEvent->touches);
mTouches = new TouchList(ToSupports(this), touchEvent->touches);
}
}
return mTouches;
}
nsDOMTouchList*
nsDOMTouchEvent::TargetTouches()
TouchList*
TouchEvent::TargetTouches()
{
if (!mTargetTouches) {
nsTArray< nsRefPtr<Touch> > targetTouches;
@ -153,13 +160,13 @@ nsDOMTouchEvent::TargetTouches()
}
}
}
mTargetTouches = new nsDOMTouchList(ToSupports(this), targetTouches);
mTargetTouches = new TouchList(ToSupports(this), targetTouches);
}
return mTargetTouches;
}
nsDOMTouchList*
nsDOMTouchEvent::ChangedTouches()
TouchList*
TouchEvent::ChangedTouches()
{
if (!mChangedTouches) {
nsTArray< nsRefPtr<Touch> > changedTouches;
@ -170,20 +177,14 @@ nsDOMTouchEvent::ChangedTouches()
changedTouches.AppendElement(touches[i]);
}
}
mChangedTouches = new nsDOMTouchList(ToSupports(this), changedTouches);
mChangedTouches = new TouchList(ToSupports(this), changedTouches);
}
return mChangedTouches;
}
#ifdef XP_WIN
namespace mozilla {
namespace widget {
extern int32_t IsTouchDeviceSupportPresent();
} }
#endif
// static
bool
nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{
bool prefValue = false;
int32_t flag = 0;
@ -196,7 +197,7 @@ nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
// On Windows we auto-detect based on device support.
if (!sDidCheckTouchDeviceSupport) {
sDidCheckTouchDeviceSupport = true;
sIsTouchDeviceSupportPresent = mozilla::widget::IsTouchDeviceSupportPresent();
sIsTouchDeviceSupportPresent = widget::IsTouchDeviceSupportPresent();
}
prefValue = sIsTouchDeviceSupportPresent;
#else
@ -214,35 +215,41 @@ nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
}
bool
nsDOMTouchEvent::AltKey()
TouchEvent::AltKey()
{
return mEvent->AsTouchEvent()->IsAlt();
}
bool
nsDOMTouchEvent::MetaKey()
TouchEvent::MetaKey()
{
return mEvent->AsTouchEvent()->IsMeta();
}
bool
nsDOMTouchEvent::CtrlKey()
TouchEvent::CtrlKey()
{
return mEvent->AsTouchEvent()->IsControl();
}
bool
nsDOMTouchEvent::ShiftKey()
TouchEvent::ShiftKey()
{
return mEvent->AsTouchEvent()->IsShift();
}
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetTouchEvent* aEvent)
{
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
TouchEvent* it = new TouchEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -2,38 +2,38 @@
/* 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 nsDOMTouchEvent_h_
#define nsDOMTouchEvent_h_
#ifndef mozilla_dom_TouchEvent_h_
#define mozilla_dom_TouchEvent_h_
#include "nsDOMUIEvent.h"
#include "nsTArray.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/dom/TouchEventBinding.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "nsJSEnvironment.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/dom/TouchEventBinding.h"
#include "nsTArray.h"
#include "nsWrapperCache.h"
class nsAString;
class nsDOMTouchList MOZ_FINAL : public nsISupports
, public nsWrapperCache
{
typedef mozilla::dom::Touch Touch;
namespace mozilla {
namespace dom {
class TouchList MOZ_FINAL : public nsISupports
, public nsWrapperCache
{
public:
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)
{
SetIsDOMBinding();
nsJSContext::LikelyShortLivingObjectCreated();
}
nsDOMTouchList(nsISupports* aParent,
const nsTArray< nsRefPtr<Touch> >& aTouches)
TouchList(nsISupports* aParent,
const nsTArray<nsRefPtr<Touch> >& aTouches)
: mParent(aParent)
, mPoints(aTouches)
{
@ -46,15 +46,16 @@ public:
mPoints.AppendElement(aPoint);
}
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
nsISupports* GetParentObject() const
{
return mParent;
}
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
static bool PrefEnabled(JSContext* aCx = nullptr,
JSObject* aGlobal = nullptr);
uint32_t Length() const
{
@ -76,28 +77,28 @@ public:
protected:
nsCOMPtr<nsISupports> mParent;
nsTArray< nsRefPtr<Touch> > mPoints;
nsTArray<nsRefPtr<Touch> > mPoints;
};
class nsDOMTouchEvent : public nsDOMUIEvent
class TouchEvent : public UIEvent
{
public:
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetTouchEvent* aEvent);
TouchEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetTouchEvent* aEvent);
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,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::TouchEventBinding::Wrap(aCx, aScope, this);
return TouchEventBinding::Wrap(aCx, aScope, this);
}
nsDOMTouchList* Touches();
nsDOMTouchList* TargetTouches();
nsDOMTouchList* ChangedTouches();
TouchList* Touches();
TouchList* TargetTouches();
TouchList* ChangedTouches();
bool AltKey();
bool MetaKey();
@ -113,16 +114,20 @@ public:
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
nsDOMTouchList* aTouches,
nsDOMTouchList* aTargetTouches,
nsDOMTouchList* aChangedTouches,
mozilla::ErrorResult& aRv);
TouchList* aTouches,
TouchList* aTargetTouches,
TouchList* aChangedTouches,
ErrorResult& aRv);
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
static bool PrefEnabled(JSContext* aCx = nullptr,
JSObject* aGlobal = nullptr);
protected:
nsRefPtr<nsDOMTouchList> mTouches;
nsRefPtr<nsDOMTouchList> mTargetTouches;
nsRefPtr<nsDOMTouchList> mChangedTouches;
nsRefPtr<TouchList> mTouches;
nsRefPtr<TouchList> mTargetTouches;
nsRefPtr<TouchList> mChangedTouches;
};
#endif /* !defined(nsDOMTouchEvent_h_) */
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TouchEvent_h_

View File

@ -3,15 +3,16 @@
* 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 "nsDOMTransitionEvent.h"
#include "prtime.h"
#include "mozilla/dom/TransitionEvent.h"
#include "mozilla/ContentEvents.h"
#include "prtime.h"
using namespace mozilla;
namespace mozilla {
namespace dom {
nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext *aPresContext,
InternalTransitionEvent* aEvent)
TransitionEvent::TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalTransitionEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalTransitionEvent(false, 0))
{
@ -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_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMTransitionEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMTransitionEvent, nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(TransitionEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(TransitionEvent, nsDOMEvent)
//static
already_AddRefed<nsDOMTransitionEvent>
nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::TransitionEventInit& aParam,
mozilla::ErrorResult& aRv)
// static
already_AddRefed<TransitionEvent>
TransitionEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const TransitionEventInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<nsDOMTransitionEvent> e = new nsDOMTransitionEvent(t, nullptr, nullptr);
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<TransitionEvent> e = new TransitionEvent(t, nullptr, nullptr);
bool trusted = e->Init(t);
aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
@ -54,39 +55,44 @@ nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
}
NS_IMETHODIMP
nsDOMTransitionEvent::GetPropertyName(nsAString & aPropertyName)
TransitionEvent::GetPropertyName(nsAString& aPropertyName)
{
aPropertyName = mEvent->AsTransitionEvent()->propertyName;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTransitionEvent::GetElapsedTime(float *aElapsedTime)
TransitionEvent::GetElapsedTime(float* aElapsedTime)
{
*aElapsedTime = ElapsedTime();
return NS_OK;
}
float
nsDOMTransitionEvent::ElapsedTime()
TransitionEvent::ElapsedTime()
{
return mEvent->AsTransitionEvent()->elapsedTime;
}
NS_IMETHODIMP
nsDOMTransitionEvent::GetPseudoElement(nsAString& aPseudoElement)
TransitionEvent::GetPseudoElement(nsAString& aPseudoElement)
{
aPseudoElement = mEvent->AsTransitionEvent()->pseudoElement;
return NS_OK;
}
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMTransitionEvent(nsIDOMEvent **aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext *aPresContext,
NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
InternalTransitionEvent* aEvent)
{
nsDOMTransitionEvent *it =
new nsDOMTransitionEvent(aOwner, aPresContext, aEvent);
TransitionEvent *it = new TransitionEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -2,8 +2,8 @@
/* 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 nsDOMTransitionEvent_h_
#define nsDOMTransitionEvent_h_
#ifndef mozilla_dom_TransitionEvent_h_
#define mozilla_dom_TransitionEvent_h_
#include "nsDOMEvent.h"
#include "nsIDOMTransitionEvent.h"
@ -12,28 +12,31 @@
class nsAString;
class nsDOMTransitionEvent : public nsDOMEvent,
public nsIDOMTransitionEvent
namespace mozilla {
namespace dom {
class TransitionEvent : public nsDOMEvent,
public nsIDOMTransitionEvent
{
public:
nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext *aPresContext,
mozilla::InternalTransitionEvent* aEvent);
TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalTransitionEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_TO_NSDOMEVENT
NS_DECL_NSIDOMTRANSITIONEVENT
static already_AddRefed<nsDOMTransitionEvent>
Constructor(const mozilla::dom::GlobalObject& aGlobal,
static already_AddRefed<TransitionEvent>
Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::TransitionEventInit& aParam,
mozilla::ErrorResult& aRv);
const TransitionEventInit& aParam,
ErrorResult& aRv);
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
@ -43,4 +46,7 @@ public:
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 "ipc/IPCMessageUtils.h"
#include "nsCOMPtr.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/dom/UIEvent.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/ContentEvents.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"
using namespace mozilla;
namespace mozilla {
namespace dom {
nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, WidgetGUIEvent* aEvent)
UIEvent::UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext,
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)
, mLastClientPoint(nsEventStateManager::sLastClientPoint)
{
@ -73,15 +78,15 @@ nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
}
}
//static
already_AddRefed<nsDOMUIEvent>
nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::UIEventInit& aParam,
mozilla::ErrorResult& aRv)
// static
already_AddRefed<UIEvent>
UIEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const UIEventInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<nsDOMUIEvent> e = new nsDOMUIEvent(t, nullptr, nullptr);
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<UIEvent> e = new UIEvent(t, nullptr, nullptr);
bool trusted = e->Init(t);
aRv = e->InitUIEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
aParam.mDetail);
@ -89,13 +94,13 @@ nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
return e.forget();
}
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMUIEvent, nsDOMEvent,
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(UIEvent, nsDOMEvent,
mView)
NS_IMPL_ADDREF_INHERITED(nsDOMUIEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent, nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(UIEvent, 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_END_INHERITING(nsDOMEvent)
@ -108,7 +113,7 @@ DevPixelsToCSSPixels(const LayoutDeviceIntPoint& aPoint,
}
nsIntPoint
nsDOMUIEvent::GetMovementPoint()
UIEvent::GetMovementPoint()
{
if (mPrivateDataDuplicated) {
return mMovementPoint;
@ -132,7 +137,7 @@ nsDOMUIEvent::GetMovementPoint()
}
NS_IMETHODIMP
nsDOMUIEvent::GetView(nsIDOMWindow** aView)
UIEvent::GetView(nsIDOMWindow** aView)
{
*aView = mView;
NS_IF_ADDREF(*aView);
@ -140,18 +145,18 @@ nsDOMUIEvent::GetView(nsIDOMWindow** aView)
}
NS_IMETHODIMP
nsDOMUIEvent::GetDetail(int32_t* aDetail)
UIEvent::GetDetail(int32_t* aDetail)
{
*aDetail = mDetail;
return NS_OK;
}
NS_IMETHODIMP
nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
bool canBubbleArg,
bool cancelableArg,
nsIDOMWindow* viewArg,
int32_t detailArg)
UIEvent::InitUIEvent(const nsAString& typeArg,
bool canBubbleArg,
bool cancelableArg,
nsIDOMWindow* viewArg,
int32_t detailArg)
{
if (viewArg) {
nsCOMPtr<nsPIDOMWindow> view = do_QueryInterface(viewArg);
@ -166,9 +171,8 @@ nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
return NS_OK;
}
// ---- nsDOMNSUIEvent implementation -------------------
NS_IMETHODIMP
nsDOMUIEvent::GetPageX(int32_t* aPageX)
UIEvent::GetPageX(int32_t* aPageX)
{
NS_ENSURE_ARG_POINTER(aPageX);
*aPageX = PageX();
@ -176,7 +180,7 @@ nsDOMUIEvent::GetPageX(int32_t* aPageX)
}
int32_t
nsDOMUIEvent::PageX() const
UIEvent::PageX() const
{
if (mPrivateDataDuplicated) {
return mPagePoint.x;
@ -189,7 +193,7 @@ nsDOMUIEvent::PageX() const
}
NS_IMETHODIMP
nsDOMUIEvent::GetPageY(int32_t* aPageY)
UIEvent::GetPageY(int32_t* aPageY)
{
NS_ENSURE_ARG_POINTER(aPageY);
*aPageY = PageY();
@ -197,7 +201,7 @@ nsDOMUIEvent::GetPageY(int32_t* aPageY)
}
int32_t
nsDOMUIEvent::PageY() const
UIEvent::PageY() const
{
if (mPrivateDataDuplicated) {
return mPagePoint.y;
@ -210,7 +214,7 @@ nsDOMUIEvent::PageY() const
}
NS_IMETHODIMP
nsDOMUIEvent::GetWhich(uint32_t* aWhich)
UIEvent::GetWhich(uint32_t* aWhich)
{
NS_ENSURE_ARG_POINTER(aWhich);
*aWhich = Which();
@ -218,7 +222,7 @@ nsDOMUIEvent::GetWhich(uint32_t* aWhich)
}
already_AddRefed<nsINode>
nsDOMUIEvent::GetRangeParent()
UIEvent::GetRangeParent()
{
nsIFrame* targetFrame = nullptr;
@ -243,7 +247,7 @@ nsDOMUIEvent::GetRangeParent()
}
NS_IMETHODIMP
nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
UIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
{
NS_ENSURE_ARG_POINTER(aRangeParent);
*aRangeParent = nullptr;
@ -255,7 +259,7 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
}
NS_IMETHODIMP
nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
UIEvent::GetRangeOffset(int32_t* aRangeOffset)
{
NS_ENSURE_ARG_POINTER(aRangeOffset);
*aRangeOffset = RangeOffset();
@ -263,7 +267,7 @@ nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
}
int32_t
nsDOMUIEvent::RangeOffset() const
UIEvent::RangeOffset() const
{
if (!mPresContext) {
return 0;
@ -280,7 +284,7 @@ nsDOMUIEvent::RangeOffset() const
}
NS_IMETHODIMP
nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
UIEvent::GetCancelBubble(bool* aCancelBubble)
{
NS_ENSURE_ARG_POINTER(aCancelBubble);
*aCancelBubble = CancelBubble();
@ -288,14 +292,14 @@ nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
}
NS_IMETHODIMP
nsDOMUIEvent::SetCancelBubble(bool aCancelBubble)
UIEvent::SetCancelBubble(bool aCancelBubble)
{
mEvent->mFlags.mPropagationStopped = aCancelBubble;
return NS_OK;
}
nsIntPoint
nsDOMUIEvent::GetLayerPoint() const
UIEvent::GetLayerPoint() const
{
if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
@ -320,7 +324,7 @@ nsDOMUIEvent::GetLayerPoint() const
}
NS_IMETHODIMP
nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
UIEvent::GetLayerX(int32_t* aLayerX)
{
NS_ENSURE_ARG_POINTER(aLayerX);
*aLayerX = GetLayerPoint().x;
@ -328,7 +332,7 @@ nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
}
NS_IMETHODIMP
nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
UIEvent::GetLayerY(int32_t* aLayerY)
{
NS_ENSURE_ARG_POINTER(aLayerY);
*aLayerY = GetLayerPoint().y;
@ -336,14 +340,14 @@ nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
}
NS_IMETHODIMP
nsDOMUIEvent::GetIsChar(bool* aIsChar)
UIEvent::GetIsChar(bool* aIsChar)
{
*aIsChar = IsChar();
return NS_OK;
}
bool
nsDOMUIEvent::IsChar() const
UIEvent::IsChar() const
{
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
if (keyEvent) {
@ -354,7 +358,7 @@ nsDOMUIEvent::IsChar() const
}
NS_IMETHODIMP
nsDOMUIEvent::DuplicatePrivateData()
UIEvent::DuplicatePrivateData()
{
mClientPoint = nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
@ -378,7 +382,7 @@ nsDOMUIEvent::DuplicatePrivateData()
}
NS_IMETHODIMP_(void)
nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
UIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
{
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
@ -392,7 +396,7 @@ nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
}
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(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
// 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().
struct nsModifierPair
struct ModifierPair
{
mozilla::Modifier modifier;
Modifier modifier;
const char* name;
};
static const nsModifierPair kPairs[] = {
static const ModifierPair kPairs[] = {
{ MODIFIER_ALT, NS_DOM_KEYNAME_ALT },
{ MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH },
{ MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK },
@ -421,9 +425,9 @@ static const nsModifierPair kPairs[] = {
{ MODIFIER_OS, NS_DOM_KEYNAME_OS }
};
/* static */
mozilla::Modifiers
nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
// static
Modifiers
UIEvent::ComputeModifierState(const nsAString& aModifiersList)
{
if (aModifiersList.IsEmpty()) {
return 0;
@ -439,7 +443,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
aModifiersList.BeginReading(listStart);
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);
if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) {
continue;
@ -456,7 +460,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
}
bool
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
UIEvent::GetModifierStateInternal(const nsAString& aKey)
{
WidgetInputEvent* inputEvent = mEvent->AsInputEvent();
MOZ_ASSERT(inputEvent, "mEvent must be WidgetInputEvent or derived class");
@ -499,12 +503,18 @@ nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
return false;
}
} // namespace dom
} // namespace mozilla
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
{
nsDOMUIEvent* it = new nsDOMUIEvent(aOwner, aPresContext, aEvent);
UIEvent* it = new UIEvent(aOwner, aPresContext, aEvent);
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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMUIEvent_h
#define nsDOMUIEvent_h
#ifndef mozilla_dom_UIEvent_h_
#define mozilla_dom_UIEvent_h_
#include "mozilla/Attributes.h"
#include "nsIDOMUIEvent.h"
@ -16,30 +16,31 @@
class nsINode;
class nsDOMUIEvent : public nsDOMEvent,
public nsIDOMUIEvent
namespace mozilla {
namespace dom {
class UIEvent : public nsDOMEvent,
public nsIDOMUIEvent
{
typedef mozilla::CSSIntPoint CSSIntPoint;
public:
nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent);
UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMUIEvent, nsDOMEvent)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, nsDOMEvent)
// nsIDOMUIEvent Interface
NS_DECL_NSIDOMUIEVENT
// Forward to nsDOMEvent
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
NS_IMETHOD DuplicatePrivateData() 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;
static nsIntPoint
CalculateScreenPoint(nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent)
static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
WidgetEvent* aEvent)
{
if (!aEvent ||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
@ -51,20 +52,21 @@ public:
return nsIntPoint(0, 0);
}
mozilla::WidgetGUIEvent* event = aEvent->AsGUIEvent();
WidgetGUIEvent* event = aEvent->AsGUIEvent();
if (!event->widget) {
return mozilla::LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
}
mozilla::LayoutDeviceIntPoint offset = aEvent->refPoint +
mozilla::LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
nscoord factor = aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
LayoutDeviceIntPoint offset = aEvent->refPoint +
LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
nscoord factor =
aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
}
static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
WidgetEvent* aEvent,
CSSIntPoint* aDefaultClientPoint)
{
if (!aEvent ||
@ -95,15 +97,15 @@ public:
return CSSIntPoint::FromAppUnitsRounded(pt);
}
static already_AddRefed<nsDOMUIEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::UIEventInit& aParam,
mozilla::ErrorResult& aRv);
static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const UIEventInit& aParam,
ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::UIEventBinding::Wrap(aCx, aScope, this);
return UIEventBinding::Wrap(aCx, aScope, this);
}
nsIDOMWindow* GetView() const
@ -164,27 +166,29 @@ protected:
bool mIsPointerLocked;
CSSIntPoint mLastClientPoint;
typedef mozilla::Modifiers Modifiers;
static Modifiers ComputeModifierState(const nsAString& aModifiersList);
bool GetModifierStateInternal(const nsAString& aKey);
};
#define NS_FORWARD_TO_NSDOMUIEVENT \
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \
} // namespace dom
} // namespace mozilla
#define NS_FORWARD_TO_UIEVENT \
NS_FORWARD_NSIDOMUIEVENT(UIEvent::) \
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION \
NS_IMETHOD DuplicatePrivateData() \
{ \
return nsDOMUIEvent::DuplicatePrivateData(); \
return UIEvent::DuplicatePrivateData(); \
} \
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, \
bool aSerializeInterfaceType) \
{ \
nsDOMUIEvent::Serialize(aMsg, aSerializeInterfaceType); \
UIEvent::Serialize(aMsg, aSerializeInterfaceType); \
} \
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \
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
#ifndef nsDOMXULCommandEvent_h_
#define nsDOMXULCommandEvent_h_
#ifndef mozilla_dom_XULCommandEvent_h_
#define mozilla_dom_XULCommandEvent_h_
#include "nsDOMUIEvent.h"
#include "nsIDOMXULCommandEvent.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/dom/XULCommandEventBinding.h"
#include "nsIDOMXULCommandEvent.h"
class nsDOMXULCommandEvent : public nsDOMUIEvent,
public nsIDOMXULCommandEvent
namespace mozilla {
namespace dom {
class XULCommandEvent : public UIEvent,
public nsIDOMXULCommandEvent
{
public:
nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetInputEvent* aEvent);
XULCommandEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetInputEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
NS_DECL_NSIDOMXULCOMMANDEVENT
// Forward our inherited virtual methods to the base class
NS_FORWARD_TO_NSDOMUIEVENT
NS_FORWARD_TO_UIEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::XULCommandEventBinding::Wrap(aCx, aScope, this);
return XULCommandEventBinding::Wrap(aCx, aScope, this);
}
bool AltKey();
@ -53,7 +56,7 @@ public:
bool aCtrlKey, bool aAltKey,
bool aShiftKey, bool aMetaKey,
nsDOMEvent* aSourceEvent,
mozilla::ErrorResult& aRv)
ErrorResult& aRv)
{
aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail,
aCtrlKey, aAltKey, aShiftKey, aMetaKey,
@ -64,4 +67,7 @@ protected:
nsCOMPtr<nsIDOMEvent> mSourceEvent;
};
#endif // nsDOMXULCommandEvent_h_
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_XULCommandEvent_h_

View File

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

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,12 +10,13 @@
#include "mozilla/TextEvents.h"
using namespace mozilla;
using namespace mozilla::dom;
nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetTextEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
{
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_RELEASE_INHERITED(nsDOMTextEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMTextEvent)
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
NS_METHOD nsDOMTextEvent::GetText(nsString& aText)
{

View File

@ -6,15 +6,17 @@
#ifndef nsDOMTextEvent_h__
#define nsDOMTextEvent_h__
#include "mozilla/dom/UIEvent.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "nsDOMUIEvent.h"
#include "nsIPrivateTextEvent.h"
#include "nsPrivateTextRange.h"
class nsDOMTextEvent : public nsDOMUIEvent,
class nsDOMTextEvent : public mozilla::dom::UIEvent,
public nsIPrivateTextEvent
{
typedef mozilla::dom::UIEvent UIEvent;
public:
nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
@ -23,7 +25,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT
NS_FORWARD_TO_UIEVENT
// nsIPrivateTextEvent interface
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 "nsINode.h"
#include "nsPIDOMWindow.h"
#include "nsDOMTouchEvent.h"
#include "GeckoProfiler.h"
#include "GeneratedEvents.h"
#include "mozilla/ContentEvents.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/MiscEvents.h"
#include "mozilla/MouseEvents.h"
@ -818,7 +818,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
if (aEventType.LowerCaseEqualsLiteral("closeevent"))
return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr);
if (aEventType.LowerCaseEqualsLiteral("touchevent") &&
nsDOMTouchEvent::PrefEnabled())
TouchEvent::PrefEnabled())
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext, nullptr);
if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
return NS_NewDOMHashChangeEvent(aDOMEvent, aOwner, aPresContext, nullptr);

View File

@ -11,6 +11,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/UIEvent.h"
#include "nsCOMPtr.h"
#include "nsEventStateManager.h"
@ -50,7 +51,6 @@
#include "nsIDOMWheelEvent.h"
#include "nsIDOMDragEvent.h"
#include "nsIDOMUIEvent.h"
#include "nsDOMUIEvent.h"
#include "nsIMozBrowserFrame.h"
#include "nsSubDocumentFrame.h"
@ -1030,9 +1030,9 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
aEvent->eventStructType == NS_WHEEL_EVENT) &&
!sIsPointerLocked) {
sLastScreenPoint =
nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
UIEvent::CalculateScreenPoint(aPresContext, aEvent);
sLastClientPoint =
nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
UIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
}
// 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
// aDataTransfer during the event handler, just use the original
// target instead.
nsCOMPtr<Element> dragTarget = aDataTransfer->GetDragTarget();
nsCOMPtr<nsIContent> dragTarget = aDataTransfer->GetDragTarget();
if (!dragTarget) {
dragTarget = do_QueryInterface(aDragTarget);
dragTarget = aDragTarget;
if (!dragTarget)
return false;
}
@ -4332,7 +4332,7 @@ nsEventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
// Returns the center point of the window's inner content area.
// This is in widget coordinates, i.e. relative to the widget's top
// left corner, not in screen coordinates, the same units that
// nsDOMUIEvent::refPoint is in.
// UIEvent::refPoint is in.
//
// XXX Hack alert: XXX
// However, we do the computation in integer CSS pixels, NOT device pix,
@ -4386,7 +4386,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
case NS_MOUSE_MOVE:
{
// 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.
if (sIsPointerLocked && aMouseEvent->widget) {
// 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.onpointerenter = function (e) { gOnPointerPropHandled["pointerenter"] = true; }
iframeBody.onpointerleave = function (e) { gOnPointerPropHandled["pointerleave"] = true; }
iframeBody.onpointercancel = function (e) { gOnPointerPropHandled["pointercancel"] = true; }
iframeBody.dispatchEvent(getDefaultArgEvent("pointerdown"));
is(gOnPointerPropHandled['pointerdown'], true, "pointerdown property is performed");
@ -220,6 +221,9 @@ function testOnPointerProperty()
iframeBody.dispatchEvent(getDefaultArgEvent("pointerleave"));
is(gOnPointerPropHandled['pointerleave'], true, "pointerleave property is performed");
iframeBody.dispatchEvent(getDefaultArgEvent("pointercancel"));
is(gOnPointerPropHandled['pointercancel'], true, "pointercancel property is performed");
nextTest();
}

View File

@ -166,7 +166,7 @@ function penter(evt) {
is(evt.target.id, t, "Wrong event target!");
}
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!");
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
"Leaking nodes to another document?");
@ -183,7 +183,7 @@ function pleave(evt) {
is(evt.target.id, t, "Wrong event target!");
}
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!");
ok(!evt.relatedTarget || evt.target.ownerDocument == evt.relatedTarget.ownerDocument,
"Leaking nodes to another document?");

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