mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to b2g-inbound
This commit is contained in:
commit
da76467f53
@ -920,3 +920,9 @@ pref("browser.autofocus", false);
|
||||
|
||||
// Enable wakelock
|
||||
pref("dom.wakelock.enabled", true);
|
||||
|
||||
// Enable sync and mozId with Firefox Accounts.
|
||||
#ifdef MOZ_SERVICES_FXACCOUNTS
|
||||
pref("services.sync.fxaccounts.enabled", true);
|
||||
pref("identity.fxaccounts.enabled", true);
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@ if CONFIG['ENABLE_MARIONETTE']:
|
||||
|
||||
DEFINES['XPCOM_GLUE'] = True
|
||||
|
||||
for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION', 'MOZ_UPDATER'):
|
||||
for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION', 'MOZ_UPDATER', 'MOZ_SERVICES_FXACCOUNTS'):
|
||||
DEFINES[var] = CONFIG[var]
|
||||
|
||||
GENERATED_INCLUDES += [
|
||||
|
@ -23,7 +23,10 @@ Cu.import('resource://gre/modules/NetworkStatsService.jsm');
|
||||
// Identity
|
||||
Cu.import('resource://gre/modules/SignInToWebsite.jsm');
|
||||
SignInToWebsiteController.init();
|
||||
|
||||
#ifdef MOZ_SERVICES_FXACCOUNTS
|
||||
Cu.import('resource://gre/modules/FxAccountsMgmtService.jsm');
|
||||
#endif
|
||||
|
||||
Cu.import('resource://gre/modules/DownloadsAPI.jsm');
|
||||
|
||||
|
@ -72,9 +72,11 @@ component {637b0f77-2429-49a0-915f-abf5d0db8b9a} WebappsUpdateTimer.js
|
||||
contract @mozilla.org/b2g/webapps-update-timer;1 {637b0f77-2429-49a0-915f-abf5d0db8b9a}
|
||||
category update-timer WebappsUpdateTimer @mozilla.org/b2g/webapps-update-timer;1,getService,background-update-timer,webapps.update.interval,86400
|
||||
|
||||
#ifdef MOZ_SERVICES_FXACCOUNTS
|
||||
# FxAccountsUIGlue.js
|
||||
component {51875c14-91d7-4b8c-b65d-3549e101228c} FxAccountsUIGlue.js
|
||||
contract @mozilla.org/fxaccounts/fxaccounts-ui-glue;1 {51875c14-91d7-4b8c-b65d-3549e101228c}
|
||||
#endif
|
||||
|
||||
# HelperAppDialog.js
|
||||
component {710322af-e6ae-4b0c-b2c9-1474a87b077e} HelperAppDialog.js
|
||||
|
@ -13,7 +13,6 @@ EXTRA_COMPONENTS += [
|
||||
'ContentHandler.js',
|
||||
'ContentPermissionPrompt.js',
|
||||
'FilePicker.js',
|
||||
'FxAccountsUIGlue.js',
|
||||
'HelperAppDialog.js',
|
||||
'MailtoProtocolHandler.js',
|
||||
'PaymentGlue.js',
|
||||
@ -37,8 +36,15 @@ if CONFIG['MOZ_UPDATER']:
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'ErrorPage.jsm',
|
||||
'FxAccountsMgmtService.jsm',
|
||||
'SignInToWebsite.jsm',
|
||||
'TelURIParser.jsm',
|
||||
'WebappsUpdater.jsm',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_SERVICES_FXACCOUNTS']:
|
||||
EXTRA_COMPONENTS += [
|
||||
'FxAccountsUIGlue.js'
|
||||
]
|
||||
EXTRA_JS_MODULES += [
|
||||
'FxAccountsMgmtService.jsm'
|
||||
]
|
||||
|
@ -63,3 +63,5 @@ fi
|
||||
MOZ_FOLD_LIBS=1
|
||||
|
||||
MOZ_JSDOWNLOADS=1
|
||||
|
||||
MOZ_SERVICES_FXACCOUNTS=1
|
||||
|
@ -783,16 +783,18 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
||||
@BINPATH@/components/TelProtocolHandler.js
|
||||
@BINPATH@/components/B2GAboutRedirector.js
|
||||
@BINPATH@/components/FilePicker.js
|
||||
@BINPATH@/components/FxAccountsUIGlue.js
|
||||
@BINPATH@/components/HelperAppDialog.js
|
||||
@BINPATH@/components/DownloadsUI.js
|
||||
|
||||
#ifdef MOZ_SERVICES_FXACCOUNTS
|
||||
@BINPATH@/components/FxAccountsUIGlue.js
|
||||
@BINPATH@/components/services_fxaccounts.xpt
|
||||
#endif
|
||||
|
||||
@BINPATH@/components/DataStore.manifest
|
||||
@BINPATH@/components/DataStoreService.js
|
||||
@BINPATH@/components/dom_datastore.xpt
|
||||
|
||||
@BINPATH@/components/services_fxaccounts.xpt
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
@BINPATH@/components/dom_webspeechsynth.xpt
|
||||
#endif
|
||||
|
@ -2997,6 +2997,18 @@
|
||||
tab.setAttribute("titlechanged", "true");
|
||||
break;
|
||||
}
|
||||
case "DOMWindowClose": {
|
||||
if (this.tabs.length == 1) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
let tab = this._getTabForBrowser(browser);
|
||||
if (tab) {
|
||||
this.removeTab(tab);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "contextmenu": {
|
||||
gContextMenuContentData = { event: aMessage.objects.event,
|
||||
browser: browser };
|
||||
@ -3063,6 +3075,7 @@
|
||||
.useRemoteTabs;
|
||||
if (remote) {
|
||||
messageManager.addMessageListener("DOMTitleChanged", this);
|
||||
messageManager.addMessageListener("DOMWindowClose", this);
|
||||
messageManager.addMessageListener("contextmenu", this);
|
||||
}
|
||||
messageManager.addMessageListener("DOMWebNotificationClicked", this);
|
||||
|
@ -28,6 +28,7 @@ MOZ_DISABLE_EXPORT_JS=1
|
||||
MOZ_SAFE_BROWSING=1
|
||||
MOZ_SERVICES_COMMON=1
|
||||
MOZ_SERVICES_CRYPTO=1
|
||||
MOZ_SERVICES_FXACCOUNTS=1
|
||||
MOZ_SERVICES_HEALTHREPORT=1
|
||||
MOZ_SERVICES_METRICS=1
|
||||
MOZ_SERVICES_SYNC=1
|
||||
@ -67,4 +68,3 @@ MOZ_JSDOWNLOADS=1
|
||||
MOZ_WEBM_ENCODER=1
|
||||
# Enable exact rooting on desktop.
|
||||
JSGC_USE_EXACT_ROOTING=1
|
||||
|
||||
|
@ -11,8 +11,8 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/devtools/event-emitter.js");
|
||||
let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise;
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm");
|
||||
const { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
|
||||
var ProfilerController = devtools.require("devtools/profiler/controller");
|
||||
|
||||
|
@ -8,7 +8,7 @@ const {Cu} = require("chrome");
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var promise = require("sdk/core/promise");
|
||||
var {Promise: promise} = require("resource://gre/modules/Promise.jsm");
|
||||
var EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
var Telemetry = require("devtools/shared/telemetry");
|
||||
|
||||
|
@ -5,9 +5,8 @@
|
||||
"use strict";
|
||||
|
||||
const {Cc, Ci, Cu} = require("chrome");
|
||||
|
||||
var promise = require("sdk/core/promise");
|
||||
var EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const {Promise: promise} = require("resource://gre/modules/Promise.jsm");
|
||||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
|
||||
|
@ -5,10 +5,8 @@
|
||||
"use strict";
|
||||
|
||||
const {Cu} = require("chrome");
|
||||
|
||||
let promise = require("sdk/core/promise");
|
||||
let EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
|
||||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const {Promise: promise} = require("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/devtools/DOMHelpers.jsm");
|
||||
|
||||
@ -217,6 +215,7 @@ WindowHost.prototype = {
|
||||
|
||||
let frameLoad = function(event) {
|
||||
win.removeEventListener("load", frameLoad, true);
|
||||
win.focus();
|
||||
this.frame = win.document.getElementById("toolbox-iframe");
|
||||
this.emit("ready", this.frame);
|
||||
|
||||
@ -226,8 +225,6 @@ WindowHost.prototype = {
|
||||
win.addEventListener("load", frameLoad, true);
|
||||
win.addEventListener("unload", this._boundUnload);
|
||||
|
||||
win.focus();
|
||||
|
||||
this._window = win;
|
||||
|
||||
return deferred.promise;
|
||||
|
@ -5,11 +5,9 @@
|
||||
"use strict";
|
||||
|
||||
const {Cu, Cc, Ci} = require("chrome");
|
||||
|
||||
let promise = require("sdk/core/promise");
|
||||
let EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const {Promise: promise} = require("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/devtools/gDevTools.jsm");
|
||||
|
||||
|
@ -10,7 +10,7 @@ const MIN_ZOOM = 0.5;
|
||||
const MAX_ZOOM = 2;
|
||||
|
||||
let {Cc, Ci, Cu} = require("chrome");
|
||||
let promise = require("sdk/core/promise");
|
||||
let {Promise: promise} = require("resource://gre/modules/Promise.jsm");
|
||||
let EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
let Telemetry = require("devtools/shared/telemetry");
|
||||
let HUDService = require("devtools/webconsole/hudservice");
|
||||
@ -1433,20 +1433,20 @@ ToolboxHighlighterUtils.prototype = {
|
||||
* @return a promise that resolves when the highlighter is hidden
|
||||
*/
|
||||
unhighlight: function(forceHide=false) {
|
||||
if (this.isRemoteHighlightable) {
|
||||
// If the remote highlighter exists on the target, use it
|
||||
return this.toolbox.initInspector().then(() => {
|
||||
let autohide = forceHide || !gDevTools.testing;
|
||||
let unhighlightPromise;
|
||||
forceHide = forceHide || !gDevTools.testing;
|
||||
|
||||
if (autohide) {
|
||||
return this.toolbox.highlighter.hideBoxModel();
|
||||
}
|
||||
return promise.resolve();
|
||||
});
|
||||
if (forceHide && this.isRemoteHighlightable && this.toolbox.highlighter) {
|
||||
// If the remote highlighter exists on the target, use it
|
||||
unhighlightPromise = this.toolbox.highlighter.hideBoxModel();
|
||||
} else {
|
||||
// If not, no need to unhighlight as the older highlight method uses a
|
||||
// setTimeout to hide itself
|
||||
return promise.resolve();
|
||||
unhighlightPromise = promise.resolve();
|
||||
}
|
||||
|
||||
return unhighlightPromise.then(() => {
|
||||
this.toolbox.emit("node-unhighlight");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -692,8 +692,10 @@ HTMLBreadcrumbs.prototype = {
|
||||
|
||||
// Make sure the selected node and its neighbours are visible.
|
||||
this.scroll();
|
||||
this.inspector.emit("breadcrumbs-updated", this.selection.nodeFront);
|
||||
doneUpdating();
|
||||
return resolveNextTick().then(() => {
|
||||
this.inspector.emit("breadcrumbs-updated", this.selection.nodeFront);
|
||||
doneUpdating();
|
||||
});
|
||||
}).then(null, err => {
|
||||
doneUpdating(this.selection.nodeFront);
|
||||
this.selectionGuardEnd(err);
|
||||
|
@ -470,9 +470,8 @@ InspectorPanel.prototype = {
|
||||
*/
|
||||
destroy: function InspectorPanel__destroy() {
|
||||
if (this._panelDestroyer) {
|
||||
return this._panelDestroyer.promise;
|
||||
return this._panelDestroyer;
|
||||
}
|
||||
this._panelDestroyer = promise.defer();
|
||||
|
||||
if (this.walker) {
|
||||
this.walker.off("new-root", this.onNewRoot);
|
||||
@ -506,7 +505,7 @@ InspectorPanel.prototype = {
|
||||
this.selection.off("before-new-node", this.onBeforeNewSelection);
|
||||
this.selection.off("before-new-node-front", this.onBeforeNewSelection);
|
||||
this.selection.off("detached-front", this.onDetached);
|
||||
this._destroyMarkup();
|
||||
this._panelDestroyer = this._destroyMarkup();
|
||||
this.panelWin.inspector = null;
|
||||
this.target = null;
|
||||
this.panelDoc = null;
|
||||
@ -517,8 +516,7 @@ InspectorPanel.prototype = {
|
||||
this.nodemenu = null;
|
||||
this._toolbox = null;
|
||||
|
||||
this._panelDestroyer.resolve(null);
|
||||
return this._panelDestroyer.promise;
|
||||
return this._panelDestroyer;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -643,14 +641,18 @@ InspectorPanel.prototype = {
|
||||
},
|
||||
|
||||
_destroyMarkup: function InspectorPanel__destroyMarkup() {
|
||||
let destroyPromise;
|
||||
|
||||
if (this._boundMarkupFrameLoad) {
|
||||
this._markupFrame.removeEventListener("load", this._boundMarkupFrameLoad, true);
|
||||
this._boundMarkupFrameLoad = null;
|
||||
}
|
||||
|
||||
if (this.markup) {
|
||||
this.markup.destroy();
|
||||
destroyPromise = this.markup.destroy();
|
||||
this.markup = null;
|
||||
} else {
|
||||
destroyPromise = promise.resolve();
|
||||
}
|
||||
|
||||
if (this._markupFrame) {
|
||||
@ -659,6 +661,8 @@ InspectorPanel.prototype = {
|
||||
}
|
||||
|
||||
this._markupBox = null;
|
||||
|
||||
return destroyPromise;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,9 @@ function test()
|
||||
let nodes;
|
||||
let cursor;
|
||||
let inspector;
|
||||
let target;
|
||||
let panel;
|
||||
let container;
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
||||
@ -43,6 +46,9 @@ function test()
|
||||
function runTests(aInspector)
|
||||
{
|
||||
inspector = aInspector;
|
||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
panel = gDevTools.getToolbox(target).getPanel("inspector");
|
||||
container = panel.panelDoc.getElementById("inspector-breadcrumbs");
|
||||
cursor = 0;
|
||||
inspector.on("breadcrumbs-updated", nodeSelected);
|
||||
executeSoon(function() {
|
||||
@ -69,9 +75,6 @@ function test()
|
||||
|
||||
function performTest()
|
||||
{
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
let panel = gDevTools.getToolbox(target).getPanel("inspector");
|
||||
let container = panel.panelDoc.getElementById("inspector-breadcrumbs");
|
||||
let buttonsLabelIds = nodes[cursor].result.split(" ");
|
||||
|
||||
// html > body > …
|
||||
|
@ -39,7 +39,7 @@ function createDocument() {
|
||||
inspector = aInspector;
|
||||
markupView = inspector.markup;
|
||||
|
||||
inspector.sidebar.once("ruleview-ready", function() {
|
||||
waitForView("ruleview", () => {
|
||||
ruleView = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
|
||||
inspector.sidebar.select("ruleview");
|
||||
startTests();
|
||||
|
@ -21,7 +21,8 @@ function test() {
|
||||
let ruleview = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
|
||||
let inlineStyles = ruleview._elementStyle.rules[0];
|
||||
|
||||
for each (let prop in inlineStyles.textProps) {
|
||||
for (let key in inlineStyles.textProps) {
|
||||
let prop = inlineStyles.textProps[key];
|
||||
if (prop.name == aName) {
|
||||
return prop;
|
||||
}
|
||||
@ -32,7 +33,8 @@ function test() {
|
||||
function runInspectorTests(aInspector)
|
||||
{
|
||||
inspector = aInspector;
|
||||
inspector.sidebar.once("computedview-ready", () => {
|
||||
|
||||
waitForView("computedview", () => {
|
||||
info("Computed View ready");
|
||||
inspector.sidebar.select("computedview");
|
||||
|
||||
|
@ -51,7 +51,8 @@ function createDocument()
|
||||
function selectNode(aInspector)
|
||||
{
|
||||
inspector = aInspector;
|
||||
inspector.sidebar.once("ruleview-ready", function() {
|
||||
|
||||
waitForView("ruleview", () => {
|
||||
ruleview = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
|
||||
inspector.sidebar.select("ruleview");
|
||||
inspector.selection.setNode(div, "test");
|
||||
|
@ -202,6 +202,15 @@ function getComputedView() {
|
||||
return inspector.sidebar.getWindowForTab("computedview").computedview.view;
|
||||
}
|
||||
|
||||
function waitForView(aName, aCallback) {
|
||||
let inspector = getActiveInspector();
|
||||
if (inspector.sidebar.getTab(aName)) {
|
||||
aCallback();
|
||||
} else {
|
||||
inspector.sidebar.once(aName + "-ready", aCallback);
|
||||
}
|
||||
}
|
||||
|
||||
function synthesizeKeyFromKeyTag(aKeyId) {
|
||||
let key = document.getElementById(aKeyId);
|
||||
isnot(key, null, "Successfully retrieved the <key> node");
|
||||
|
@ -177,7 +177,7 @@ MarkupView.prototype = {
|
||||
},
|
||||
|
||||
_hideBoxModel: function(forceHide) {
|
||||
this._inspector.toolbox.highlighterUtils.unhighlight(forceHide);
|
||||
return this._inspector.toolbox.highlighterUtils.unhighlight(forceHide);
|
||||
},
|
||||
|
||||
_briefBoxModelTimer: null,
|
||||
@ -1044,9 +1044,13 @@ MarkupView.prototype = {
|
||||
* Tear down the markup panel.
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this._destroyer) {
|
||||
return this._destroyer;
|
||||
}
|
||||
|
||||
// Note that if the toolbox is closed, this will work fine, but will fail
|
||||
// in case the browser is closed and will trigger a noSuchActor message.
|
||||
this._hideBoxModel();
|
||||
this._destroyer = this._hideBoxModel();
|
||||
|
||||
this._hoveredNode = null;
|
||||
this._inspector.toolbox.off("picker-node-hovered", this._onToolboxPickerHover);
|
||||
@ -1100,6 +1104,8 @@ MarkupView.prototype = {
|
||||
|
||||
this.tooltip.destroy();
|
||||
this.tooltip = null;
|
||||
|
||||
return this._destroyer;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ function test() {
|
||||
|
||||
instance.setSize(500, 500);
|
||||
|
||||
openComputedView(onInspectorUIOpen);
|
||||
openView("computedview", onInspectorUIOpen);
|
||||
}
|
||||
|
||||
function onInspectorUIOpen(aInspector, aComputedView) {
|
||||
|
@ -49,7 +49,7 @@ function test() {
|
||||
|
||||
instance.setSize(500, 500);
|
||||
|
||||
openRuleView(onInspectorUIOpen);
|
||||
openView("ruleview", onInspectorUIOpen);
|
||||
}
|
||||
|
||||
function onInspectorUIOpen(aInspector, aRuleView) {
|
||||
|
@ -23,23 +23,19 @@ function openInspector(callback)
|
||||
});
|
||||
}
|
||||
|
||||
function openComputedView(callback)
|
||||
function openView(name, callback)
|
||||
{
|
||||
openInspector(inspector => {
|
||||
inspector.sidebar.once("computedview-ready", () => {
|
||||
inspector.sidebar.select("computedview");
|
||||
let ruleView = inspector.sidebar.getWindowForTab("computedview").computedview.view;
|
||||
callback(inspector, ruleView);
|
||||
})
|
||||
});
|
||||
}
|
||||
function openRuleView(callback)
|
||||
{
|
||||
openInspector(inspector => {
|
||||
inspector.sidebar.once("ruleview-ready", () => {
|
||||
inspector.sidebar.select("ruleview");
|
||||
let ruleView = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
|
||||
callback(inspector, ruleView);
|
||||
})
|
||||
function onReady() {
|
||||
inspector.sidebar.select(name);
|
||||
let { view } = inspector.sidebar.getWindowForTab(name)[name];
|
||||
callback(inspector, view);
|
||||
}
|
||||
|
||||
if (inspector.sidebar.getTab(name)) {
|
||||
onReady();
|
||||
} else {
|
||||
inspector.sidebar.once(name + "-ready", onReady);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -25,11 +25,11 @@ function test() {
|
||||
function createDocument() {
|
||||
contentDoc.body.innerHTML = PAGE_CONTENT;
|
||||
|
||||
openRuleView((aInspector, aRuleView) => {
|
||||
openView("ruleview", (aInspector, aRuleView) => {
|
||||
inspector = aInspector;
|
||||
ruleView = aRuleView;
|
||||
inspector.sidebar.once("computedview-ready", () => {
|
||||
computedView = inspector.sidebar.getWindowForTab("computedview").computedview.view;
|
||||
openView("computedview", (_, aComputedView) => {
|
||||
computedView = aComputedView;
|
||||
startTests();
|
||||
});
|
||||
});
|
||||
@ -66,7 +66,6 @@ function testComputedView() {
|
||||
info("Testing computed view tooltip closes on new selection");
|
||||
|
||||
inspector.sidebar.select("computedview");
|
||||
computedView = inspector.sidebar.getWindowForTab("computedview").computedview.view;
|
||||
|
||||
// Show the computed view tooltip
|
||||
let tooltip = computedView.tooltip;
|
||||
|
@ -47,7 +47,7 @@ function highlightNode()
|
||||
// Highlight a node.
|
||||
let div = content.document.getElementsByTagName("div")[0];
|
||||
|
||||
inspector.selection.setNode(div);
|
||||
inspector.selection.setNode(div, "test");
|
||||
inspector.once("inspector-updated", () => {
|
||||
is(inspector.selection.node, div, "selection matches the div element");
|
||||
testRuleViewLink();
|
||||
|
@ -65,26 +65,31 @@ function getActiveInspector()
|
||||
return gDevTools.getToolbox(target).getPanel("inspector");
|
||||
}
|
||||
|
||||
function openRuleView(callback)
|
||||
function openView(name, callback)
|
||||
{
|
||||
openInspector(inspector => {
|
||||
inspector.sidebar.once("ruleview-ready", () => {
|
||||
inspector.sidebar.select("ruleview");
|
||||
let ruleView = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
|
||||
callback(inspector, ruleView);
|
||||
})
|
||||
function onReady() {
|
||||
inspector.sidebar.select(name);
|
||||
let { view } = inspector.sidebar.getWindowForTab(name)[name];
|
||||
callback(inspector, view);
|
||||
}
|
||||
|
||||
if (inspector.sidebar.getTab(name)) {
|
||||
onReady();
|
||||
} else {
|
||||
inspector.sidebar.once(name + "-ready", onReady);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openRuleView(callback)
|
||||
{
|
||||
openView("ruleview", callback);
|
||||
}
|
||||
|
||||
function openComputedView(callback)
|
||||
{
|
||||
openInspector(inspector => {
|
||||
inspector.sidebar.once("computedview-ready", () => {
|
||||
inspector.sidebar.select("computedview");
|
||||
let computedView = inspector.sidebar.getWindowForTab("computedview").computedview.view;
|
||||
callback(inspector, computedView);
|
||||
})
|
||||
});
|
||||
openView("computedview", callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,7 @@
|
||||
.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
-moz-appearance: none;
|
||||
border: 0;
|
||||
-moz-margin-start: 3px;
|
||||
}
|
||||
|
||||
.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
|
@ -506,7 +506,7 @@ toolbar .toolbarbutton-1[checked]:not(:active):hover {
|
||||
transition: background-color 250ms;
|
||||
}
|
||||
|
||||
.toolbarbutton-1[type="menu-button"] {
|
||||
.toolbarbutton-1[type="menu-button"]:not([overflowedItem=true]) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ toolbaritem[overflowedItem=true],
|
||||
-moz-box-orient: horizontal;
|
||||
}
|
||||
|
||||
.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-text,
|
||||
.widget-overflow-list .toolbarbutton-1:not(.toolbarbutton-combined) > .toolbarbutton-text,
|
||||
.widget-overflow-list .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-text {
|
||||
text-align: start;
|
||||
-moz-padding-start: .5em;
|
||||
|
10
configure.in
10
configure.in
@ -71,7 +71,7 @@ GCONF_VERSION=1.2.1
|
||||
GIO_VERSION=2.20
|
||||
STARTUP_NOTIFICATION_VERSION=0.8
|
||||
DBUS_VERSION=0.60
|
||||
SQLITE_VERSION=3.8.3.1
|
||||
SQLITE_VERSION=3.8.4.1
|
||||
|
||||
MSMANIFEST_TOOL=
|
||||
|
||||
@ -7409,6 +7409,14 @@ if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
|
||||
fi
|
||||
AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable Support for Firefox Accounts in B2G
|
||||
dnl ========================================================
|
||||
if test -n "$MOZ_SERVICES_FXACCOUNTS"; then
|
||||
AC_DEFINE(MOZ_SERVICES_FXACCOUNTS)
|
||||
fi
|
||||
AC_SUBST(MOZ_SERVICES_FXACCOUNTS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Support for demangling undefined symbols
|
||||
dnl ========================================================
|
||||
|
@ -102,6 +102,9 @@ enum {
|
||||
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET);
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
class EventChainVisitor;
|
||||
class EventListenerManager;
|
||||
|
||||
namespace dom {
|
||||
@ -1105,18 +1108,18 @@ protected:
|
||||
* @param aURI the uri of the link, set only if the return value is true [OUT]
|
||||
* @return true if we can handle the link event, false otherwise
|
||||
*/
|
||||
bool CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
|
||||
nsIURI** aURI) const;
|
||||
bool CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
|
||||
nsIURI** aURI) const;
|
||||
|
||||
/**
|
||||
* Handle status bar updates before they can be cancelled.
|
||||
*/
|
||||
nsresult PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor);
|
||||
nsresult PreHandleEventForLinks(EventChainPreVisitor& aVisitor);
|
||||
|
||||
/**
|
||||
* Handle default actions for link event if the event isn't consumed yet.
|
||||
*/
|
||||
nsresult PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor);
|
||||
nsresult PostHandleEventForLinks(EventChainPostVisitor& aVisitor);
|
||||
|
||||
/**
|
||||
* Get the target of this link element. Consumers should established that
|
||||
|
@ -21,6 +21,7 @@ class nsIFrame;
|
||||
class nsXBLBinding;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
class ShadowRoot;
|
||||
struct CustomElementData;
|
||||
@ -913,7 +914,8 @@ public:
|
||||
// Overloaded from nsINode
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(
|
||||
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsPurple() = 0;
|
||||
virtual void RemovePurple() = 0;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "mozilla/dom/Attr.h"
|
||||
#include "mozilla/dom/AttrBinding.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsError.h"
|
||||
@ -18,7 +19,6 @@
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
@ -361,7 +361,7 @@ Attr::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
||||
}
|
||||
|
||||
nsresult
|
||||
Attr::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
Attr::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = true;
|
||||
return NS_OK;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsIDocument.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
// Attribute helper class used to wrap up an attribute with a dom
|
||||
@ -51,7 +52,7 @@ public:
|
||||
// nsIDOMAttr interface
|
||||
NS_DECL_NSIDOMATTR
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
// nsIAttribute interface
|
||||
void SetMap(nsDOMAttributeMap *aMap) MOZ_OVERRIDE;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
@ -91,7 +92,6 @@
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIControllers.h"
|
||||
#include "nsView.h"
|
||||
@ -2317,7 +2317,7 @@ Element::Describe(nsAString& aOutDescription) const
|
||||
}
|
||||
|
||||
bool
|
||||
Element::CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
|
||||
Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
|
||||
nsIURI** aURI) const
|
||||
{
|
||||
if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
|
||||
@ -2335,7 +2335,7 @@ Element::CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
|
||||
}
|
||||
|
||||
nsresult
|
||||
Element::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
|
||||
Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
// Optimisation: return early if this event doesn't interest us.
|
||||
// IMPORTANT: this switch and the switch below it must be kept in sync!
|
||||
@ -2396,7 +2396,7 @@ Element::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
|
||||
Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
// Optimisation: return early if this event doesn't interest us.
|
||||
// IMPORTANT: this switch and the switch below it must be kept in sync!
|
||||
|
@ -4,12 +4,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FileIOObject.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMProgressEvent.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
#define ERROR_STR "error"
|
||||
#define ABORT_STR "abort"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "mozilla/dom/FragmentOrElement.h"
|
||||
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/Attr.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
@ -91,7 +92,6 @@
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIControllers.h"
|
||||
#include "nsView.h"
|
||||
@ -703,7 +703,7 @@ FindChromeAccessOnlySubtreeOwner(nsIContent* aContent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
//FIXME! Document how this event retargeting works, Bug 329124.
|
||||
aVisitor.mCanHandle = true;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIURL.h"
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "mozilla/dom/TextDecoder.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/IMEStateManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
@ -74,7 +75,6 @@
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
@ -3630,7 +3630,7 @@ nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent,
|
||||
NS_PRECONDITION(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
|
||||
|
||||
// This checks that IsSafeToRunScript is true since we don't want to fire
|
||||
// events when that is false. We can't rely on nsEventDispatcher to assert
|
||||
// events when that is false. We can't rely on EventDispatcher to assert
|
||||
// this in this situation since most of the time there are no mutation
|
||||
// event listeners, in which case we won't even attempt to dispatch events.
|
||||
// However this also allows for two exceptions. First off, we don't assert
|
||||
@ -3661,7 +3661,7 @@ nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent,
|
||||
mutation.mRelatedNode = do_QueryInterface(aParent);
|
||||
|
||||
mozAutoSubtreeModified subtree(aOwnerDoc, aParent);
|
||||
nsEventDispatcher::Dispatch(aChild, nullptr, &mutation);
|
||||
EventDispatcher::Dispatch(aChild, nullptr, &mutation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "mozilla/dom/DataTransfer.h"
|
||||
|
||||
#include "nsIDocShell.h"
|
||||
@ -48,9 +47,9 @@
|
||||
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Selection.h"
|
||||
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Selection.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -652,8 +651,8 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
InternalClipboardEvent evt(true, aType);
|
||||
evt.clipboardData = clipboardData;
|
||||
nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nullptr,
|
||||
&status);
|
||||
EventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt,
|
||||
nullptr, &status);
|
||||
// If the event was cancelled, don't do the clipboard operation
|
||||
doDefault = (status != nsEventStatus_eConsumeNoDefault);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@
|
||||
|
||||
#include "nsDateTimeFormatCID.h"
|
||||
#include "nsIDateTimeFormat.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "nsDOMCID.h"
|
||||
|
||||
@ -4856,7 +4856,7 @@ nsDocument::DispatchContentLoadedEvents()
|
||||
event->SetTrusted(true);
|
||||
|
||||
// To dispatch this event we must manually call
|
||||
// nsEventDispatcher::Dispatch() on the ancestor document since the
|
||||
// EventDispatcher::Dispatch() on the ancestor document since the
|
||||
// target is not in the same document, so the event would never reach
|
||||
// the ancestor document if we used the normal event
|
||||
// dispatching code.
|
||||
@ -4870,8 +4870,8 @@ nsDocument::DispatchContentLoadedEvents()
|
||||
nsRefPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
if (context) {
|
||||
nsEventDispatcher::Dispatch(parent, context, innerEvent, event,
|
||||
&status);
|
||||
EventDispatcher::Dispatch(parent, context, innerEvent, event,
|
||||
&status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7636,7 +7636,7 @@ nsDocument::GetExistingListenerManager() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
nsDocument::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = true;
|
||||
// FIXME! This is a hack to make middle mouse paste working also in Editor.
|
||||
@ -7675,10 +7675,9 @@ nsIDocument::CreateEvent(const nsAString& aEventType, ErrorResult& rv) const
|
||||
|
||||
// Create event even without presContext.
|
||||
nsCOMPtr<nsIDOMEvent> ev;
|
||||
rv =
|
||||
nsEventDispatcher::CreateEvent(const_cast<nsIDocument*>(this),
|
||||
presContext, nullptr, aEventType,
|
||||
getter_AddRefs(ev));
|
||||
rv = EventDispatcher::CreateEvent(const_cast<nsIDocument*>(this),
|
||||
presContext, nullptr, aEventType,
|
||||
getter_AddRefs(ev));
|
||||
return ev ? dont_AddRef(ev.forget().take()->InternalDOMEvent()) : nullptr;
|
||||
}
|
||||
|
||||
@ -8669,8 +8668,8 @@ nsDocument::DispatchPageTransition(EventTarget* aDispatchTarget,
|
||||
aPersisted))) {
|
||||
event->SetTrusted(true);
|
||||
event->SetTarget(this);
|
||||
nsEventDispatcher::DispatchDOMEvent(aDispatchTarget, nullptr, event,
|
||||
nullptr, nullptr);
|
||||
EventDispatcher::DispatchDOMEvent(aDispatchTarget, nullptr, event,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ class nsPointerLockPermissionRequest;
|
||||
class nsISecurityConsoleMessage;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
class UndoManager;
|
||||
class LifecycleCallbacks;
|
||||
@ -902,7 +903,8 @@ public:
|
||||
NS_DECL_NSIDOMDOCUMENTXBL
|
||||
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(
|
||||
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() MOZ_OVERRIDE;
|
||||
virtual mozilla::EventListenerManager*
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsISHistory.h"
|
||||
#include "nsISHistoryInternal.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
|
@ -15,8 +15,10 @@
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
class nsGenConImageContent MOZ_FINAL : public nsXMLElement,
|
||||
public nsImageLoadingContent
|
||||
@ -43,7 +45,7 @@ public:
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent);
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
MOZ_ASSERT(IsInNativeAnonymousSubtree());
|
||||
if (aVisitor.mEvent->message == NS_LOAD ||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "nsDOMString.h"
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
@ -39,7 +40,6 @@
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsDOMTokenList.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsFrameManager.h"
|
||||
@ -1133,7 +1133,7 @@ nsINode::RemoveEventListener(const nsAString& aType,
|
||||
NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(nsINode)
|
||||
|
||||
nsresult
|
||||
nsINode::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
nsINode::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
// This is only here so that we can use the NS_DECL_NSIDOMTARGET macro
|
||||
NS_ABORT();
|
||||
@ -1162,14 +1162,13 @@ nsINode::DispatchEvent(nsIDOMEvent *aEvent, bool* aRetVal)
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsresult rv =
|
||||
nsEventDispatcher::DispatchDOMEvent(this, nullptr, aEvent, context,
|
||||
&status);
|
||||
EventDispatcher::DispatchDOMEvent(this, nullptr, aEvent, context, &status);
|
||||
*aRetVal = (status != nsEventStatus_eConsumeNoDefault);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::PostHandleEvent(nsEventChainPostVisitor& /*aVisitor*/)
|
||||
nsINode::PostHandleEvent(EventChainPostVisitor& /*aVisitor*/)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1180,8 +1179,8 @@ nsINode::DispatchDOMEvent(WidgetEvent* aEvent,
|
||||
nsPresContext* aPresContext,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return nsEventDispatcher::DispatchDOMEvent(this, aEvent, aDOMEvent,
|
||||
aPresContext, aEventStatus);
|
||||
return EventDispatcher::DispatchDOMEvent(this, aEvent, aDOMEvent,
|
||||
aPresContext, aEventStatus);
|
||||
}
|
||||
|
||||
EventListenerManager*
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsSVGEffects.h"
|
||||
|
||||
#include "mozAutoDocUpdate.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
@ -19,16 +18,18 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||
#include "js/StructuredClone.h"
|
||||
|
||||
using mozilla::dom::StructuredCloneData;
|
||||
using mozilla::dom::StructuredCloneClosure;
|
||||
using namespace mozilla;
|
||||
|
||||
bool
|
||||
nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
const mozilla::dom::StructuredCloneData& aData,
|
||||
const dom::StructuredCloneData& aData,
|
||||
JS::Handle<JSObject *> aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
InfallibleTArray<nsString>* aJSONRetVal,
|
||||
@ -138,7 +139,7 @@ nsInProcessTabChildGlobal::Init()
|
||||
"Couldn't initialize nsInProcessTabChildGlobal");
|
||||
mMessageManager = new nsFrameMessageManager(this,
|
||||
nullptr,
|
||||
mozilla::dom::ipc::MM_CHILD);
|
||||
dom::ipc::MM_CHILD);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -249,7 +250,7 @@ nsInProcessTabChildGlobal::GetOwnerContent()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsInProcessTabChildGlobal::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
nsInProcessTabChildGlobal::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = true;
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
} // namespace mozilla
|
||||
|
||||
class nsInProcessTabChildGlobal : public nsDOMEventTargetHelper,
|
||||
public nsFrameScriptExecutor,
|
||||
public nsIInProcessContentFrameMessageManager,
|
||||
@ -96,7 +100,8 @@ public:
|
||||
JS::Handle<JSObject *> aCpows,
|
||||
nsIPrincipal* aPrincipal) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(
|
||||
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
NS_IMETHOD AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
// Interface headers
|
||||
#include "imgLoader.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -81,6 +80,7 @@
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -376,7 +376,7 @@ nsPluginCrashedEvent::Run()
|
||||
variant->SetAsBool(mSubmittedCrashReport);
|
||||
containerEvent->SetData(NS_LITERAL_STRING("submittedCrashReport"), variant);
|
||||
|
||||
nsEventDispatcher::DispatchDOMEvent(mContent, nullptr, event, nullptr, nullptr);
|
||||
EventDispatcher::DispatchDOMEvent(mContent, nullptr, event, nullptr, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
#include "nsScriptElement.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsScriptLoader.h"
|
||||
#include "nsIParser.h"
|
||||
@ -63,7 +63,7 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
||||
// Load event doesn't bubble.
|
||||
event.mFlags.mBubbles = (type != NS_LOAD);
|
||||
|
||||
nsEventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
||||
EventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
@ -36,7 +37,6 @@
|
||||
#include "nsICachingChannel.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
@ -1393,9 +1393,9 @@ nsXMLHttpRequest::GetLoadGroup() const
|
||||
nsresult
|
||||
nsXMLHttpRequest::CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent)
|
||||
{
|
||||
nsresult rv = nsEventDispatcher::CreateEvent(this, nullptr, nullptr,
|
||||
NS_LITERAL_STRING("Events"),
|
||||
aDOMEvent);
|
||||
nsresult rv = EventDispatcher::CreateEvent(this, nullptr, nullptr,
|
||||
NS_LITERAL_STRING("Events"),
|
||||
aDOMEvent);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -1691,6 +1691,29 @@ CanvasRenderingContext2D::Fill(const CanvasWindingRule& winding)
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::Fill(const CanvasPath& path, const CanvasWindingRule& winding)
|
||||
{
|
||||
EnsureTarget();
|
||||
|
||||
RefPtr<gfx::Path> gfxpath = path.GetPath(winding, mTarget);
|
||||
|
||||
if (!gfxpath) {
|
||||
return;
|
||||
}
|
||||
|
||||
mgfx::Rect bounds;
|
||||
|
||||
if (NeedToDrawShadow()) {
|
||||
bounds = gfxpath->GetBounds(mTarget->GetTransform());
|
||||
}
|
||||
|
||||
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
|
||||
Fill(gfxpath, CanvasGeneralPattern().ForStyle(this, STYLE_FILL, mTarget),
|
||||
DrawOptions(CurrentState().globalAlpha, UsedOperation()));
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::Stroke()
|
||||
{
|
||||
@ -1720,6 +1743,37 @@ CanvasRenderingContext2D::Stroke()
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::Stroke(const CanvasPath& path)
|
||||
{
|
||||
EnsureTarget();
|
||||
|
||||
RefPtr<gfx::Path> gfxpath = path.GetPath(CanvasWindingRule::Nonzero, mTarget);
|
||||
|
||||
if (!gfxpath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ContextState &state = CurrentState();
|
||||
|
||||
StrokeOptions strokeOptions(state.lineWidth, state.lineJoin,
|
||||
state.lineCap, state.miterLimit,
|
||||
state.dash.Length(), state.dash.Elements(),
|
||||
state.dashOffset);
|
||||
|
||||
mgfx::Rect bounds;
|
||||
if (NeedToDrawShadow()) {
|
||||
bounds =
|
||||
gfxpath->GetStrokedBounds(strokeOptions, mTarget->GetTransform());
|
||||
}
|
||||
|
||||
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
|
||||
Stroke(gfxpath, CanvasGeneralPattern().ForStyle(this, STYLE_STROKE, mTarget),
|
||||
strokeOptions, DrawOptions(state.globalAlpha, UsedOperation()));
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::DrawFocusIfNeeded(mozilla::dom::Element& aElement)
|
||||
{
|
||||
EnsureUserSpacePath();
|
||||
@ -1800,6 +1854,21 @@ CanvasRenderingContext2D::Clip(const CanvasWindingRule& winding)
|
||||
CurrentState().clipsPushed.push_back(mPath);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::Clip(const CanvasPath& path, const CanvasWindingRule& winding)
|
||||
{
|
||||
EnsureTarget();
|
||||
|
||||
RefPtr<gfx::Path> gfxpath = path.GetPath(winding, mTarget);
|
||||
|
||||
if (!gfxpath) {
|
||||
return;
|
||||
}
|
||||
|
||||
mTarget->PushClip(gfxpath);
|
||||
CurrentState().clipsPushed.push_back(gfxpath);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::ArcTo(double x1, double y1, double x2,
|
||||
double y2, double radius,
|
||||
@ -4226,5 +4295,212 @@ CanvasRenderingContext2D::ShouldForceInactiveLayer(LayerManager *aManager)
|
||||
return !aManager->CanUseCanvasLayerForSize(IntSize(mWidth, mHeight));
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasPath, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasPath, Release)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(CanvasPath)
|
||||
|
||||
CanvasPath::CanvasPath(nsCOMPtr<nsISupports> aParent) : mParent(aParent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
||||
mPathBuilder = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()->CreatePathBuilder();
|
||||
}
|
||||
|
||||
CanvasPath::CanvasPath(nsCOMPtr<nsISupports> aParent, RefPtr<PathBuilder> aPathBuilder): mParent(aParent), mPathBuilder(aPathBuilder)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
||||
if (!mPathBuilder) {
|
||||
mPathBuilder = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()->CreatePathBuilder();
|
||||
}
|
||||
}
|
||||
|
||||
JSObject*
|
||||
CanvasPath::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return Path2DBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
already_AddRefed<CanvasPath>
|
||||
CanvasPath::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<CanvasPath> path = new CanvasPath(aGlobal.GetAsSupports());
|
||||
return path.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<CanvasPath>
|
||||
CanvasPath::Constructor(const GlobalObject& aGlobal, CanvasPath& aCanvasPath, ErrorResult& aRv)
|
||||
{
|
||||
RefPtr<gfx::Path> tempPath = aCanvasPath.GetPath(CanvasWindingRule::Nonzero,
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
|
||||
|
||||
nsRefPtr<CanvasPath> path = new CanvasPath(aGlobal.GetAsSupports(), tempPath->CopyToBuilder());
|
||||
return path.forget();
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::ClosePath()
|
||||
{
|
||||
mPathBuilder->Close();
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::MoveTo(double x, double y)
|
||||
{
|
||||
mPathBuilder->MoveTo(Point(ToFloat(x), ToFloat(y)));
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::LineTo(double x, double y)
|
||||
{
|
||||
mPathBuilder->LineTo(Point(ToFloat(x), ToFloat(y)));
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::QuadraticCurveTo(double cpx, double cpy, double x, double y)
|
||||
{
|
||||
mPathBuilder->QuadraticBezierTo(gfx::Point(ToFloat(cpx), ToFloat(cpy)),
|
||||
gfx::Point(ToFloat(x), ToFloat(y)));
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::BezierCurveTo(double cp1x, double cp1y,
|
||||
double cp2x, double cp2y,
|
||||
double x, double y)
|
||||
{
|
||||
BezierTo(gfx::Point(ToFloat(cp1x), ToFloat(cp1y)),
|
||||
gfx::Point(ToFloat(cp2x), ToFloat(cp2y)),
|
||||
gfx::Point(ToFloat(x), ToFloat(y)));
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::ArcTo(double x1, double y1, double x2, double y2, double radius,
|
||||
ErrorResult& error)
|
||||
{
|
||||
if (radius < 0) {
|
||||
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Current point in user space!
|
||||
Point p0 = mPathBuilder->CurrentPoint();
|
||||
Point p1(x1, y1);
|
||||
Point p2(x2, y2);
|
||||
|
||||
// Execute these calculations in double precision to avoid cumulative
|
||||
// rounding errors.
|
||||
double dir, a2, b2, c2, cosx, sinx, d, anx, any,
|
||||
bnx, bny, x3, y3, x4, y4, cx, cy, angle0, angle1;
|
||||
bool anticlockwise;
|
||||
|
||||
if (p0 == p1 || p1 == p2 || radius == 0) {
|
||||
LineTo(p1.x, p1.y);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for colinearity
|
||||
dir = (p2.x - p1.x) * (p0.y - p1.y) + (p2.y - p1.y) * (p1.x - p0.x);
|
||||
if (dir == 0) {
|
||||
LineTo(p1.x, p1.y);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// XXX - Math for this code was already available from the non-azure code
|
||||
// and would be well tested. Perhaps converting to bezier directly might
|
||||
// be more efficient longer run.
|
||||
a2 = (p0.x-x1)*(p0.x-x1) + (p0.y-y1)*(p0.y-y1);
|
||||
b2 = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
|
||||
c2 = (p0.x-x2)*(p0.x-x2) + (p0.y-y2)*(p0.y-y2);
|
||||
cosx = (a2+b2-c2)/(2*sqrt(a2*b2));
|
||||
|
||||
sinx = sqrt(1 - cosx*cosx);
|
||||
d = radius / ((1 - cosx) / sinx);
|
||||
|
||||
anx = (x1-p0.x) / sqrt(a2);
|
||||
any = (y1-p0.y) / sqrt(a2);
|
||||
bnx = (x1-x2) / sqrt(b2);
|
||||
bny = (y1-y2) / sqrt(b2);
|
||||
x3 = x1 - anx*d;
|
||||
y3 = y1 - any*d;
|
||||
x4 = x1 - bnx*d;
|
||||
y4 = y1 - bny*d;
|
||||
anticlockwise = (dir < 0);
|
||||
cx = x3 + any*radius*(anticlockwise ? 1 : -1);
|
||||
cy = y3 - anx*radius*(anticlockwise ? 1 : -1);
|
||||
angle0 = atan2((y3-cy), (x3-cx));
|
||||
angle1 = atan2((y4-cy), (x4-cx));
|
||||
|
||||
|
||||
LineTo(x3, y3);
|
||||
|
||||
Arc(cx, cy, radius, angle0, angle1, anticlockwise, error);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::Rect(double x, double y, double w, double h)
|
||||
{
|
||||
MoveTo(x, y);
|
||||
LineTo(x + w, y);
|
||||
LineTo(x + w, y + h);
|
||||
LineTo(x, y + h);
|
||||
ClosePath();
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::Arc(double x, double y, double radius,
|
||||
double startAngle, double endAngle, bool anticlockwise,
|
||||
ErrorResult& error)
|
||||
{
|
||||
if (radius < 0.0) {
|
||||
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
ArcToBezier(this, Point(x, y), Size(radius, radius), startAngle, endAngle, anticlockwise);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::LineTo(const gfx::Point& aPoint)
|
||||
{
|
||||
mPathBuilder->LineTo(aPoint);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasPath::BezierTo(const gfx::Point& aCP1,
|
||||
const gfx::Point& aCP2,
|
||||
const gfx::Point& aCP3)
|
||||
{
|
||||
mPathBuilder->BezierTo(aCP1, aCP2, aCP3);
|
||||
}
|
||||
|
||||
RefPtr<gfx::Path>
|
||||
CanvasPath::GetPath(const CanvasWindingRule& winding, const mozilla::RefPtr<mozilla::gfx::DrawTarget>& mTarget) const
|
||||
{
|
||||
FillRule fillRule = FillRule::FILL_WINDING;
|
||||
if (winding == CanvasWindingRule::Evenodd) {
|
||||
fillRule = FillRule::FILL_EVEN_ODD;
|
||||
}
|
||||
|
||||
RefPtr<Path> mTempPath = mPathBuilder->Finish();
|
||||
if (!mTempPath)
|
||||
return mTempPath;
|
||||
|
||||
// retarget our backend if we're used with a different backend
|
||||
if (mTempPath->GetBackendType() != mTarget->GetType()) {
|
||||
mPathBuilder = mTarget->CreatePathBuilder(fillRule);
|
||||
mTempPath->StreamToSink(mPathBuilder);
|
||||
mTempPath = mPathBuilder->Finish();
|
||||
} else if (mTempPath->GetFillRule() != fillRule) {
|
||||
mPathBuilder = mTempPath->CopyToBuilder(fillRule);
|
||||
mTempPath = mPathBuilder->Finish();
|
||||
}
|
||||
|
||||
mPathBuilder = mTempPath->CopyToBuilder();
|
||||
|
||||
return mTempPath;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,57 @@ extern const mozilla::gfx::Float SIGMA_MAX;
|
||||
|
||||
template<typename T> class Optional;
|
||||
|
||||
class CanvasPath :
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPath)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPath)
|
||||
|
||||
nsCOMPtr<nsISupports> GetParentObject() { return mParent; }
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
|
||||
|
||||
static already_AddRefed<CanvasPath> Constructor(const GlobalObject& aGlobal,
|
||||
ErrorResult& rv);
|
||||
static already_AddRefed<CanvasPath> Constructor(const GlobalObject& aGlobal,
|
||||
CanvasPath& aCanvasPath,
|
||||
ErrorResult& rv);
|
||||
|
||||
void ClosePath();
|
||||
void MoveTo(double x, double y);
|
||||
void LineTo(double x, double y);
|
||||
void QuadraticCurveTo(double cpx, double cpy, double x, double y);
|
||||
void BezierCurveTo(double cp1x, double cp1y,
|
||||
double cp2x, double cp2y,
|
||||
double x, double y);
|
||||
void ArcTo(double x1, double y1, double x2, double y2, double radius,
|
||||
ErrorResult& error);
|
||||
void Rect(double x, double y, double w, double h);
|
||||
void Arc(double x, double y, double radius,
|
||||
double startAngle, double endAngle, bool anticlockwise,
|
||||
ErrorResult& error);
|
||||
|
||||
void LineTo(const gfx::Point& aPoint);
|
||||
void BezierTo(const gfx::Point& aCP1,
|
||||
const gfx::Point& aCP2,
|
||||
const gfx::Point& aCP3);
|
||||
|
||||
mozilla::RefPtr<mozilla::gfx::Path> GetPath(const CanvasWindingRule& winding,
|
||||
const mozilla::RefPtr<mozilla::gfx::DrawTarget>& mTarget) const;
|
||||
|
||||
CanvasPath(nsCOMPtr<nsISupports> aParent);
|
||||
CanvasPath(nsCOMPtr<nsISupports> aParent, RefPtr<gfx::PathBuilder> mPathBuilder);
|
||||
virtual ~CanvasPath() {}
|
||||
|
||||
private:
|
||||
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
static gfx::Float ToFloat(double aValue) { return gfx::Float(aValue); }
|
||||
|
||||
mutable RefPtr<gfx::PathBuilder> mPathBuilder;
|
||||
};
|
||||
|
||||
struct CanvasBidiProcessor;
|
||||
class CanvasRenderingContext2DUserData;
|
||||
|
||||
@ -172,10 +223,13 @@ public:
|
||||
void StrokeRect(double x, double y, double w, double h);
|
||||
void BeginPath();
|
||||
void Fill(const CanvasWindingRule& winding);
|
||||
void Fill(const CanvasPath& path, const CanvasWindingRule& winding);
|
||||
void Stroke();
|
||||
void Stroke(const CanvasPath& path);
|
||||
void DrawFocusIfNeeded(mozilla::dom::Element& element);
|
||||
bool DrawCustomFocusRing(mozilla::dom::Element& element);
|
||||
void Clip(const CanvasWindingRule& winding);
|
||||
void Clip(const CanvasPath& path, const CanvasWindingRule& winding);
|
||||
bool IsPointInPath(double x, double y, const CanvasWindingRule& winding);
|
||||
bool IsPointInStroke(double x, double y);
|
||||
void FillText(const nsAString& text, double x, double y,
|
||||
|
@ -192,6 +192,7 @@ skip-if = (toolkit == 'gonk' && debug) #debug-only crash; bug 933541
|
||||
[test_canvas_focusring.html]
|
||||
skip-if = (toolkit == 'gonk' && !debug) #specialpowers.wrap
|
||||
[test_canvas_font_setter.html]
|
||||
[test_canvas_path.html]
|
||||
[test_hitregion_canvas.html]
|
||||
skip-if = os == "android" || appname == "b2g"
|
||||
[test_canvas_strokeStyle_getter.html]
|
||||
|
199
content/canvas/test/test_canvas_path.html
Normal file
199
content/canvas/test/test_canvas_path.html
Normal file
@ -0,0 +1,199 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas Tests</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Cr = SpecialPowers.Cr;
|
||||
SpecialPowers.setBoolPref("canvas.path.enabled", true);
|
||||
|
||||
function isPixel(ctx, x,y, c, d) {
|
||||
var pos = x + "," + y;
|
||||
var color = c[0] + "," + c[1] + "," + c[2] + "," + c[3];
|
||||
var pixel = ctx.getImageData(x, y, 1, 1);
|
||||
var pr = pixel.data[0],
|
||||
pg = pixel.data[1],
|
||||
pb = pixel.data[2],
|
||||
pa = pixel.data[3];
|
||||
ok(c[0]-d <= pr && pr <= c[0]+d &&
|
||||
c[1]-d <= pg && pg <= c[1]+d &&
|
||||
c[2]-d <= pb && pb <= c[2]+d &&
|
||||
c[3]-d <= pa && pa <= c[3]+d,
|
||||
"pixel "+pos+" of "+ctx.canvas.id+" is "+pr+","+pg+","+pb+","+pa+"; expected "+color+" +/- "+d);
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: test_drawClipPath_canvas</p>
|
||||
<canvas id="c1" class="output" width="100" height="100">+
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
function test_drawClipPath_canvas() {
|
||||
var c = document.getElementById("c1");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
var path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.beginPath();
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.save();
|
||||
ctx.clip(path);
|
||||
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
isPixel(ctx, 50, 50, [0, 255, 0, 255], 5);
|
||||
ctx.restore();
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.beginPath();
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.save();
|
||||
ctx.clip(path, 'nonzero');
|
||||
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
isPixel(ctx, 50, 50, [0, 255, 0, 255], 5);
|
||||
ctx.restore();
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.beginPath();
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.save();
|
||||
ctx.clip(path, 'evenodd');
|
||||
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
isPixel(ctx, 50, 50, [255, 0, 0, 255], 5);
|
||||
ctx.restore();
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: test_drawFillPath_canvas</p>
|
||||
<canvas id="c2" class="output" width="100" height="100">+
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
function test_drawFillPath_canvas() {
|
||||
var c = document.getElementById("c2");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
var path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.fill(path);
|
||||
isPixel(ctx, 50, 50, [0, 255, 0, 255], 5);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.fill(path, 'nonzero');
|
||||
isPixel(ctx, 50, 50, [0, 255, 0, 255], 5);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.fill(path, 'evenodd');
|
||||
isPixel(ctx, 50, 50, [255, 0, 0, 255], 5);
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: test_drawStrokePath_canvas</p>
|
||||
<canvas id="c3" class="output" width="100" height="100">+
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
function test_drawStrokePath_canvas() {
|
||||
var c = document.getElementById("c3");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
var path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.strokeStyle = 'rgb(0,255,0)';
|
||||
ctx.lineWidth = 5;
|
||||
ctx.stroke(path);
|
||||
isPixel(ctx, 0, 0, [0, 255, 0, 255], 5);
|
||||
isPixel(ctx, 25, 25, [0, 255, 0, 255], 5);
|
||||
isPixel(ctx, 10, 10, [255, 0, 0, 255], 5);
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: test_large_canvas</p>
|
||||
<canvas id="c4" class="output" width="10000" height="100">+
|
||||
</canvas>
|
||||
<script type="text/javascript">
|
||||
function test_large_canvas() {
|
||||
// test paths on large canvases. On certain platforms this will
|
||||
// trigger retargeting of the backend
|
||||
var c = document.getElementById("c4");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
var path = new Path2D();
|
||||
path.rect(0, 0, 100, 100);
|
||||
path.rect(25, 25, 50, 50);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.fill(path);
|
||||
isPixel(ctx, 50, 50, [0, 255, 0, 255], 5);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.fill(path, 'nonzero');
|
||||
isPixel(ctx, 50, 50, [0, 255, 0, 255], 5);
|
||||
|
||||
ctx.fillStyle = 'rgb(255,0,0)';
|
||||
ctx.fillRect(0, 0, 100, 100);
|
||||
ctx.fillStyle = 'rgb(0,255,0)';
|
||||
ctx.fill(path, 'evenodd');
|
||||
isPixel(ctx, 50, 50, [255, 0, 0, 255], 5);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function runTests() {
|
||||
try {
|
||||
test_drawClipPath_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_drawClipPath_canvas");
|
||||
}
|
||||
try {
|
||||
test_drawFillPath_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_drawFillPath_canvas");
|
||||
}
|
||||
try {
|
||||
test_drawStrokePath_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_drawStrokePath_canvas");
|
||||
}
|
||||
try {
|
||||
test_large_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_large_canvas");
|
||||
}
|
||||
|
||||
SpecialPowers.setBoolPref("canvas.path.enabled", false);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
addLoadEvent(runTests);
|
||||
|
||||
</script>
|
@ -7,6 +7,7 @@
|
||||
#include "mozilla/dom/HTMLAnchorElement.h"
|
||||
|
||||
#include "mozilla/dom/HTMLAnchorElementBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -244,13 +245,13 @@ HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLAnchorElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLAnchorElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
return PreHandleEventForAnchors(aVisitor);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLAnchorElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLAnchorElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
return PostHandleEventForAnchors(aVisitor);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "nsDOMTokenList.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLAnchorElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
@ -54,8 +56,9 @@ public:
|
||||
bool aNullParent = true) MOZ_OVERRIDE;
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/HTMLAreaElementBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Area)
|
||||
@ -92,13 +93,13 @@ HTMLAreaElement::SetTarget(const nsAString& aValue)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
return PreHandleEventForAnchors(aVisitor);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLAreaElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
return PostHandleEventForAnchors(aVisitor);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
class nsIDocument;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLAreaElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
@ -43,8 +45,8 @@ public:
|
||||
// nsIDOMHTMLAreaElement
|
||||
NS_DECL_NSIDOMHTMLAREAELEMENT
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
||||
|
@ -23,11 +23,11 @@
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPresState.h"
|
||||
#include "nsError.h"
|
||||
#include "nsFocusManager.h"
|
||||
@ -187,7 +187,7 @@ HTMLButtonElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLButtonElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = false;
|
||||
if (IsDisabledForEvents(aVisitor.mEvent->message)) {
|
||||
@ -219,7 +219,7 @@ HTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!aVisitor.mPresContext) {
|
||||
@ -278,9 +278,9 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
NS_MOUSE_CLICK, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aVisitor.mPresContext, &event, nullptr,
|
||||
&status);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aVisitor.mPresContext, &event, nullptr,
|
||||
&status);
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLButtonElement MOZ_FINAL : public nsGenericHTMLFormElementWithState,
|
||||
@ -47,8 +49,9 @@ public:
|
||||
virtual bool IsDisabledForEvents(uint32_t aMessage) MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
// nsINode
|
||||
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
@ -4,10 +4,10 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLFieldSetElement.h"
|
||||
#include "mozilla/dom/HTMLFieldSetElementBinding.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
|
||||
|
||||
@ -67,7 +67,7 @@ HTMLFieldSetElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
|
||||
// nsIContent
|
||||
nsresult
|
||||
HTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLFieldSetElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
// Do not process any DOM events if the element is disabled.
|
||||
aVisitor.mCanHandle = false;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "mozilla/dom/ValidityState.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLFieldSetElement MOZ_FINAL : public nsGenericHTMLFormElement,
|
||||
@ -38,7 +39,7 @@ public:
|
||||
NS_DECL_NSIDOMHTMLFIELDSETELEMENT
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLFormControlsCollection.h"
|
||||
#include "mozilla/dom/HTMLFormElementBinding.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
@ -47,8 +48,6 @@
|
||||
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
|
||||
@ -289,8 +288,7 @@ NS_IMETHODIMP
|
||||
HTMLFormElement::Reset()
|
||||
{
|
||||
InternalFormEvent event(true, NS_FORM_RESET);
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr,
|
||||
&event);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr, &event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -482,7 +480,7 @@ HTMLFormElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLFormElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mWantsWillHandleEvent = true;
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
@ -511,7 +509,7 @@ HTMLFormElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLFormElement::WillHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
// If this is the bubble stage and there is a nested form below us which
|
||||
// received a submit event we do *not* want to handle the submit event
|
||||
@ -526,7 +524,7 @@ HTMLFormElement::WillHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLFormElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
uint32_t msg = aVisitor.mEvent->message;
|
||||
|
@ -27,6 +27,8 @@ class nsIMutableArray;
|
||||
class nsIURI;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
class HTMLFormControlsCollection;
|
||||
class HTMLImageElement;
|
||||
@ -89,9 +91,11 @@ public:
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult WillHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult WillHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "nsRuleData.h"
|
||||
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
@ -341,7 +341,7 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
|
||||
|
||||
nsresult
|
||||
HTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLImageElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
// If we are a map and get a mouse click, don't let it be handled by
|
||||
// the Generic Element as this could cause a click event to fire
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Units.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLImageElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
@ -51,7 +52,7 @@ public:
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -57,11 +57,11 @@
|
||||
#include "nsLinebreakConverter.h" //to strip out carriage returns
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
@ -3201,8 +3201,8 @@ HTMLInputElement::DispatchSelectEvent(nsPresContext* aPresContext)
|
||||
WidgetEvent event(nsContentUtils::IsCallerChrome(), NS_FORM_SELECTED);
|
||||
|
||||
mHandlingSelectEvent = true;
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aPresContext, &event, nullptr, &status);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aPresContext, &event, nullptr, &status);
|
||||
mHandlingSelectEvent = false;
|
||||
}
|
||||
|
||||
@ -3222,7 +3222,8 @@ HTMLInputElement::SelectAll(nsPresContext* aPresContext)
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLInputElement::NeedToInitializeEditorForEvent(nsEventChainPreVisitor& aVisitor) const
|
||||
HTMLInputElement::NeedToInitializeEditorForEvent(
|
||||
EventChainPreVisitor& aVisitor) const
|
||||
{
|
||||
// We only need to initialize the editor for single line input controls because they
|
||||
// are lazily initialized. We don't need to initialize the control for
|
||||
@ -3253,7 +3254,7 @@ HTMLInputElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
// Do not process any DOM events if the element is disabled
|
||||
aVisitor.mCanHandle = false;
|
||||
@ -3730,7 +3731,7 @@ HTMLInputElement::ShouldPreventDOMActivateDispatch(EventTarget* aOriginalTarget)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLInputElement::MaybeInitPickers(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
// Open a file picker when we receive a click on a <input type='file'>, or
|
||||
// open a color picker when we receive a click on a <input type='color'>.
|
||||
@ -3756,7 +3757,7 @@ HTMLInputElement::MaybeInitPickers(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (!aVisitor.mPresContext) {
|
||||
// Hack alert! In order to open file picker even in case the element isn't
|
||||
@ -3982,9 +3983,9 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aVisitor.mPresContext, &event,
|
||||
nullptr, &status);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aVisitor.mPresContext, &event,
|
||||
nullptr, &status);
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
} // case
|
||||
} // switch
|
||||
@ -4016,9 +4017,10 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
NS_MOUSE_CLICK, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
||||
rv = nsEventDispatcher::Dispatch(ToSupports(selectedRadioButton),
|
||||
aVisitor.mPresContext,
|
||||
&event, nullptr, &status);
|
||||
rv =
|
||||
EventDispatcher::Dispatch(ToSupports(selectedRadioButton),
|
||||
aVisitor.mPresContext,
|
||||
&event, nullptr, &status);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
@ -4239,7 +4241,7 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
MOZ_ASSERT(mType == NS_FORM_INPUT_RANGE);
|
||||
|
||||
@ -5465,13 +5467,14 @@ FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
|
||||
{
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsCOMPtr<mozilla::dom::Element> element = do_QueryInterface(aTarget);
|
||||
if (NS_SUCCEEDED(nsEventDispatcher::CreateEvent(element, aPresContext, nullptr,
|
||||
NS_LITERAL_STRING("Events"),
|
||||
getter_AddRefs(event)))) {
|
||||
if (NS_SUCCEEDED(EventDispatcher::CreateEvent(element, aPresContext, nullptr,
|
||||
NS_LITERAL_STRING("Events"),
|
||||
getter_AddRefs(event)))) {
|
||||
event->InitEvent(aEventType, true, true);
|
||||
event->SetTrusted(true);
|
||||
|
||||
nsEventDispatcher::DispatchDOMEvent(aTarget, nullptr, event, aPresContext, nullptr);
|
||||
EventDispatcher::DispatchDOMEvent(aTarget, nullptr, event, aPresContext,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -29,6 +29,10 @@ class nsIRadioVisitor;
|
||||
class nsTextEditorState;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Date;
|
||||
@ -148,9 +152,10 @@ public:
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
void PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor);
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
void PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor);
|
||||
void StartRangeThumbDrag(WidgetGUIEvent* aEvent);
|
||||
void FinishRangeThumbDrag(WidgetGUIEvent* aEvent = nullptr);
|
||||
void CancelRangeThumbDrag(bool aIsForUserEvent = true);
|
||||
@ -891,7 +896,7 @@ protected:
|
||||
* Determine whether the editor needs to be initialized explicitly for
|
||||
* a particular event.
|
||||
*/
|
||||
bool NeedToInitializeEditorForEvent(nsEventChainPreVisitor& aVisitor) const;
|
||||
bool NeedToInitializeEditorForEvent(EventChainPreVisitor& aVisitor) const;
|
||||
|
||||
/**
|
||||
* Get the value mode of the element, depending of the type.
|
||||
@ -1179,7 +1184,7 @@ protected:
|
||||
* this function checks if it is needed, and if so, open the corresponding
|
||||
* picker (color picker or file picker).
|
||||
*/
|
||||
nsresult MaybeInitPickers(nsEventChainPostVisitor& aVisitor);
|
||||
nsresult MaybeInitPickers(EventChainPostVisitor& aVisitor);
|
||||
|
||||
enum FilePickerType {
|
||||
FILE_PICKER_FILE,
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Implementation of HTML <label> elements.
|
||||
*/
|
||||
#include "HTMLLabelElement.h"
|
||||
#include "mozilla/dom/HTMLLabelElementBinding.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/dom/HTMLLabelElementBinding.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
|
||||
// construction, destruction
|
||||
@ -112,7 +112,7 @@ DestroyMouseDownPoint(void * /*aObject*/,
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mHandlingEvent ||
|
||||
@ -238,8 +238,8 @@ HTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
|
||||
nsAutoPopupStatePusher popupStatePusher(aIsTrustedEvent ?
|
||||
openAllowed : openAbused);
|
||||
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLLabelElement MOZ_FINAL : public nsGenericHTMLFormElement,
|
||||
@ -60,7 +61,8 @@ public:
|
||||
virtual bool IsDisabled() const MOZ_OVERRIDE { return false; }
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent) MOZ_OVERRIDE;
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLLinkElementBinding.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -302,13 +303,13 @@ HTMLLinkElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLLinkElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLLinkElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
return PreHandleEventForAnchors(aVisitor);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLLinkElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLLinkElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
return PostHandleEventForAnchors(aVisitor);
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "nsStyleLinkElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLLinkElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
@ -41,8 +43,9 @@ public:
|
||||
void LinkRemoved();
|
||||
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
// nsINode
|
||||
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include "nsITimer.h"
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "MediaError.h"
|
||||
#include "MediaDecoder.h"
|
||||
#include "nsICategoryManager.h"
|
||||
@ -3951,6 +3950,7 @@ HTMLMediaElement::AddTextTrack(TextTrackKind aKind,
|
||||
{
|
||||
if (mTextTrackManager) {
|
||||
return mTextTrackManager->AddTextTrack(aKind, aLabel, aLanguage,
|
||||
TextTrackMode::Hidden,
|
||||
TextTrackSource::AddTextTrack);
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -6,11 +6,11 @@
|
||||
#include "mozilla/dom/HTMLMenuElement.h"
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLMenuElementBinding.h"
|
||||
#include "mozilla/dom/HTMLMenuItemElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsXULContextMenuBuilder.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
@ -86,8 +86,8 @@ HTMLMenuElement::SendShowEvent()
|
||||
|
||||
nsRefPtr<nsPresContext> presContext = shell->GetPresContext();
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event, nullptr, &status);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event, nullptr, &status);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6,10 +6,10 @@
|
||||
#include "mozilla/dom/HTMLMenuItemElement.h"
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLMenuItemElementBinding.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(MenuItem)
|
||||
@ -251,7 +251,7 @@ HTMLMenuItemElement::SetChecked(bool aChecked)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLMenuItemElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLMenuItemElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->message == NS_MOUSE_CLICK) {
|
||||
|
||||
@ -286,7 +286,7 @@ HTMLMenuItemElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLMenuItemElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLMenuItemElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
// Check to see if the event was cancelled.
|
||||
if (aVisitor.mEvent->message == NS_MOUSE_CLICK &&
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventChainPreVisitor;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Visitor;
|
||||
@ -33,8 +36,9 @@ public:
|
||||
// nsIDOMHTMLMenuItemElement
|
||||
NS_DECL_NSIDOMHTMLMENUITEMELEMENT
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
|
@ -3,6 +3,7 @@
|
||||
* 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/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLOptGroupElement.h"
|
||||
#include "mozilla/dom/HTMLOptGroupElementBinding.h"
|
||||
#include "mozilla/dom/HTMLSelectElement.h" // SafeOptionListMutation
|
||||
@ -12,8 +13,6 @@
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsEventStates.h"
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(OptGroup)
|
||||
|
||||
namespace mozilla {
|
||||
@ -48,7 +47,7 @@ NS_IMPL_STRING_ATTR(HTMLOptGroupElement, Label, label)
|
||||
|
||||
|
||||
nsresult
|
||||
HTMLOptGroupElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLOptGroupElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = false;
|
||||
// Do not process any DOM events if the element is disabled
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
|
||||
class HTMLOptGroupElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
@ -34,7 +35,7 @@ public:
|
||||
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) MOZ_OVERRIDE;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "mozilla/dom/HTMLSelectElement.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "nsFormSubmission.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLOptGroupElement.h"
|
||||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
@ -15,7 +16,6 @@
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "nsFormSubmission.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -1478,7 +1478,7 @@ HTMLSelectElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLSelectElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = false;
|
||||
if (IsDisabledForEvents(aVisitor.mEvent->message)) {
|
||||
@ -1489,7 +1489,7 @@ HTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLSelectElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->message == NS_FOCUS_CONTENT) {
|
||||
// If the invalid UI is shown, we should show it while focused and
|
||||
|
@ -25,6 +25,10 @@ class nsISelectControlFrame;
|
||||
class nsPresState;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class HTMLSelectElement;
|
||||
@ -259,8 +263,9 @@ public:
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, int32_t* aTabIndex) MOZ_OVERRIDE;
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
||||
|
@ -10,12 +10,12 @@
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsError.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsFormSubmission.h"
|
||||
#include "nsIComponentManager.h"
|
||||
@ -137,8 +137,8 @@ HTMLTextAreaElement::Select()
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetGUIEvent event(true, NS_FORM_SELECTED, nullptr);
|
||||
// XXXbz HTMLInputElement guards against this reentering; shouldn't we?
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event, nullptr, &status);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event, nullptr, &status);
|
||||
|
||||
// If the DOM event was not canceled (e.g. by a JS event handler
|
||||
// returning false)
|
||||
@ -454,7 +454,7 @@ HTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
HTMLTextAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mCanHandle = false;
|
||||
if (IsDisabledForEvents(aVisitor.mEvent->message)) {
|
||||
@ -509,7 +509,7 @@ HTMLTextAreaElement::FireChangeEventIfNeeded()
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLTextAreaElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
HTMLTextAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->message == NS_FORM_SELECTED) {
|
||||
mHandlingSelect = false;
|
||||
|
@ -29,6 +29,10 @@ class nsPresContext;
|
||||
class nsPresState;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class HTMLTextAreaElement MOZ_FINAL : public nsGenericHTMLFormElementWithState,
|
||||
@ -113,8 +117,9 @@ public:
|
||||
int32_t aModType) const MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -154,7 +154,7 @@ HTMLTrackElement::CreateTextTrack()
|
||||
}
|
||||
|
||||
mTrack = new TextTrack(OwnerDoc()->GetParentObject(), kind, label, srcLang,
|
||||
TextTrackSource::Track);
|
||||
TextTrackMode::Disabled, TextTrackSource::Track);
|
||||
mTrack->SetTrackElement(this);
|
||||
|
||||
if (mMediaParent) {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "nsITimer.h"
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIDOMProgressEvent.h"
|
||||
#include "MediaError.h"
|
||||
#include "MediaDecoder.h"
|
||||
|
@ -112,13 +112,14 @@ TextTrackManager::TextTracks() const
|
||||
already_AddRefed<TextTrack>
|
||||
TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackSource aTextTrackSource)
|
||||
{
|
||||
if (!mMediaElement) {
|
||||
return nullptr;
|
||||
}
|
||||
nsRefPtr<TextTrack> ttrack =
|
||||
mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aTextTrackSource,
|
||||
mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aTextTrackSource,
|
||||
CompareTextTracks(mMediaElement));
|
||||
ttrack->SetReadyState(HTMLTrackElement::READY_STATE_LOADED);
|
||||
AddCues(ttrack);
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
already_AddRefed<TextTrack> AddTextTrack(TextTrackKind aKind,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackSource aTextTrackSource);
|
||||
void AddTextTrack(TextTrack* aTextTrack);
|
||||
void RemoveTextTrack(TextTrack* aTextTrack, bool aPendingListOnly);
|
||||
|
@ -15,13 +15,13 @@
|
||||
#include "nsVariant.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIDOMDOMTransactionEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
// Includes for mutation observer.
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
@ -1181,8 +1181,8 @@ UndoManager::DispatchTransactionEvent(JSContext* aCx, const nsAString& aType,
|
||||
transactions))) {
|
||||
event->SetTrusted(true);
|
||||
event->SetTarget(mHostNode);
|
||||
nsEventDispatcher::DispatchDOMEvent(mHostNode, nullptr, event,
|
||||
nullptr, nullptr);
|
||||
EventDispatcher::DispatchDOMEvent(mHostNode, nullptr, event,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/Likely.h"
|
||||
@ -75,7 +76,6 @@
|
||||
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsHtml5Module.h"
|
||||
@ -695,7 +695,8 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
||||
}
|
||||
|
||||
bool
|
||||
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(nsEventChainVisitor& aVisitor)
|
||||
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
|
||||
EventChainVisitor& aVisitor)
|
||||
{
|
||||
NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
|
||||
"should be called only when |this| implements |Link|");
|
||||
@ -717,7 +718,7 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(nsEventChainVisito
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::PreHandleEventForAnchors(nsEventChainPreVisitor& aVisitor)
|
||||
nsGenericHTMLElement::PreHandleEventForAnchors(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElementBase::PreHandleEvent(aVisitor);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -730,7 +731,7 @@ nsGenericHTMLElement::PreHandleEventForAnchors(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::PostHandleEventForAnchors(nsEventChainPostVisitor& aVisitor)
|
||||
nsGenericHTMLElement::PostHandleEventForAnchors(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (!CheckHandleEventForAnchorsPreconditions(aVisitor)) {
|
||||
return NS_OK;
|
||||
@ -2284,7 +2285,7 @@ nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLFormElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
switch (aVisitor.mEvent->message) {
|
||||
@ -2694,7 +2695,7 @@ nsGenericHTMLElement::Click()
|
||||
NS_MOUSE_CLICK, nullptr, WidgetMouseEvent::eReal);
|
||||
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), context, &event);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), context, &event);
|
||||
|
||||
ClearHandlingClick();
|
||||
}
|
||||
@ -2800,7 +2801,8 @@ nsGenericHTMLElement::PerformAccesskey(bool aKeyCausesActivation,
|
||||
nsAutoPopupStatePusher popupStatePusher(aIsTrustedEvent ?
|
||||
openAllowed : openAbused);
|
||||
|
||||
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext, &event);
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
presContext, &event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,9 @@ class nsIDOMHTMLCollection;
|
||||
class nsDOMSettableTokenList;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
class EventChainVisitor;
|
||||
class EventListenerManager;
|
||||
namespace dom {
|
||||
class HTMLFormElement;
|
||||
@ -588,9 +591,10 @@ public:
|
||||
* Check if an event for an anchor can be handled
|
||||
* @return true if the event can be handled, false otherwise
|
||||
*/
|
||||
bool CheckHandleEventForAnchorsPreconditions(nsEventChainVisitor& aVisitor);
|
||||
nsresult PreHandleEventForAnchors(nsEventChainPreVisitor& aVisitor);
|
||||
nsresult PostHandleEventForAnchors(nsEventChainPostVisitor& aVisitor);
|
||||
bool CheckHandleEventForAnchorsPreconditions(
|
||||
mozilla::EventChainVisitor& aVisitor);
|
||||
nsresult PreHandleEventForAnchors(mozilla::EventChainPreVisitor& aVisitor);
|
||||
nsresult PostHandleEventForAnchors(mozilla::EventChainPostVisitor& aVisitor);
|
||||
bool IsHTMLLink(nsIURI** aURI) const;
|
||||
|
||||
// HTML element methods
|
||||
@ -1326,7 +1330,8 @@ public:
|
||||
virtual IMEState GetDesiredIMEState() MOZ_OVERRIDE;
|
||||
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(
|
||||
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsDisabled() const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -20,6 +20,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=622558
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
// Bug 940203
|
||||
if (navigator.platform.startsWith("Win")) {
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
}
|
||||
|
||||
/** Test for Bug 622558 **/
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/ElementBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -897,7 +898,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMathMLElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
nsMathMLElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
nsresult rv = Element::PreHandleEvent(aVisitor);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -906,7 +907,7 @@ nsMathMLElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMathMLElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
nsMathMLElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
return PostHandleEventForLinks(aVisitor);
|
||||
}
|
||||
|
@ -17,6 +17,11 @@ class nsCSSValue;
|
||||
|
||||
typedef nsMappedAttributeElement nsMathMLElementBase;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
} // namespace mozilla
|
||||
|
||||
/*
|
||||
* The base class for MathML elements.
|
||||
*/
|
||||
@ -68,8 +73,10 @@ public:
|
||||
static void MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aRuleData);
|
||||
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PreHandleEvent(
|
||||
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
virtual nsresult PostHandleEvent(
|
||||
mozilla::EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
nsresult Clone(nsINodeInfo*, nsINode**) const MOZ_OVERRIDE;
|
||||
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
||||
|
@ -1521,7 +1521,7 @@ void
|
||||
MediaDecoderStateMachine::DispatchDecodeTasksIfNeeded()
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
|
||||
// NeedToDecodeAudio() can go from false to true while we hold the
|
||||
// monitor, but it can't go from true to false. This can happen because
|
||||
// NeedToDecodeAudio() takes into account the amount of decoded audio
|
||||
@ -2274,9 +2274,16 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
int64_t clockTime = std::max(mEndTime, std::max(videoTime, GetAudioClock()));
|
||||
UpdatePlaybackPosition(clockTime);
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackEnded);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
{
|
||||
// Wait for the state change is completed in the main thread,
|
||||
// otherwise we might see |mDecoder->GetState() == MediaDecoder::PLAY_STATE_PLAYING|
|
||||
// in next loop and send |MediaDecoder::PlaybackEnded| again to trigger 'ended'
|
||||
// event twice in the media element.
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackEnded);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_SYNC);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2756,6 +2763,12 @@ nsresult MediaDecoderStateMachine::ScheduleStateMachine(int64_t aUsecs) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Since there is already a pending task that will run immediately,
|
||||
// we don't need to schedule a timer task.
|
||||
if (mRunAgain) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mTimeout = timeout;
|
||||
|
||||
nsresult res;
|
||||
|
@ -41,6 +41,7 @@ TextTrack::TextTrack(nsISupports* aParent,
|
||||
TextTrackKind aKind,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackSource aTextTrackSource)
|
||||
: mParent(aParent)
|
||||
, mTextTrackSource(aTextTrackSource)
|
||||
@ -49,6 +50,7 @@ TextTrack::TextTrack(nsISupports* aParent,
|
||||
mKind = aKind;
|
||||
mLabel = aLabel;
|
||||
mLanguage = aLanguage;
|
||||
mMode = aMode;
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
@ -57,6 +59,7 @@ TextTrack::TextTrack(nsISupports* aParent,
|
||||
TextTrackKind aKind,
|
||||
const nsAString& aLabel,
|
||||
const nsAString& aLanguage,
|
||||
TextTrackMode aMode,
|
||||
TextTrackSource aTextTrackSource)
|
||||
: mParent(aParent)
|
||||
, mTextTrackList(aTextTrackList)
|
||||
@ -66,6 +69,7 @@ TextTrack::TextTrack(nsISupports* aParent,
|
||||
mKind = aKind;
|
||||
mLabel = aLabel;
|
||||
mLanguage = aLanguage;
|
||||
mMode = aMode;
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user