Merge mozilla-central to UX

This commit is contained in:
Matthew Noorenberghe 2013-08-08 22:56:52 -07:00
commit 3456fdb703
494 changed files with 4962 additions and 4153 deletions

View File

@ -14,7 +14,6 @@
#include "States.h"
#include "nsGUIEvent.h"
#include "nsILink.h"
#include "nsINameSpaceManager.h"
#include "nsIURI.h"

View File

@ -15,7 +15,6 @@
#include "nsGenericHTMLElement.h"
#include "nsIDocument.h"
#include "nsIImageLoadingContent.h"
#include "nsILink.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsIDOMHTMLImageElement.h"

View File

@ -194,6 +194,9 @@ let FormAssistant = {
addMessageListener("Forms:Select:Blur", this);
addMessageListener("Forms:SetSelectionRange", this);
addMessageListener("Forms:ReplaceSurroundingText", this);
addMessageListener("Forms:GetText", this);
addMessageListener("Forms:Input:SendKey", this);
addMessageListener("Forms:GetContext", this);
},
ignoredInputTypes: new Set([
@ -203,8 +206,11 @@ let FormAssistant = {
isKeyboardOpened: false,
selectionStart: -1,
selectionEnd: -1,
textBeforeCursor: "",
textAfterCursor: "",
scrollIntoViewTimeout: null,
_focusedElement: null,
_focusCounter: 0, // up one for every time we focus a new element
_documentEncoder: null,
_editor: null,
_editing: false,
@ -218,6 +224,7 @@ let FormAssistant = {
},
set focusedElement(val) {
this._focusCounter++;
this._focusedElement = val;
},
@ -390,12 +397,34 @@ let FormAssistant = {
receiveMessage: function fa_receiveMessage(msg) {
let target = this.focusedElement;
let json = msg.json;
// To not break mozKeyboard contextId is optional
if ('contextId' in json &&
json.contextId !== this._focusCounter &&
json.requestId) {
// Ignore messages that are meant for a previously focused element
sendAsyncMessage("Forms:SequenceError", {
requestId: json.requestId,
error: "Expected contextId " + this._focusCounter +
" but was " + json.contextId
});
return;
}
if (!target) {
switch (msg.name) {
case "Forms:GetText":
sendAsyncMessage("Forms:GetText:Result:Error", {
requestId: json.requestId,
error: "No focused element"
});
break;
}
return;
}
this._editing = true;
let json = msg.json;
switch (msg.name) {
case "Forms:Input:Value": {
target.value = json.value;
@ -406,6 +435,19 @@ let FormAssistant = {
break;
}
case "Forms:Input:SendKey":
["keydown", "keypress", "keyup"].forEach(function(type) {
domWindowUtils.sendKeyEvent(type, json.keyCode, json.charCode,
json.modifiers);
});
if (json.requestId) {
sendAsyncMessage("Forms:SendKey:Result:OK", {
requestId: json.requestId
});
}
break;
case "Forms:Select:Choice":
let options = target.options;
let valueChanged = false;
@ -442,6 +484,13 @@ let FormAssistant = {
let end = json.selectionEnd;
setSelectionRange(target, start, end);
this.updateSelection();
if (json.requestId) {
sendAsyncMessage("Forms:SetSelectionRange:Result:OK", {
requestId: json.requestId,
selectioninfo: this.getSelectionInfo()
});
}
break;
}
@ -449,8 +498,44 @@ let FormAssistant = {
let text = json.text;
let beforeLength = json.beforeLength;
let afterLength = json.afterLength;
replaceSurroundingText(target, text, this.selectionStart, beforeLength,
let selectionRange = getSelectionRange(target);
replaceSurroundingText(target, text, selectionRange[0], beforeLength,
afterLength);
if (json.requestId) {
sendAsyncMessage("Forms:ReplaceSurroundingText:Result:OK", {
requestId: json.requestId,
selectioninfo: this.getSelectionInfo()
});
}
break;
}
case "Forms:GetText": {
let isPlainTextField = target instanceof HTMLInputElement ||
target instanceof HTMLTextAreaElement;
let value = isPlainTextField ?
target.value :
getContentEditableText(target);
if (json.offset && json.length) {
value = value.substr(json.offset, json.length);
}
else if (json.offset) {
value = value.substr(json.offset);
}
sendAsyncMessage("Forms:GetText:Result:OK", {
requestId: json.requestId,
text: value
});
break;
}
case "Forms:GetContext": {
let obj = getJSON(target, this._focusCounter);
sendAsyncMessage("Forms:GetContext:Result:OK", obj);
break;
}
}
@ -529,20 +614,47 @@ let FormAssistant = {
return false;
}
sendAsyncMessage("Forms:Input", getJSON(element));
sendAsyncMessage("Forms:Input", getJSON(element, this._focusCounter));
return true;
},
getSelectionInfo: function fa_getSelectionInfo() {
let element = this.focusedElement;
let range = getSelectionRange(element);
let isPlainTextField = element instanceof HTMLInputElement ||
element instanceof HTMLTextAreaElement;
let text = isPlainTextField ?
element.value :
getContentEditableText(element);
let textAround = getTextAroundCursor(text, range);
let changed = this.selectionStart !== range[0] ||
this.selectionEnd !== range[1] ||
this.textBeforeCursor !== textAround.before ||
this.textAfterCursor !== textAround.after;
this.selectionStart = range[0];
this.selectionEnd = range[1];
this.textBeforeCursor = textAround.before;
this.textAfterCursor = textAround.after;
return {
selectionStart: range[0],
selectionEnd: range[1],
textBeforeCursor: textAround.before,
textAfterCursor: textAround.after,
changed: changed
};
},
// Notify when the selection range changes
updateSelection: function fa_updateSelection() {
let range = getSelectionRange(this.focusedElement);
if (range[0] != this.selectionStart || range[1] != this.selectionEnd) {
this.selectionStart = range[0];
this.selectionEnd = range[1];
sendAsyncMessage("Forms:SelectionChange", {
selectionStart: range[0],
selectionEnd: range[1]
});
let selectionInfo = this.getSelectionInfo();
if (selectionInfo.changed) {
sendAsyncMessage("Forms:SelectionChange", this.getSelectionInfo());
}
}
};
@ -568,7 +680,7 @@ function isContentEditable(element) {
return element.ownerDocument && element.ownerDocument.designMode == "on";
}
function getJSON(element) {
function getJSON(element, focusCounter) {
let type = element.type || "";
let value = element.value || "";
let max = element.max || "";
@ -609,8 +721,11 @@ function getJSON(element) {
}
let range = getSelectionRange(element);
let textAround = getTextAroundCursor(value, range);
return {
"contextId": focusCounter,
"type": type.toLowerCase(),
"choices": getListForElement(element),
"value": value,
@ -618,7 +733,25 @@ function getJSON(element) {
"selectionStart": range[0],
"selectionEnd": range[1],
"max": max,
"min": min
"min": min,
"lang": element.lang || "",
"textBeforeCursor": textAround.before,
"textAfterCursor": textAround.after
};
}
function getTextAroundCursor(value, range) {
let textBeforeCursor = range[0] < 100 ?
value.substr(0, range[0]) :
value.substr(range[0] - 100, 100);
let textAfterCursor = range[1] + 100 > value.length ?
value.substr(range[0], value.length) :
value.substr(range[0], range[1] - range[0] + 100);
return {
before: textBeforeCursor,
after: textAfterCursor
};
}

View File

@ -20,8 +20,8 @@ component {397a7fdf-2254-47be-b74e-76625a1a66d5} MozKeyboard.js
contract @mozilla.org/b2g-keyboard;1 {397a7fdf-2254-47be-b74e-76625a1a66d5}
category JavaScript-navigator-property mozKeyboard @mozilla.org/b2g-keyboard;1
component {5c7f4ce1-a946-4adc-89e6-c908226341a0} MozKeyboard.js
contract @mozilla.org/b2g-inputmethod;1 {5c7f4ce1-a946-4adc-89e6-c908226341a0}
component {4607330d-e7d2-40a4-9eb8-43967eae0142} MozKeyboard.js
contract @mozilla.org/b2g-inputmethod;1 {4607330d-e7d2-40a4-9eb8-43967eae0142}
category JavaScript-navigator-property mozInputMethod @mozilla.org/b2g-inputmethod;1
# DirectoryProvider.js

View File

@ -22,7 +22,8 @@ let Keyboard = {
_messageNames: [
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions',
'SetSelectionRange', 'ReplaceSurroundingText', 'ShowInputMethodPicker',
'SwitchToNextInputMethod', 'HideInputMethod'
'SwitchToNextInputMethod', 'HideInputMethod',
'GetText', 'SendKey', 'GetContext'
],
get messageManager() {
@ -58,6 +59,13 @@ let Keyboard = {
} else {
mm.addMessageListener('Forms:Input', this);
mm.addMessageListener('Forms:SelectionChange', this);
mm.addMessageListener('Forms:GetText:Result:OK', this);
mm.addMessageListener('Forms:GetText:Result:Error', this);
mm.addMessageListener('Forms:SetSelectionRange:Result:OK', this);
mm.addMessageListener('Forms:ReplaceSurroundingText:Result:OK', this);
mm.addMessageListener('Forms:SendKey:Result:OK', this);
mm.addMessageListener('Forms:SequenceError', this);
mm.addMessageListener('Forms:GetContext:Result:OK', this);
// When not running apps OOP, we need to load forms.js here since this
// won't happen from dom/ipc/preload.js
@ -98,11 +106,20 @@ let Keyboard = {
switch (msg.name) {
case 'Forms:Input':
this.handleFormsInput(msg);
this.forwardEvent('Keyboard:FocusChange', msg);
break;
case 'Forms:SelectionChange':
this.handleFormsSelectionChange(msg);
case 'Forms:GetText:Result:OK':
case 'Forms:GetText:Result:Error':
case 'Forms:SetSelectionRange:Result:OK':
case 'Forms:ReplaceSurroundingText:Result:OK':
case 'Forms:SendKey:Result:OK':
case 'Forms:SequenceError':
case 'Forms:GetContext:Result:OK':
let name = msg.name.replace(/^Forms/, 'Keyboard');
this.forwardEvent(name, msg);
break;
case 'Keyboard:SetValue':
this.setValue(msg);
break;
@ -127,21 +144,23 @@ let Keyboard = {
case 'Keyboard:ShowInputMethodPicker':
this.showInputMethodPicker();
break;
case 'Keyboard:GetText':
this.getText(msg);
break;
case 'Keyboard:SendKey':
this.sendKey(msg);
break;
case 'Keyboard:GetContext':
this.getContext(msg);
break;
}
},
handleFormsInput: function keyboardHandleFormsInput(msg) {
forwardEvent: function keyboardForwardEvent(newEventName, msg) {
this.messageManager = msg.target.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader.messageManager;
ppmm.broadcastAsyncMessage('Keyboard:FocusChange', msg.data);
},
handleFormsSelectionChange: function keyboardHandleFormsSelectionChange(msg) {
this.messageManager = msg.target.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader.messageManager;
ppmm.broadcastAsyncMessage('Keyboard:SelectionChange', msg.data);
ppmm.broadcastAsyncMessage(newEventName, msg.data);
},
setSelectedOption: function keyboardSetSelectedOption(msg) {
@ -181,6 +200,18 @@ let Keyboard = {
browser.shell.sendChromeEvent({
type: "input-method-switch-to-next"
});
},
getText: function keyboardGetText(msg) {
this.messageManager.sendAsyncMessage('Forms:GetText', msg.data);
},
sendKey: function keyboardSendKey(msg) {
this.messageManager.sendAsyncMessage('Forms:Input:SendKey', msg.data);
},
getContext: function keyboardGetContext(msg) {
this.messageManager.sendAsyncMessage('Forms:GetContext', msg.data);
}
};

View File

@ -10,6 +10,7 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1", "nsIMessageSender");
@ -244,15 +245,18 @@ MozInputMethodManager.prototype = {
function MozInputMethod() { }
MozInputMethod.prototype = {
classID: Components.ID("{5c7f4ce1-a946-4adc-89e6-c908226341a0}"),
_inputcontext: null,
classID: Components.ID("{4607330d-e7d2-40a4-9eb8-43967eae0142}"),
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIInputMethod,
Ci.nsIDOMGlobalPropertyInitializer
Ci.nsIDOMGlobalPropertyInitializer,
Ci.nsIObserver
]),
classInfo: XPCOMUtils.generateCI({
"classID": Components.ID("{5c7f4ce1-a946-4adc-89e6-c908226341a0}"),
"classID": Components.ID("{4607330d-e7d2-40a4-9eb8-43967eae0142}"),
"contractID": "@mozilla.org/b2g-inputmethod;1",
"interfaces": [Ci.nsIInputMethod],
"flags": Ci.nsIClassInfo.DOM_OBJECT,
@ -269,11 +273,374 @@ MozInputMethod.prototype = {
return null;
}
this._window = win;
this._mgmt = new MozInputMethodManager();
this.innerWindowID = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.currentInnerWindowID;
Services.obs.addObserver(this, "inner-window-destroyed", false);
cpmm.addMessageListener('Keyboard:FocusChange', this);
cpmm.addMessageListener('Keyboard:SelectionChange', this);
cpmm.addMessageListener('Keyboard:GetContext:Result:OK', this);
// If there already is an active context, then this will trigger
// a GetContext:Result:OK event, and we can initialize ourselves.
// Otherwise silently ignored.
cpmm.sendAsyncMessage("Keyboard:GetContext", {});
},
uninit: function mozInputMethodUninit() {
Services.obs.removeObserver(this, "inner-window-destroyed");
cpmm.removeMessageListener('Keyboard:FocusChange', this);
cpmm.removeMessageListener('Keyboard:SelectionChange', this);
cpmm.removeMessageListener('Keyboard:GetContext:Result:OK', this);
this._window = null;
this._inputcontextHandler = null;
this._mgmt = null;
},
receiveMessage: function mozInputMethodReceiveMsg(msg) {
let json = msg.json;
switch(msg.name) {
case 'Keyboard:FocusChange':
if (json.type !== 'blur') {
this.setInputContext(json);
}
else {
this.setInputContext(null);
}
break;
case 'Keyboard:SelectionChange':
this._inputcontext.updateSelectionContext(json);
break;
case 'Keyboard:GetContext:Result:OK':
this.setInputContext(json);
break;
}
},
observe: function mozInputMethodObserve(subject, topic, data) {
let wId = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
if (wId == this.innerWindowID)
this.uninit();
},
get mgmt() {
return this._mgmt;
},
get inputcontext() {
return this._inputcontext;
},
set oninputcontextchange(val) {
this._inputcontextHandler = val;
},
get oninputcontextchange() {
return this._inputcontextHandler;
},
setInputContext: function mozKeyboardContextChange(data) {
if (this._inputcontext) {
this._inputcontext.destroy();
this._inputcontext = null;
}
if (data) {
this._inputcontext = new MozInputContext(data);
this._inputcontext.init(this._window);
}
let handler = this._inputcontextHandler;
if (!handler || !(handler instanceof Ci.nsIDOMEventListener))
return;
let evt = new this._window.CustomEvent("inputcontextchange",
ObjectWrapper.wrap({}, this._window));
handler.handleEvent(evt);
}
};
/**
* ==============================================
* InputContext
* ==============================================
*/
function MozInputContext(ctx) {
this._context = {
inputtype: ctx.type,
inputmode: ctx.inputmode,
lang: ctx.lang,
type: ["textarea", "contenteditable"].indexOf(ctx.type) > -1 ?
ctx.type :
"text",
selectionStart: ctx.selectionStart,
selectionEnd: ctx.selectionEnd,
textBeforeCursor: ctx.textBeforeCursor,
textAfterCursor: ctx.textAfterCursor
};
this._contextId = ctx.contextId;
}
MozInputContext.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
_context: null,
_contextId: -1,
classID: Components.ID("{1e38633d-d08b-4867-9944-afa5c648adb6}"),
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIB2GInputContext,
Ci.nsIObserver
]),
classInfo: XPCOMUtils.generateCI({
"classID": Components.ID("{1e38633d-d08b-4867-9944-afa5c648adb6}"),
"contractID": "@mozilla.org/b2g-inputcontext;1",
"interfaces": [Ci.nsIB2GInputContext],
"flags": Ci.nsIClassInfo.DOM_OBJECT,
"classDescription": "B2G Input Context"
}),
init: function ic_init(win) {
this._window = win;
this._utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
this.initDOMRequestHelper(win,
["Keyboard:GetText:Result:OK",
"Keyboard:GetText:Result:Error",
"Keyboard:SetSelectionRange:Result:OK",
"Keyboard:ReplaceSurroundingText:Result:OK",
"Keyboard:SendKey:Result:OK",
"Keyboard:SequenceError"]);
},
destroy: function ic_destroy() {
let self = this;
// All requests that are still pending need to be invalidated
// because the context is no longer valid.
Object.keys(self._requests).forEach(function(k) {
// takeRequest also does a delete from context
let req = self.takeRequest(k);
Services.DOMRequest.fireError(req, "InputContext got destroyed");
});
this.destroyDOMRequestHelper();
// A consuming application might still hold a cached version of this
// object. After destroying the DOMRequestHelper all methods will throw
// because we cannot create new requests anymore, but we still hold
// (outdated) information in the context. So let's clear that out.
for (var k in this._context)
if (this._context.hasOwnProperty(k))
this._context[k] = null;
},
receiveMessage: function ic_receiveMessage(msg) {
if (!msg || !msg.json) {
dump('InputContext received message without data\n');
return;
}
let json = msg.json;
let request = json.requestId ? this.takeRequest(json.requestId) : null;
if (!request) {
return;
}
switch (msg.name) {
case "Keyboard:SendKey:Result:OK":
Services.DOMRequest.fireSuccess(request, null);
break;
case "Keyboard:GetText:Result:OK":
Services.DOMRequest.fireSuccess(request, json.text);
break;
case "Keyboard:GetText:Result:Error":
Services.DOMRequest.fireError(request, json.error);
break;
case "Keyboard:SetSelectionRange:Result:OK":
case "Keyboard:ReplaceSurroundingText:Result:OK":
Services.DOMRequest.fireSuccess(request,
ObjectWrapper.wrap(json.selectioninfo, this._window));
break;
case "Keyboard:SequenceError":
// Occurs when a new element got focus, but the inputContext was
// not invalidated yet...
Services.DOMRequest.fireError(request, "InputContext has expired");
break;
default:
Services.DOMRequest.fireError(request, "Could not find a handler for " +
msg.name);
break;
}
},
updateSelectionContext: function ic_updateSelectionContext(ctx) {
if (!this._context) {
return;
}
let selectionDirty = this._context.selectionStart !== ctx.selectionStart ||
this._context.selectionEnd !== ctx.selectionEnd;
let surroundDirty = this._context.textBeforeCursor !== ctx.textBeforeCursor ||
this._context.textAfterCursor !== ctx.textAfterCursor;
this._context.selectionStart = ctx.selectionStart;
this._context.selectionEnd = ctx.selectionEnd;
this._context.textBeforeCursor = ctx.textBeforeCursor;
this._context.textAfterCursor = ctx.textAfterCursor;
if (selectionDirty) {
this._fireEvent(this._onselectionchange, "selectionchange", {
selectionStart: ctx.selectionStart,
selectionEnd: ctx.selectionEnd
});
}
if (surroundDirty) {
this._fireEvent(this._onsurroundingtextchange, "surroundingtextchange", {
beforeString: ctx.textBeforeCursor,
afterString: ctx.textAfterCursor
});
}
},
_fireEvent: function ic_fireEvent(handler, eventName, aDetail) {
if (!handler || !(handler instanceof Ci.nsIDOMEventListener))
return;
let detail = {
detail: aDetail
};
let evt = new this._window.CustomEvent(eventName,
ObjectWrapper.wrap(aDetail, this._window));
handler.handleEvent(evt);
},
// tag name of the input field
get type() {
return this._context.type;
},
// type of the input field
get inputType() {
return this._context.inputtype;
},
get inputMode() {
return this._context.inputmode;
},
get lang() {
return this._context.lang;
},
getText: function ic_getText(offset, length) {
let request = this.createRequest();
cpmm.sendAsyncMessage('Keyboard:GetText', {
contextId: this._contextId,
requestId: this.getRequestId(request),
offset: offset,
length: length
});
return request;
},
get selectionStart() {
return this._context.selectionStart;
},
get selectionEnd() {
return this._context.selectionEnd;
},
get textBeforeCursor() {
return this._context.textBeforeCursor;
},
get textAfterCursor() {
return this._context.textAfterCursor;
},
setSelectionRange: function ic_setSelectionRange(start, length) {
let request = this.createRequest();
cpmm.sendAsyncMessage("Keyboard:SetSelectionRange", {
contextId: this._contextId,
requestId: this.getRequestId(request),
selectionStart: start,
selectionEnd: start + length
});
return request;
},
get onsurroundingtextchange() {
return this._onsurroundingtextchange;
},
set onsurroundingtextchange(handler) {
this._onsurroundingtextchange = handler;
},
get onselectionchange() {
return this._onselectionchange;
},
set onselectionchange(handler) {
this._onselectionchange = handler;
},
replaceSurroundingText: function ic_replaceSurrText(text, offset, length) {
let request = this.createRequest();
cpmm.sendAsyncMessage('Keyboard:ReplaceSurroundingText', {
contextId: this._contextId,
requestId: this.getRequestId(request),
text: text,
beforeLength: offset || 0,
afterLength: length || 0
});
return request;
},
deleteSurroundingText: function ic_deleteSurrText(offset, length) {
return this.replaceSurroundingText(null, offset, length);
},
sendKey: function ic_sendKey(keyCode, charCode, modifiers) {
let request = this.createRequest();
cpmm.sendAsyncMessage('Keyboard:SendKey', {
contextId: this._contextId,
requestId: this.getRequestId(request),
keyCode: keyCode,
charCode: charCode,
modifiers: modifiers
});
return request;
},
setComposition: function ic_setComposition(text, cursor) {
throw "Not implemented";
},
endComposition: function ic_endComposition(text) {
throw "Not implemented";
}
};

View File

@ -4,6 +4,8 @@
#include "domstubs.idl"
interface nsIDOMDOMRequest;
[scriptable, uuid(3615a616-571d-4194-bf54-ccf546067b14)]
interface nsIB2GCameraContent : nsISupports
{
@ -11,6 +13,119 @@ interface nsIB2GCameraContent : nsISupports
DOMString getCameraURI([optional] in jsval options);
};
[scriptable, uuid(1e38633d-d08b-4867-9944-afa5c648adb6)]
interface nsIB2GInputContext : nsISupports
{
// The tag name of input field, which is enum of "input", "textarea", or "contenteditable"
readonly attribute DOMString type;
// The type of the input field, which is enum of text, number, password, url, search, email, and so on.
// See http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#states-of-the-type-attribute
readonly attribute DOMString inputType;
/*
* The inputmode string, representing the input mode.
* See http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#input-modalities:-the-inputmode-attribute
*/
readonly attribute DOMString inputMode;
/*
* The primary language for the input field.
* It is the value of HTMLElement.lang.
* See http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#htmlelement
*/
readonly attribute DOMString lang;
/*
* Get the whole text content of the input field.
*/
nsIDOMDOMRequest getText([optional] in long offset, [optional] in long length);
// The start and stop position of the selection.
readonly attribute long selectionStart;
readonly attribute long selectionEnd;
// The start and stop position of the selection.
readonly attribute DOMString textBeforeCursor;
readonly attribute DOMString textAfterCursor;
/*
* Set the selection range of the the editable text.
* Note: This method cannot be used to move the cursor during composition. Calling this
* method will cancel composition.
* @param start The beginning of the selected text.
* @param length The length of the selected text.
*
* Note that the start position should be less or equal to the end position.
* To move the cursor, set the start and end position to the same value.
*/
nsIDOMDOMRequest setSelectionRange(in long start, in long length);
/*
* Commit text to current input field and replace text around cursor position. It will clear the current composition.
*
* @param text The string to be replaced with.
* @param offset The offset from the cursor position where replacing starts. Defaults to 0.
* @param length The length of text to replace. Defaults to 0.
*/
nsIDOMDOMRequest replaceSurroundingText(in DOMString text, [optional] in long offset, [optional] in long length);
/*
*
* Delete text around the cursor.
* @param offset The offset from the cursor position where deletion starts.
* @param length The length of text to delete.
* TODO: maybe updateSurroundingText(DOMString beforeText, DOMString afterText); ?
*/
nsIDOMDOMRequest deleteSurroundingText(in long offset, in long length);
/*
* Notifies when the text around the cursor is changed, due to either text
* editing or cursor movement. If the cursor has been moved, but the text around has not
* changed, the IME won't get notification.
*
* The event handler function is specified as:
* @param beforeString Text before and including cursor position.
* @param afterString Text after and excluing cursor position.
* function(DOMString beforeText, DOMString afterText) {
* ...
* }
*/
attribute nsIDOMEventListener onsurroundingtextchange;
attribute nsIDOMEventListener onselectionchange;
/*
* send a character with its key events.
* @param modifiers see http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsIDOMWindowUtils.idl#206
* @return true if succeeds. Otherwise false if the input context becomes void.
* Alternative: sendKey(KeyboardEvent event), but we will likely waste memory for creating the KeyboardEvent object.
*/
nsIDOMDOMRequest sendKey(in long keyCode, in long charCode, in long modifiers);
/*
* Set current composition. It will start or update composition.
* @param cursor Position in the text of the cursor.
*
* The API implementation should automatically ends the composition
* session (with event and confirm the current composition) if
* endComposition is never called. Same apply when the inputContext is lost
* during a unfinished composition session.
*/
nsIDOMDOMRequest setComposition(in DOMString text, in long cursor);
/*
* End composition and actually commit the text. (was |commitText(text, offset, length)|)
* Ending the composition with an empty string will not send any text.
* Note that if composition always ends automatically (with the current composition committed) if the composition
* did not explicitly with |endComposition()| but was interrupted with |sendKey()|, |setSelectionRange()|,
* user moving the cursor, or remove the focus, etc.
*
* @param text The text
*/
nsIDOMDOMRequest endComposition(in DOMString text);
};
[scriptable, uuid(40ad96b2-9efa-41fb-84c7-fbcec9b153f0)]
interface nsIB2GKeyboard : nsISupports
{
@ -103,9 +218,19 @@ interface nsIInputMethodManager : nsISupports
void hide();
};
[scriptable, uuid(5c7f4ce1-a946-4adc-89e6-c908226341a0)]
[scriptable, uuid(4607330d-e7d2-40a4-9eb8-43967eae0142)]
interface nsIInputMethod : nsISupports
{
// Input Method Manager contain a few global methods expose to apps
readonly attribute nsIInputMethodManager mgmt;
// Fired when the input context changes, include changes from and to null.
// The new InputContext instance will be available in the event object under |inputcontext| property.
// When it changes to null it means the app (the user of this API) no longer has the control of the original focused input field.
// Note that if the app saves the original context, it might get void; implementation decides when to void the input context.
readonly attribute nsIB2GInputContext inputcontext;
// An "input context" is mapped to a text field that the app is allow to mutate.
// this attribute should be null when there is no text field currently focused.
attribute nsIDOMEventListener oninputcontextchange;
};

View File

@ -1,4 +1,4 @@
{
"revision": "acd53f668718d06090805303ed85e36dddf61853",
"revision": "fd03fbd18a09517bc5eb4e2af62314421ae7124a",
"repo_path": "/integration/gaia-central"
}

View File

@ -9,7 +9,7 @@ searchbar {
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar");
}
browser[remote="true"] {
.browserStack > browser[remote="true"] {
-moz-binding: url("chrome://global/content/bindings/remote-browser.xml#remote-browser");
}

View File

@ -2643,6 +2643,7 @@
} catch (e) {
let url = this.mCurrentBrowser.currentURI.spec;
this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(url));
throw e;
}
#endif
]]>
@ -2667,6 +2668,7 @@
} catch (e) {
let url = this.mCurrentBrowser.currentURI.spec;
this._updateBrowserRemoteness(this.mCurrentBrowser, this._shouldBrowserBeRemote(url));
throw e;
}
#endif
]]>
@ -2924,12 +2926,6 @@
<![CDATA[
let browserStack = document.getAnonymousElementByAttribute(this, "anonid", "browserStack");
this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
if (Services.prefs.getBoolPref("browser.tabs.remote")) {
browserStack.removeChild(this.mCurrentBrowser);
this.mCurrentBrowser.setAttribute("remote", true);
browserStack.appendChild(this.mCurrentBrowser);
this.tabContainer.firstChild.setAttribute("remote", "true");
}
this.mCurrentTab = this.tabContainer.firstChild;
document.addEventListener("keypress", this, false);

View File

@ -19,8 +19,7 @@ from mozbuild.backend.configenvironment import ConfigEnvironment
from mozbuild.backend.recursivemake import RecursiveMakeBackend
from mozbuild.frontend.emitter import TreeMetadataEmitter
from mozbuild.frontend.reader import BuildReader
from Preprocessor import Preprocessor
from mozbuild.mozinfo import write_mozinfo
log_manager = LoggingManager()
@ -87,6 +86,11 @@ def config_status(topobjdir = '.', topsrcdir = '.',
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs)
# mozinfo.json only needs written if configure changes and configure always
# passes this environment variable.
if 'WRITE_MOZINFO' in os.environ:
write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
backend = RecursiveMakeBackend(env)

View File

@ -518,9 +518,18 @@ class Automation(object):
# Only 2 GB RAM or less available? Use custom ASan options to reduce
# the amount of resources required to do the tests. Standard options
# will otherwise lead to OOM conditions on the current test slaves.
#
# If we have more than 2 GB or RAM but still less than 4 GB, we need
# another set of options to prevent OOM in some memory-intensive
# tests.
if totalMemory <= 1024 * 1024 * 2:
self.log.info("INFO | automation.py | ASan running in low-memory configuration")
env["ASAN_OPTIONS"] = "quarantine_size=50331648:redzone=64"
elif totalMemory <= 1024 * 1024 * 4:
self.log.info("INFO | automation.py | ASan running in mid-memory configuration")
env["ASAN_OPTIONS"] = "quarantine_size=100663296:redzone=64"
else:
self.log.info("INFO | automation.py | ASan running in default memory configuration")
except OSError,err:
self.log.info("Failed determine available memory, disabling ASan low-memory configuration: %s", err.strerror)
except:

View File

@ -442,8 +442,6 @@ nsPrincipal::GetExtendedOrigin(nsACString& aExtendedOrigin)
NS_IMETHODIMP
nsPrincipal::GetAppStatus(uint16_t* aAppStatus)
{
MOZ_ASSERT(mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
*aAppStatus = GetAppStatus();
return NS_OK;
}
@ -569,8 +567,8 @@ nsPrincipal::Write(nsIObjectOutputStream* aStream)
uint16_t
nsPrincipal::GetAppStatus()
{
MOZ_ASSERT(mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
NS_WARN_IF_FALSE(mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
"Asking for app status on a principal with an unknown app id");
// Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
// and they are not inside a mozbrowser.
if (mAppId == nsIScriptSecurityManager::NO_APP_ID ||

View File

@ -432,17 +432,17 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
NS_ASSERTION(ssm, "Failed to get security manager service");
if (!ssm)
return JS_FALSE;
return false;
nsresult rv;
nsIPrincipal* subjectPrincipal = ssm->GetSubjectPrincipal(cx, &rv);
NS_ASSERTION(NS_SUCCEEDED(rv), "CSP: Failed to get nsIPrincipal from js context");
if (NS_FAILED(rv))
return JS_FALSE; // Not just absence of principal, but failure.
return false; // Not just absence of principal, but failure.
if (!subjectPrincipal)
return JS_TRUE;
return true;
nsCOMPtr<nsIContentSecurityPolicy> csp;
rv = subjectPrincipal->GetCsp(getter_AddRefs(csp));
@ -450,7 +450,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
// don't do anything unless there's a CSP
if (!csp)
return JS_TRUE;
return true;
bool evalOK = true;
bool reportViolation = false;
@ -459,7 +459,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
if (NS_FAILED(rv))
{
NS_WARNING("CSP: failed to get allowsEval");
return JS_TRUE; // fail open to not break sites.
return true; // fail open to not break sites.
}
if (reportViolation) {
@ -494,7 +494,7 @@ nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*>
NS_WARN_IF_FALSE(ssm, "Failed to get security manager service");
if (!ssm)
return JS_FALSE;
return false;
// Get the object being accessed. We protect these cases:
// 1. The Function.prototype.caller property's value, which might lead
@ -515,9 +515,9 @@ nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*>
(int32_t)nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
if (NS_FAILED(rv))
return JS_FALSE; // Security check failed (XXX was an error reported?)
return false; // Security check failed (XXX was an error reported?)
return JS_TRUE;
return true;
}
NS_IMETHODIMP

View File

@ -1,204 +0,0 @@
#!/usr/bin/env python
import unittest
import json, os, sys, time, tempfile
from StringIO import StringIO
import mozunit
from writemozinfo import build_dict, write_json
class TestBuildDict(unittest.TestCase):
def testMissing(self):
"""
Test that missing required values raises.
"""
self.assertRaises(Exception, build_dict, {'OS_TARGET':'foo'})
self.assertRaises(Exception, build_dict, {'TARGET_CPU':'foo'})
self.assertRaises(Exception, build_dict, {'MOZ_WIDGET_TOOLKIT':'foo'})
def testWin(self):
d = build_dict({'OS_TARGET':'WINNT',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'windows'})
self.assertEqual('win', d['os'])
self.assertEqual('x86', d['processor'])
self.assertEqual('windows', d['toolkit'])
self.assertEqual(32, d['bits'])
def testLinux(self):
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'gtk2'})
self.assertEqual('linux', d['os'])
self.assertEqual('x86', d['processor'])
self.assertEqual('gtk2', d['toolkit'])
self.assertEqual(32, d['bits'])
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'x86_64',
'MOZ_WIDGET_TOOLKIT':'gtk2'})
self.assertEqual('linux', d['os'])
self.assertEqual('x86_64', d['processor'])
self.assertEqual('gtk2', d['toolkit'])
self.assertEqual(64, d['bits'])
def testMac(self):
d = build_dict({'OS_TARGET':'Darwin',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'cocoa'})
self.assertEqual('mac', d['os'])
self.assertEqual('x86', d['processor'])
self.assertEqual('cocoa', d['toolkit'])
self.assertEqual(32, d['bits'])
d = build_dict({'OS_TARGET':'Darwin',
'TARGET_CPU':'x86_64',
'MOZ_WIDGET_TOOLKIT':'cocoa'})
self.assertEqual('mac', d['os'])
self.assertEqual('x86_64', d['processor'])
self.assertEqual('cocoa', d['toolkit'])
self.assertEqual(64, d['bits'])
def testMacUniversal(self):
d = build_dict({'OS_TARGET':'Darwin',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'cocoa',
'UNIVERSAL_BINARY': '1'})
self.assertEqual('mac', d['os'])
self.assertEqual('universal-x86-x86_64', d['processor'])
self.assertEqual('cocoa', d['toolkit'])
self.assertFalse('bits' in d)
d = build_dict({'OS_TARGET':'Darwin',
'TARGET_CPU':'x86_64',
'MOZ_WIDGET_TOOLKIT':'cocoa',
'UNIVERSAL_BINARY': '1'})
self.assertEqual('mac', d['os'])
self.assertEqual('universal-x86-x86_64', d['processor'])
self.assertEqual('cocoa', d['toolkit'])
self.assertFalse('bits' in d)
def testAndroid(self):
d = build_dict({'OS_TARGET':'Android',
'TARGET_CPU':'arm',
'MOZ_WIDGET_TOOLKIT':'android'})
self.assertEqual('android', d['os'])
self.assertEqual('arm', d['processor'])
self.assertEqual('android', d['toolkit'])
self.assertEqual(32, d['bits'])
def testX86(self):
"""
Test that various i?86 values => x86.
"""
d = build_dict({'OS_TARGET':'WINNT',
'TARGET_CPU':'i486',
'MOZ_WIDGET_TOOLKIT':'windows'})
self.assertEqual('x86', d['processor'])
d = build_dict({'OS_TARGET':'WINNT',
'TARGET_CPU':'i686',
'MOZ_WIDGET_TOOLKIT':'windows'})
self.assertEqual('x86', d['processor'])
def testARM(self):
"""
Test that all arm CPU architectures => arm.
"""
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'arm',
'MOZ_WIDGET_TOOLKIT':'gtk2'})
self.assertEqual('arm', d['processor'])
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'armv7',
'MOZ_WIDGET_TOOLKIT':'gtk2'})
self.assertEqual('arm', d['processor'])
def testUnknown(self):
"""
Test that unknown values pass through okay.
"""
d = build_dict({'OS_TARGET':'RandOS',
'TARGET_CPU':'cptwo',
'MOZ_WIDGET_TOOLKIT':'foobar'})
self.assertEqual("randos", d["os"])
self.assertEqual("cptwo", d["processor"])
self.assertEqual("foobar", d["toolkit"])
# unknown CPUs should not get a bits value
self.assertFalse("bits" in d)
def testDebug(self):
"""
Test that debug values are properly detected.
"""
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'gtk2'})
self.assertEqual(False, d['debug'])
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'gtk2',
'MOZ_DEBUG':'1'})
self.assertEqual(True, d['debug'])
def testCrashreporter(self):
"""
Test that crashreporter values are properly detected.
"""
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'gtk2'})
self.assertEqual(False, d['crashreporter'])
d = build_dict({'OS_TARGET':'Linux',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'gtk2',
'MOZ_CRASHREPORTER':'1'})
self.assertEqual(True, d['crashreporter'])
class TestWriteJson(unittest.TestCase):
"""
Test the write_json function.
"""
def setUp(self):
fd, self.f = tempfile.mkstemp()
os.close(fd)
def tearDown(self):
os.unlink(self.f)
def testBasic(self):
"""
Test that writing to a file produces correct output.
"""
write_json(self.f, env={'OS_TARGET':'WINNT',
'TARGET_CPU':'i386',
'TOPSRCDIR':'/tmp',
'MOZCONFIG':'foo',
'MOZ_WIDGET_TOOLKIT':'windows'})
with open(self.f) as f:
d = json.load(f)
self.assertEqual('win', d['os'])
self.assertEqual('x86', d['processor'])
self.assertEqual('windows', d['toolkit'])
self.assertEqual('/tmp', d['topsrcdir'])
self.assertEqual(os.path.normpath('/tmp/foo'), d['mozconfig'])
self.assertEqual(32, d['bits'])
def testFileObj(self):
"""
Test that writing to a file-like object produces correct output.
"""
s = StringIO()
write_json(s, env={'OS_TARGET':'WINNT',
'TARGET_CPU':'i386',
'MOZ_WIDGET_TOOLKIT':'windows'})
d = json.loads(s.getvalue())
self.assertEqual('win', d['os'])
self.assertEqual('x86', d['processor'])
self.assertEqual('windows', d['toolkit'])
self.assertEqual(32, d['bits'])
if __name__ == '__main__':
mozunit.main()

View File

@ -9054,7 +9054,9 @@ xpcom/xpcom-private.h
AC_SUBST(STLPORT_LIBS)
export WRITE_MOZINFO=1
AC_OUTPUT([mozilla-config.h])
unset WRITE_MOZINFO
# Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
# "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
@ -9201,24 +9203,6 @@ dnl so that regeneration via dependencies works correctly
fi
fi
# Generate a JSON config file for unittest harnesses etc to read
# build configuration details from in a standardized way.
OS_TARGET=${OS_TARGET} \
TARGET_CPU=${TARGET_CPU} \
MOZ_DEBUG=${MOZ_DEBUG} \
MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
MOZ_APP_NAME=${MOZ_APP_NAME} \
TOPSRCDIR=${_topsrcdir} \
MOZ_ASAN=${MOZ_ASAN} \
$PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
rm ./mozinfo.json.tmp
else
mv -f ./mozinfo.json.tmp ./mozinfo.json
fi
# Run jemalloc configure script
if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then

View File

@ -95,8 +95,12 @@ void SetDirectionFromNewTextNode(nsIContent* aTextNode);
/**
* When a text node is removed from a document, find any ancestors whose
* directionality it determined and redetermine their directionality
*
* @param aTextNode the text node
* @param aNullParent whether the the parent is also being removed
* (passed from UnbindFromTree)
*/
void ResetDirectionSetByTextNode(nsTextNode* aTextNode);
void ResetDirectionSetByTextNode(nsTextNode* aTextNode, bool aNullParent);
/**
* Set the directionality of an element according to the directionality of the

View File

@ -133,6 +133,8 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
/**
* Method to get the full state of this element. See nsEventStates.h for
* the possible bits that could be set here.

View File

@ -172,12 +172,6 @@ public:
NS_DECL_SIZEOF_EXCLUDING_THIS
/**
* Called during QueryInterface to give the binding manager a chance to
* get an interface for this element.
*/
nsresult PostQueryInterface(REFNSIID aIID, void** aInstancePtr);
// nsINode interface methods
virtual uint32_t GetChildCount() const MOZ_OVERRIDE;
virtual nsIContent *GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE;
@ -402,16 +396,4 @@ protected:
rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr); \
NS_INTERFACE_TABLE_TO_MAP_SEGUE
#define NS_ELEMENT_INTERFACE_MAP_END \
{ \
return PostQueryInterface(aIID, aInstancePtr); \
} \
\
NS_ADDREF(foundInterface); \
\
*aInstancePtr = foundInterface; \
\
return NS_OK; \
}
#endif /* FragmentOrElement_h___ */

View File

@ -80,11 +80,14 @@ class nsCopySupport
* responsible for removing the content during a cut operation if true is
* returned.
*
* aClipboardType specifies which clipboard to use, from nsIClipboard.
*
* If the event is cancelled or an error occurs, false will be returned.
*/
static bool FireClipboardEvent(int32_t aType,
nsIPresShell* aPresShell,
nsISelection* aSelection);
int32_t aClipboardType,
nsIPresShell* aPresShell,
nsISelection* aSelection);
};
#endif

View File

@ -502,7 +502,7 @@ private:
nsINode* oldTextNode = static_cast<Element*>(aData);
Element* rootNode = aEntry->GetKey();
nsINode* newTextNode = nullptr;
if (rootNode->HasDirAuto()) {
if (oldTextNode && rootNode->HasDirAuto()) {
newTextNode = WalkDescendantsSetDirectionFromText(rootNode, true,
oldTextNode);
}
@ -529,6 +529,11 @@ public:
mElements.EnumerateEntries(SetNodeDirection, &aDir);
}
void ClearAutoDirection()
{
mElements.EnumerateEntries(ResetNodeDirection, nullptr);
}
void ResetAutoDirection(nsINode* aTextNode)
{
mElements.EnumerateEntries(ResetNodeDirection, aTextNode);
@ -565,6 +570,13 @@ public:
GetDirectionalityMap(aTextNode)->UpdateAutoDirection(aDir);
}
static void ClearTextNodeDirection(nsINode* aTextNode)
{
MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(),
"Map missing in ResetTextNodeDirection");
GetDirectionalityMap(aTextNode)->ClearAutoDirection();
}
static void ResetTextNodeDirection(nsINode* aTextNode)
{
MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(),
@ -871,7 +883,7 @@ SetDirectionFromNewTextNode(nsIContent* aTextNode)
}
void
ResetDirectionSetByTextNode(nsTextNode* aTextNode)
ResetDirectionSetByTextNode(nsTextNode* aTextNode, bool aNullParent)
{
if (!NodeAffectsDirAutoAncestor(aTextNode)) {
nsTextNodeDirectionalityMap::EnsureMapIsClearFor(aTextNode);
@ -880,7 +892,11 @@ ResetDirectionSetByTextNode(nsTextNode* aTextNode)
Directionality dir = GetDirectionFromText(aTextNode->GetText());
if (dir != eDir_NotSet && aTextNode->HasTextNodeDirectionalityMap()) {
nsTextNodeDirectionalityMap::ResetTextNodeDirection(aTextNode);
if (aNullParent) {
nsTextNodeDirectionalityMap::ClearTextNodeDirection(aTextNode);
} else {
nsTextNodeDirectionalityMap::ResetTextNodeDirection(aTextNode);
}
}
}

View File

@ -127,11 +127,27 @@
#include "nsXBLService.h"
#include "nsContentCID.h"
#include "nsITextControlElement.h"
#include "nsISupportsImpl.h"
#include "mozilla/dom/DocumentFragment.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMETHODIMP
Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_ASSERTION(aInstancePtr,
"QueryInterface requires a non-NULL destination!");
nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr);
if (NS_SUCCEEDED(rv)) {
return NS_OK;
}
// Give the binding manager a chance to get an interface for this element.
return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID,
aInstancePtr);
}
nsEventStates
Element::IntrinsicState() const
{

View File

@ -106,7 +106,6 @@
#include "nsIXULDocument.h"
#endif /* MOZ_XUL */
#include "nsCycleCollectionParticipant.h"
#include "nsCCUncollectableMarker.h"
#include "mozAutoDocUpdate.h"
@ -1750,13 +1749,6 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(FragmentOrElement)
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(FragmentOrElement,
nsNodeUtils::LastRelease(this))
nsresult
FragmentOrElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr)
{
return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID,
aInstancePtr);
}
//----------------------------------------------------------------------
nsresult

View File

@ -52,6 +52,9 @@
#include "imgIRequest.h"
#include "nsDOMDataTransfer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLAreaElement.h"
using mozilla::dom::HTMLAreaElement;
class MOZ_STACK_CLASS DragDataProducer
{
@ -505,10 +508,11 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
if (area) {
// use the alt text (or, if missing, the href) as the title
area->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString);
HTMLAreaElement* areaElem = static_cast<HTMLAreaElement*>(area.get());
areaElem->GetAttribute(NS_LITERAL_STRING("alt"), mTitleString);
if (mTitleString.IsEmpty()) {
// this can be a relative link
area->GetAttribute(NS_LITERAL_STRING("href"), mTitleString);
areaElem->GetAttribute(NS_LITERAL_STRING("href"), mTitleString);
}
// we'll generate HTML like <a href="absurl">alt text</a>

View File

@ -4960,7 +4960,7 @@ nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent)
// means, for instance calling the drag service directly, or a drag
// from another application. In either case, a new dataTransfer should
// be created that reflects the data.
initialDataTransfer = new nsDOMDataTransfer(aDragEvent->message, true);
initialDataTransfer = new nsDOMDataTransfer(aDragEvent->message, true, -1);
NS_ENSURE_TRUE(initialDataTransfer, NS_ERROR_OUT_OF_MEMORY);

View File

@ -573,7 +573,7 @@ nsCopySupport::CanCopy(nsIDocument* aDocument)
}
bool
nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISelection* aSelection)
nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPresShell* aPresShell, nsISelection* aSelection)
{
NS_ASSERTION(aType == NS_CUT || aType == NS_COPY || aType == NS_PASTE,
"Invalid clipboard event type");
@ -633,7 +633,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe
bool doDefault = true;
nsRefPtr<nsDOMDataTransfer> clipboardData;
if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
clipboardData = new nsDOMDataTransfer(aType, aType == NS_PASTE);
clipboardData = new nsDOMDataTransfer(aType, aType == NS_PASTE, aClipboardType);
nsEventStatus status = nsEventStatus_eIgnore;
nsClipboardEvent evt(true, aType);
@ -675,7 +675,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe
return false;
}
// call the copy code
rv = HTMLCopy(sel, doc, nsIClipboard::kGlobalClipboard);
rv = HTMLCopy(sel, doc, aClipboardType);
if (NS_FAILED(rv)) {
return false;
}
@ -692,7 +692,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe
NS_ENSURE_TRUE(transferable, false);
// put the transferable on the clipboard
rv = clipboard->SetData(transferable, nullptr, nsIClipboard::kGlobalClipboard);
rv = clipboard->SetData(transferable, nullptr, aClipboardType);
if (NS_FAILED(rv)) {
return false;
}

View File

@ -112,7 +112,6 @@
#include "nsHTMLDocument.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIRequest.h"
#include "nsILink.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsCharsetAlias.h"
@ -149,6 +148,7 @@
#include "nsObjectLoadingContent.h"
#include "nsHtml5TreeOpExecutor.h"
#include "nsIDOMElementReplaceEvent.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#ifdef MOZ_WEBRTC
#include "IPeerConnection.h"
@ -194,6 +194,7 @@
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/WebComponentsBinding.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/UndoManager.h"
#include "nsFrame.h"
@ -1952,15 +1953,6 @@ nsDocument::Init()
mRadioGroups.Init();
mCustomPrototypes.Init();
// If after creation the owner js global is not set for a document
// we use the default compartment for this document, instead of creating
// wrapper in some random compartment when the document is exposed to js
// via some events.
nsCOMPtr<nsIGlobalObject> global = xpc::GetJunkScopeGlobal();
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
mScopeObject = do_GetWeakReference(global);
MOZ_ASSERT(mScopeObject);
// Force initialization.
nsINode::nsSlots* slots = Slots();
@ -1991,6 +1983,15 @@ nsDocument::Init()
NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
// If after creation the owner js global is not set for a document
// we use the default compartment for this document, instead of creating
// wrapper in some random compartment when the document is exposed to js
// via some events.
nsCOMPtr<nsIGlobalObject> global = xpc::GetJunkScopeGlobal();
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
mScopeObject = do_GetWeakReference(global);
MOZ_ASSERT(mScopeObject);
mScriptLoader = new nsScriptLoader(this);
mImageTracker.Init();
@ -2544,37 +2545,26 @@ nsDocument::InitCSP(nsIChannel* aChannel)
}
// Figure out if we need to apply an app default CSP or a CSP from an app manifest
bool applyAppDefaultCSP = false;
bool applyAppManifestCSP = false;
nsIPrincipal* principal = NodePrincipal();
bool unknownAppId;
uint16_t appStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
nsAutoString appManifestCSP;
if (NS_SUCCEEDED(principal->GetUnknownAppId(&unknownAppId)) &&
!unknownAppId &&
NS_SUCCEEDED(principal->GetAppStatus(&appStatus))) {
applyAppDefaultCSP = ( appStatus == nsIPrincipal::APP_STATUS_PRIVILEGED ||
appStatus == nsIPrincipal::APP_STATUS_CERTIFIED);
uint16_t appStatus = principal->GetAppStatus();
bool applyAppDefaultCSP = appStatus == nsIPrincipal::APP_STATUS_PRIVILEGED ||
appStatus == nsIPrincipal::APP_STATUS_CERTIFIED;
bool applyAppManifestCSP = false;
if (appStatus != nsIPrincipal::APP_STATUS_NOT_INSTALLED) {
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
if (appsService) {
uint32_t appId = 0;
if (NS_SUCCEEDED(principal->GetAppId(&appId))) {
appsService->GetCSPByLocalId(appId, appManifestCSP);
if (!appManifestCSP.IsEmpty()) {
applyAppManifestCSP = true;
}
nsAutoString appManifestCSP;
if (appStatus != nsIPrincipal::APP_STATUS_NOT_INSTALLED) {
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
if (appsService) {
uint32_t appId = 0;
if (NS_SUCCEEDED(principal->GetAppId(&appId))) {
appsService->GetCSPByLocalId(appId, appManifestCSP);
if (!appManifestCSP.IsEmpty()) {
applyAppManifestCSP = true;
}
}
}
}
#ifdef PR_LOGGING
else
PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("Failed to get app status from principal"));
#endif
// If there's no CSP to apply, go ahead and return early
if (!applyAppDefaultCSP &&
@ -7590,7 +7580,7 @@ nsDocument::Sanitize()
for (uint32_t i = 0; i < length; ++i) {
NS_ASSERTION(nodes->Item(i), "null item in node list!");
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(nodes->Item(i));
nsRefPtr<HTMLInputElement> input = HTMLInputElement::FromContentOrNull(nodes->Item(i));
if (!input)
continue;
@ -7606,8 +7596,7 @@ nsDocument::Sanitize()
}
if (resetValue) {
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(input);
fc->Reset();
input->Reset();
}
}
@ -7622,7 +7611,8 @@ nsDocument::Sanitize()
if (!form)
continue;
form->GetAttribute(NS_LITERAL_STRING("autocomplete"), value);
nodes->Item(i)->AsElement()->GetAttr(kNameSpaceID_None,
nsGkAtoms::autocomplete, value);
if (value.LowerCaseEqualsLiteral("off"))
form->Reset();
}
@ -8066,15 +8056,12 @@ nsDocument::OnPageShow(bool aPersisted,
if (aPersisted && root) {
// Send out notifications that our <link> elements are attached.
nsRefPtr<nsContentList> links = NS_GetContentList(root,
kNameSpaceID_Unknown,
kNameSpaceID_XHTML,
NS_LITERAL_STRING("link"));
uint32_t linkCount = links->Length(true);
for (uint32_t i = 0; i < linkCount; ++i) {
nsCOMPtr<nsILink> link = do_QueryInterface(links->Item(i, false));
if (link) {
link->LinkAdded();
}
static_cast<HTMLLinkElement*>(links->Item(i, false))->LinkAdded();
}
}
@ -8130,15 +8117,12 @@ nsDocument::OnPageHide(bool aPersisted,
Element* root = GetRootElement();
if (aPersisted && root) {
nsRefPtr<nsContentList> links = NS_GetContentList(root,
kNameSpaceID_Unknown,
kNameSpaceID_XHTML,
NS_LITERAL_STRING("link"));
uint32_t linkCount = links->Length(true);
for (uint32_t i = 0; i < linkCount; ++i) {
nsCOMPtr<nsILink> link = do_QueryInterface(links->Item(i, false));
if (link) {
link->LinkRemoved();
}
static_cast<HTMLLinkElement*>(links->Item(i, false))->LinkRemoved();
}
}

View File

@ -1479,10 +1479,10 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
}
if (domapplet || domobject) {
if (domapplet) {
parent = domapplet;
parent = do_QueryInterface(domapplet);
}
else {
parent = domobject;
parent = do_QueryInterface(domobject);
}
nsCOMPtr<nsIDOMNode> mydomNode = do_QueryInterface(mydomElement);
if (parent == mydomNode) {

View File

@ -147,7 +147,7 @@ nsTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
void nsTextNode::UnbindFromTree(bool aDeep, bool aNullParent)
{
ResetDirectionSetByTextNode(this);
ResetDirectionSetByTextNode(this, aNullParent);
nsGenericDOMDataNode::UnbindFromTree(aDeep, aNullParent);
}

View File

@ -755,6 +755,7 @@ void CanvasRenderingContext2D::Demote()
RefPtr<SourceSurface> snapshot = mTarget->Snapshot();
RefPtr<DrawTarget> oldTarget = mTarget;
mTarget = nullptr;
mResetLayer = true;
mForceSoftware = true;
// Recreate target, now demoted to software only
@ -3039,6 +3040,24 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
RedrawUser(gfxRect(dx, dy, dw, dh));
}
#ifdef USE_SKIA_GPU
static bool
IsStandardCompositeOp(CompositionOp op)
{
return (op == OP_SOURCE ||
op == OP_ATOP ||
op == OP_IN ||
op == OP_OUT ||
op == OP_OVER ||
op == OP_DEST_IN ||
op == OP_DEST_OUT ||
op == OP_DEST_OVER ||
op == OP_DEST_ATOP ||
op == OP_ADD ||
op == OP_XOR);
}
#endif
void
CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
ErrorResult& error)
@ -3078,6 +3097,12 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
else return;
#ifdef USE_SKIA_GPU
if (!IsStandardCompositeOp(comp_op)) {
Demote();
}
#endif
#undef CANVAS_OP_TO_GFX_OP
CurrentState().op = comp_op;
}
@ -3122,6 +3147,12 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
error.Throw(NS_ERROR_FAILURE);
}
#ifdef USE_SKIA_GPU
if (!IsStandardCompositeOp(comp_op)) {
Demote();
}
#endif
#undef CANVAS_OP_TO_GFX_OP
}

View File

@ -89,9 +89,6 @@ MOCHITEST_FILES = \
test_windingRuleUndefined.html \
$(NULL)
ifneq ($(MOZ_WIDGET_TOOLKIT), android)
ifneq ($(MOZ_WIDGET_TOOLKIT), gonk)
# SkiaGL on Android/Gonk does not implement these composite ops yet
MOCHITEST_FILES += \
@ -123,9 +120,6 @@ MOCHITEST_FILES += \
test_2d.composite.solid.soft-light.html \
$(NULL)
endif
endif
ifneq (1_Linux,$(MOZ_SUITE)_$(OS_ARCH))
# This test fails in Suite on Linux for some reason, disable it there
MOCHITEST_FILES += test_2d.composite.uncovered.image.destination-atop.html

View File

@ -7,6 +7,7 @@
#include "nsContentUtils.h"
#include "nsClientRect.h"
#include "nsDOMDataTransfer.h"
#include "nsIClipboard.h"
nsDOMClipboardEvent::nsDOMClipboardEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
@ -68,7 +69,7 @@ nsDOMClipboardEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
// Always create a clipboardData for the copy event. If this is changed to
// support other types of events, make sure that read/write privileges are
// checked properly within nsDOMDataTransfer.
clipboardData = new nsDOMDataTransfer(NS_COPY, false);
clipboardData = new nsDOMDataTransfer(NS_COPY, false, -1);
clipboardData->SetData(aParam.mDataType, aParam.mData);
}
}
@ -93,10 +94,10 @@ nsDOMClipboardEvent::GetClipboardData()
if (!event->clipboardData) {
if (mEventIsInternal) {
event->clipboardData = new nsDOMDataTransfer(NS_COPY, false);
event->clipboardData = new nsDOMDataTransfer(NS_COPY, false, -1);
} else {
event->clipboardData =
new nsDOMDataTransfer(event->message, event->message == NS_PASTE);
new nsDOMDataTransfer(event->message, event->message == NS_PASTE, nsIClipboard::kGlobalClipboard);
}
}

View File

@ -63,7 +63,7 @@ const char nsDOMDataTransfer::sEffects[8][9] = {
"none", "copy", "move", "copyMove", "link", "copyLink", "linkMove", "all"
};
nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal)
nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal, int32_t aClipboardType)
: mEventType(aEventType),
mDropEffect(nsIDragService::DRAGDROP_ACTION_NONE),
mEffectAllowed(nsIDragService::DRAGDROP_ACTION_UNINITIALIZED),
@ -72,6 +72,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal)
mIsExternal(aIsExternal),
mUserCancelled(false),
mIsCrossDomainSubFrameDrop(false),
mClipboardType(aClipboardType),
mDragImageX(0),
mDragImageY(0)
{
@ -98,6 +99,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType,
bool aIsExternal,
bool aUserCancelled,
bool aIsCrossDomainSubFrameDrop,
int32_t aClipboardType,
nsTArray<nsTArray<TransferItem> >& aItems,
nsIDOMElement* aDragImage,
uint32_t aDragImageX,
@ -110,6 +112,7 @@ nsDOMDataTransfer::nsDOMDataTransfer(uint32_t aEventType,
mIsExternal(aIsExternal),
mUserCancelled(aUserCancelled),
mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop),
mClipboardType(aClipboardType),
mItems(aItems),
mDragImage(aDragImage),
mDragImageX(aDragImageX),
@ -653,7 +656,7 @@ nsDOMDataTransfer::Clone(uint32_t aEventType, bool aUserCancelled,
nsDOMDataTransfer* newDataTransfer =
new nsDOMDataTransfer(aEventType, mEffectAllowed, mCursorState,
mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop,
mItems, mDragImage, mDragImageX, mDragImageY);
mClipboardType, mItems, mDragImage, mDragImageX, mDragImageY);
NS_ENSURE_TRUE(newDataTransfer, NS_ERROR_OUT_OF_MEMORY);
*aNewDataTransfer = newDataTransfer;
@ -979,7 +982,7 @@ nsDOMDataTransfer::CacheExternalClipboardFormats()
// data will only be retrieved when needed.
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
if (!clipboard) {
if (!clipboard || mClipboardType < 0) {
return;
}
@ -994,8 +997,7 @@ nsDOMDataTransfer::CacheExternalClipboardFormats()
for (uint32_t f = 0; f < mozilla::ArrayLength(formats); ++f) {
// check each format one at a time
bool supported;
clipboard->HasDataMatchingFlavors(&(formats[f]), 1,
nsIClipboard::kGlobalClipboard, &supported);
clipboard->HasDataMatchingFlavors(&(formats[f]), 1, mClipboardType, &supported);
// if the format is supported, add an item to the array with null as
// the data. When retrieved, GetRealData will read the data.
if (supported) {
@ -1036,11 +1038,11 @@ nsDOMDataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0");
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
if (!clipboard) {
if (!clipboard || mClipboardType < 0) {
return;
}
clipboard->GetData(trans, nsIClipboard::kGlobalClipboard);
clipboard->GetData(trans, mClipboardType);
} else {
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (!dragSession) {

View File

@ -58,6 +58,7 @@ protected:
bool aIsExternal,
bool aUserCancelled,
bool aIsCrossDomainSubFrameDrop,
int32_t aClipboardType,
nsTArray<nsTArray<TransferItem> >& aItems,
nsIDOMElement* aDragImage,
uint32_t aDragImageX,
@ -82,8 +83,10 @@ public:
// paste or a drag that was started without using a data transfer. The
// latter will occur when an external drag occurs, that is, a drag where the
// source is another application, or a drag is started by calling the drag
// service directly.
nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal);
// service directly. For clipboard operations, aClipboardType indicates
// which clipboard to use, from nsIClipboard, or -1 for non-clipboard operations,
// or if access to the system clipboard should not be allowed.
nsDOMDataTransfer(uint32_t aEventType, bool aIsExternal, int32_t aClipboardType);
void GetDragTarget(nsIDOMElement** aDragTarget)
{
@ -178,6 +181,10 @@ protected:
// data should be prevented
bool mIsCrossDomainSubFrameDrop;
// Indicates which clipboard type to use for clipboard operations. Ignored for
// drag and drop.
int32_t mClipboardType;
// array of items, each containing an array of format->data pairs
nsTArray<nsTArray<TransferItem> > mItems;

View File

@ -54,61 +54,27 @@ class nsEventTargetChainItem
private:
nsEventTargetChainItem(EventTarget* aTarget,
nsEventTargetChainItem* aChild = nullptr);
// This is the ETCI recycle pool, which is used to avoid some malloc/free
// churn. It's implemented as a linked list.
static nsEventTargetChainItem* sEtciRecyclePool;
static uint32_t sNumRecycledEtcis;
static const uint32_t kMaxNumRecycledEtcis = 128;
public:
static nsEventTargetChainItem* Create(EventTarget* aTarget,
nsEventTargetChainItem()
: mChild(nullptr), mParent(nullptr), mFlags(0), mItemFlags(0)
{
}
static nsEventTargetChainItem* Create(nsTArray<nsEventTargetChainItem>& aPool,
EventTarget* aTarget,
nsEventTargetChainItem* aChild = nullptr)
{
// Allocate from the ETCI recycle pool if possible.
void* place = nullptr;
if (sNumRecycledEtcis > 0) {
MOZ_ASSERT(sEtciRecyclePool);
place = sEtciRecyclePool;
sEtciRecyclePool = sEtciRecyclePool->mNext;
--sNumRecycledEtcis;
} else {
place = malloc(sizeof(nsEventTargetChainItem));
}
return place
? ::new (place) nsEventTargetChainItem(aTarget, aChild)
: nullptr;
return new (aPool.AppendElement()) nsEventTargetChainItem(aTarget, aChild);
}
static void Destroy(nsEventTargetChainItem* aItem)
{
// ::Destroy deletes ancestor chain.
nsEventTargetChainItem* item = aItem;
if (item->mChild) {
item->mChild->mParent = nullptr;
item->mChild = nullptr;
}
// Put destroyed ETCIs into the recycle pool if it's not already full.
while (item) {
nsEventTargetChainItem* parent = item->mParent;
item->~nsEventTargetChainItem();
if (sNumRecycledEtcis < kMaxNumRecycledEtcis) {
item->mNext = sEtciRecyclePool;
sEtciRecyclePool = item;
++sNumRecycledEtcis;
} else {
free(item);
}
item = parent;
}
}
static void ShutdownRecyclePool()
{
while (sEtciRecyclePool) {
nsEventTargetChainItem* tmp = sEtciRecyclePool;
sEtciRecyclePool = sEtciRecyclePool->mNext;
free(tmp);
// nsEventTargetChainItem objects are deleted when the pool goes out of
// the scope.
if (aItem->mChild) {
aItem->mChild->mParent = nullptr;
aItem->mChild = nullptr;
}
}
@ -233,21 +199,9 @@ public:
nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor,
nsCxPusher* aPusher);
static uint32_t MaxEtciCount() { return sMaxEtciCount; }
static void ResetMaxEtciCount()
{
MOZ_ASSERT(!sCurrentEtciCount, "Wrong time to call ResetMaxEtciCount()!");
sMaxEtciCount = 0;
}
nsCOMPtr<EventTarget> mTarget;
nsEventTargetChainItem* mChild;
union {
nsEventTargetChainItem* mParent;
// This is used only when recycling ETCIs.
nsEventTargetChainItem* mNext;
};
nsEventTargetChainItem* mParent;
uint16_t mFlags;
uint16_t mItemFlags;
nsCOMPtr<nsISupports> mItemData;
@ -255,14 +209,8 @@ public:
nsCOMPtr<EventTarget> mNewTarget;
// Cache mTarget's event listener manager.
nsRefPtr<nsEventListenerManager> mManager;
static uint32_t sMaxEtciCount;
static uint32_t sCurrentEtciCount;
};
nsEventTargetChainItem* nsEventTargetChainItem::sEtciRecyclePool = nullptr;
uint32_t nsEventTargetChainItem::sNumRecycledEtcis = 0;
nsEventTargetChainItem::nsEventTargetChainItem(EventTarget* aTarget,
nsEventTargetChainItem* aChild)
: mTarget(aTarget), mChild(aChild), mParent(nullptr), mFlags(0), mItemFlags(0)
@ -405,13 +353,9 @@ nsEventTargetChainItem::HandleEventTargetChain(
return NS_OK;
}
void NS_ShutdownEventTargetChainItemRecyclePool()
{
nsEventTargetChainItem::ShutdownRecyclePool();
}
nsEventTargetChainItem*
EventTargetChainItemForChromeTarget(nsINode* aNode,
EventTargetChainItemForChromeTarget(nsTArray<nsEventTargetChainItem>& aPool,
nsINode* aNode,
nsEventTargetChainItem* aChild = nullptr)
{
if (!aNode->IsInDoc()) {
@ -422,9 +366,9 @@ EventTargetChainItemForChromeTarget(nsINode* aNode,
NS_ENSURE_TRUE(piTarget, nullptr);
nsEventTargetChainItem* etci =
nsEventTargetChainItem::Create(piTarget->GetTargetForEventTargetChain(),
nsEventTargetChainItem::Create(aPool,
piTarget->GetTargetForEventTargetChain(),
aChild);
NS_ENSURE_TRUE(etci, nullptr);
if (!etci->IsValid()) {
nsEventTargetChainItem::Destroy(etci);
return nullptr;
@ -522,10 +466,12 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
// event dispatching is finished.
nsRefPtr<nsPresContext> kungFuDeathGrip(aPresContext);
// Try to limit malloc/free churn by using an array as a pool.
nsTArray<nsEventTargetChainItem> pool(128);
// Create the event target chain item for the event target.
nsEventTargetChainItem* targetEtci =
nsEventTargetChainItem::Create(target->GetTargetForEventTargetChain());
NS_ENSURE_TRUE(targetEtci, NS_ERROR_OUT_OF_MEMORY);
nsEventTargetChainItem::Create(pool, target->GetTargetForEventTargetChain());
if (!targetEtci->IsValid()) {
nsEventTargetChainItem::Destroy(targetEtci);
return NS_ERROR_FAILURE;
@ -571,7 +517,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
if (!preVisitor.mCanHandle && preVisitor.mAutomaticChromeDispatch && content) {
// Event target couldn't handle the event. Try to propagate to chrome.
nsEventTargetChainItem::Destroy(targetEtci);
targetEtci = EventTargetChainItemForChromeTarget(content);
targetEtci = EventTargetChainItemForChromeTarget(pool, content);
NS_ENSURE_STATE(targetEtci);
targetEtci->PreHandleEvent(preVisitor);
}
@ -584,11 +530,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
while (preVisitor.mParentTarget) {
EventTarget* parentTarget = preVisitor.mParentTarget;
nsEventTargetChainItem* parentEtci =
nsEventTargetChainItem::Create(preVisitor.mParentTarget, topEtci);
if (!parentEtci) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
nsEventTargetChainItem::Create(pool, preVisitor.mParentTarget, topEtci);
if (!parentEtci->IsValid()) {
rv = NS_ERROR_FAILURE;
break;
@ -613,7 +555,8 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
// propagate to chrome.
nsCOMPtr<nsINode> disabledTarget = do_QueryInterface(parentTarget);
if (disabledTarget) {
parentEtci = EventTargetChainItemForChromeTarget(disabledTarget,
parentEtci = EventTargetChainItemForChromeTarget(pool,
disabledTarget,
topEtci);
if (parentEtci) {
parentEtci->PreHandleEvent(preVisitor);

View File

@ -2028,7 +2028,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
}
nsRefPtr<nsDOMDataTransfer> dataTransfer =
new nsDOMDataTransfer(NS_DRAGDROP_START, false);
new nsDOMDataTransfer(NS_DRAGDROP_START, false, -1);
if (!dataTransfer)
return;

View File

@ -29,15 +29,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMediaElement
using HTMLMediaElement::GetPaused;
NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(HTMLMediaElement::)

View File

@ -54,15 +54,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLCanvasElement
NS_DECL_NSIDOMHTMLCANVASELEMENT
@ -224,8 +215,6 @@ public:
nsresult GetContext(const nsAString& aContextId, nsISupports** aContext);
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
protected:
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

View File

@ -28,15 +28,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMediaElement
using HTMLMediaElement::GetPaused;
NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(HTMLMediaElement::)
@ -62,8 +53,6 @@ public:
virtual nsresult SetAcceptHeader(nsIHttpChannel* aChannel);
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// WebIDL
uint32_t Width() const

View File

@ -22,7 +22,6 @@ EXPORTS += [
'nsIFormControl.h',
'nsIFormProcessor.h',
'nsIHTMLCollection.h',
'nsILink.h',
'nsIRadioGroupContainer.h',
'nsIRadioVisitor.h',
'nsITextControlElement.h',

View File

@ -1,52 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsILink_h___
#define nsILink_h___
#include "nsISupports.h"
#include "nsILinkHandler.h" // definition of nsLinkState
class nsIURI;
// IID for the nsILink interface
#define NS_ILINK_IID \
{ 0x6f374a11, 0x212d, 0x47d6, \
{ 0x94, 0xd1, 0xe6, 0x7c, 0x23, 0x4d, 0x34, 0x99 } }
/**
* This interface allows SelectorMatches to get the canonical
* URL pointed to by an element representing a link and allows
* it to store the visited state of a link element in the link.
* It is needed for performance reasons (to prevent copying of
* strings and excessive calls to history).
*/
class nsILink : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINK_IID)
/**
* SetLinkState/GetHrefURI were moved to nsIContent.
* @see nsIContent
*/
/**
* Dispatch a LinkAdded event to the chrome event handler for this document.
* This is used to notify the chrome listeners when restoring a page
* presentation. Currently, this only applies to HTML <link> elements.
*/
NS_IMETHOD LinkAdded() = 0;
/**
* Dispatch a LinkRemoved event to the chrome event handler for this
* document. This is used to notify the chrome listeners when saving a page
* presentation (since the document is not torn down). Currently, this only
* applies to HTML <link> elements.
*/
NS_IMETHOD LinkRemoved() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsILink, NS_ILINK_IID)
#endif /* nsILink_h___ */

View File

@ -40,19 +40,8 @@ HTMLAnchorElement::~HTMLAnchorElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLAnchorElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLAnchorElement, Element)
// QueryInterface implementation for HTMLAnchorElement
NS_INTERFACE_TABLE_HEAD(HTMLAnchorElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED3(HTMLAnchorElement,
nsIDOMHTMLAnchorElement,
nsILink,
Link)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED2(HTMLAnchorElement, nsGenericHTMLElement,
nsIDOMHTMLAnchorElement, Link)
NS_IMPL_ELEMENT_CLONE(HTMLAnchorElement)

View File

@ -11,14 +11,12 @@
#include "mozilla/dom/Link.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsILink.h"
namespace mozilla {
namespace dom {
class HTMLAnchorElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLAnchorElement,
public nsILink,
public Link
{
public:
@ -35,15 +33,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
virtual bool Draggable() const MOZ_OVERRIDE;
@ -53,10 +42,6 @@ public:
// DOM memory reporter participant
NS_DECL_SIZEOF_EXCLUDING_THIS
// nsILink
NS_IMETHOD LinkAdded() MOZ_OVERRIDE { return NS_OK; }
NS_IMETHOD LinkRemoved() MOZ_OVERRIDE { return NS_OK; }
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers) MOZ_OVERRIDE;
@ -89,8 +74,6 @@ public:
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
virtual void OnDNSPrefetchDeferred();
virtual void OnDNSPrefetchRequested();
virtual bool HasDeferredDNSPrefetchRequest();

View File

@ -25,19 +25,8 @@ HTMLAreaElement::~HTMLAreaElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLAreaElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLAreaElement, Element)
// QueryInterface implementation for HTMLAreaElement
NS_INTERFACE_TABLE_HEAD(HTMLAreaElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED3(HTMLAreaElement,
nsIDOMHTMLAreaElement,
nsILink,
Link)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED2(HTMLAreaElement, nsGenericHTMLElement,
nsIDOMHTMLAreaElement, Link)
NS_IMPL_ELEMENT_CLONE(HTMLAreaElement)

View File

@ -12,7 +12,6 @@
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsILink.h"
#include "nsIURL.h"
class nsIDocument;
@ -22,7 +21,6 @@ namespace dom {
class HTMLAreaElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLAreaElement,
public nsILink,
public Link
{
public:
@ -35,24 +33,11 @@ public:
// DOM memory reporter participant
NS_DECL_SIZEOF_EXCLUDING_THIS
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
// nsIDOMHTMLAreaElement
NS_DECL_NSIDOMHTMLAREAELEMENT
// nsILink
NS_IMETHOD LinkAdded() MOZ_OVERRIDE { return NS_OK; }
NS_IMETHOD LinkRemoved() MOZ_OVERRIDE { return NS_OK; }
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
@ -79,8 +64,6 @@ public:
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// WebIDL
// The XPCOM GetAlt is OK for us

View File

@ -30,16 +30,9 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Audio)
namespace mozilla {
namespace dom {
NS_IMPL_ADDREF_INHERITED(HTMLAudioElement, HTMLMediaElement)
NS_IMPL_RELEASE_INHERITED(HTMLAudioElement, HTMLMediaElement)
NS_INTERFACE_TABLE_HEAD(HTMLAudioElement)
NS_HTML_CONTENT_INTERFACES(HTMLMediaElement)
NS_INTERFACE_TABLE_INHERITED4(HTMLAudioElement, nsIDOMHTMLMediaElement,
nsIDOMHTMLAudioElement, nsITimerCallback,
nsIAudioChannelAgentCallback)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED4(HTMLAudioElement, HTMLMediaElement,
nsIDOMHTMLMediaElement, nsIDOMHTMLAudioElement,
nsITimerCallback, nsIAudioChannelAgentCallback)
NS_IMPL_ELEMENT_CLONE(HTMLAudioElement)

View File

@ -27,17 +27,8 @@ HTMLBRElement::~HTMLBRElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLBRElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLBRElement, Element)
// QueryInterface implementation for HTMLBRElement
NS_INTERFACE_TABLE_HEAD(HTMLBRElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLBRElement, nsIDOMHTMLBRElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLBRElement, nsGenericHTMLElement,
nsIDOMHTMLBRElement)
NS_IMPL_ELEMENT_CLONE(HTMLBRElement)

View File

@ -24,15 +24,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLBRElement
NS_DECL_NSIDOMHTMLBRELEMENT
@ -43,7 +34,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
bool Clear()
{

View File

@ -199,15 +199,8 @@ HTMLBodyElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope)
return HTMLBodyElementBinding::Wrap(aCx, aScope, this);
}
NS_IMPL_ADDREF_INHERITED(HTMLBodyElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLBodyElement, Element)
// QueryInterface implementation for HTMLBodyElement
NS_INTERFACE_TABLE_HEAD(HTMLBodyElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLBodyElement, nsIDOMHTMLBodyElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLBodyElement, nsGenericHTMLElement,
nsIDOMHTMLBodyElement)
NS_IMPL_ELEMENT_CLONE(HTMLBodyElement)

View File

@ -49,15 +49,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLBodyElement
NS_DECL_NSIDOMHTMLBODYELEMENT
@ -141,7 +132,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual already_AddRefed<nsIEditor> GetAssociatedEditor() MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;

View File

@ -83,12 +83,10 @@ NS_IMPL_RELEASE_INHERITED(HTMLButtonElement, Element)
// QueryInterface implementation for HTMLButtonElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLButtonElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElementWithState)
NS_INTERFACE_TABLE_INHERITED2(HTMLButtonElement,
nsIDOMHTMLButtonElement,
nsIConstraintValidation)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
// nsIConstraintValidation
NS_IMPL_NSICONSTRAINTVALIDATION(HTMLButtonElement)

View File

@ -31,17 +31,10 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLButtonElement, button)
// nsIDOMHTMLButtonElement
NS_DECL_NSIDOMHTMLBUTTONELEMENT
@ -59,7 +52,6 @@ public:
// nsINode
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

View File

@ -164,12 +164,10 @@ NS_IMPL_ADDREF_INHERITED(HTMLCanvasElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLCanvasElement, Element)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLCanvasElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED2(HTMLCanvasElement,
nsIDOMHTMLCanvasElement,
nsICanvasElementExternal)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLCanvasElement)

View File

@ -21,13 +21,6 @@ HTMLDataElement::~HTMLDataElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLDataElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLDataElement, Element)
NS_INTERFACE_MAP_BEGIN(HTMLDataElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLDataElement)
JSObject*

View File

@ -14,25 +14,12 @@
namespace mozilla {
namespace dom {
class HTMLDataElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
class HTMLDataElement MOZ_FINAL : public nsGenericHTMLElement
{
public:
HTMLDataElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLDataElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// HTMLDataElement WebIDL
void GetValue(nsAString& aValue)
{
@ -47,7 +34,6 @@ public:
virtual void GetItemValueText(nsAString& text) MOZ_OVERRIDE;
virtual void SetItemValueText(const nsAString& text) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
protected:
virtual JSObject* WrapNode(JSContext* aCx,

View File

@ -28,8 +28,7 @@ NS_IMPL_ADDREF_INHERITED(HTMLDataListElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLDataListElement, Element)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLDataListElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLDataListElement)

View File

@ -12,8 +12,7 @@
namespace mozilla {
namespace dom {
class HTMLDataListElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
class HTMLDataListElement MOZ_FINAL : public nsGenericHTMLElement
{
public:
HTMLDataListElement(already_AddRefed<nsINodeInfo> aNodeInfo)
@ -25,15 +24,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
nsContentList* Options()
{
if (!mOptions) {
@ -52,8 +42,6 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLDataListElement,
nsGenericHTMLElement)
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

View File

@ -20,15 +20,8 @@ HTMLDivElement::~HTMLDivElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLDivElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLDivElement, Element)
// QueryInterface implementation for HTMLDivElement
NS_INTERFACE_TABLE_HEAD(HTMLDivElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLDivElement, nsIDOMHTMLDivElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLDivElement, nsGenericHTMLElement,
nsIDOMHTMLDivElement)
NS_IMPL_ELEMENT_CLONE(HTMLDivElement)

View File

@ -25,15 +25,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLDivElement
NS_IMETHOD GetAlign(nsAString& aAlign) MOZ_OVERRIDE
{
@ -66,8 +57,6 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

View File

@ -10,33 +10,19 @@
namespace mozilla {
namespace dom {
class HTMLElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
class HTMLElement MOZ_FINAL : public nsGenericHTMLElement
{
public:
HTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
using nsGenericHTMLElement::GetInnerHTML;
virtual void GetInnerHTML(nsAString& aInnerHTML,
mozilla::ErrorResult& aError) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo* aNodeInfo,
nsINode** aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
@ -51,13 +37,6 @@ HTMLElement::~HTMLElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLElement, Element)
NS_INTERFACE_MAP_BEGIN(HTMLElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLElement)
void

View File

@ -43,12 +43,10 @@ NS_IMPL_RELEASE_INHERITED(HTMLFieldSetElement, Element)
// QueryInterface implementation for HTMLFieldSetElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement)
NS_INTERFACE_TABLE_INHERITED2(HTMLFieldSetElement,
nsIDOMHTMLFieldSetElement,
nsIConstraintValidation)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement)
NS_IMPL_ELEMENT_CLONE(HTMLFieldSetElement)

View File

@ -34,15 +34,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLFieldSetElement
NS_DECL_NSIDOMHTMLFIELDSETELEMENT
@ -61,7 +52,6 @@ public:
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) MOZ_OVERRIDE;
virtual bool IsDisabledForEvents(uint32_t aMessage) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
const nsIContent* GetFirstLegend() const { return mFirstLegend; }

View File

@ -27,15 +27,6 @@ HTMLFontElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope)
return HTMLFontElementBinding::Wrap(aCx, aScope, this);
}
NS_IMPL_ADDREF_INHERITED(HTMLFontElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLFontElement, Element)
// QueryInterface implementation for HTMLFontElement
NS_INTERFACE_MAP_BEGIN(HTMLFontElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLFontElement)
bool

View File

@ -11,8 +11,7 @@
namespace mozilla {
namespace dom {
class HTMLFontElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
class HTMLFontElement MOZ_FINAL : public nsGenericHTMLElement
{
public:
HTMLFontElement(already_AddRefed<nsINodeInfo> aNodeInfo)
@ -21,18 +20,6 @@ public:
}
virtual ~HTMLFontElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
void GetColor(nsString& aColor)
{
GetHTMLAttr(nsGkAtoms::color, aColor);
@ -65,7 +52,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx,

View File

@ -328,14 +328,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLFormElement, Element)
// QueryInterface implementation for HTMLFormElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFormElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED4(HTMLFormElement,
nsIDOMHTMLFormElement,
nsIForm,
nsIWebProgressListener,
nsIRadioGroupContainer)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
// nsIDOMHTMLFormElement
@ -1860,12 +1858,11 @@ HTMLFormElement::CheckFormValidity(nsIMutableArray* aInvalidElements) const
// Hold a reference to the elements so they can't be deleted while calling
// the invalid events.
for (uint32_t i = 0; i < len; ++i) {
static_cast<nsGenericHTMLElement*>(sortedControls[i])->AddRef();
sortedControls[i]->AddRef();
}
for (uint32_t i = 0; i < len; ++i) {
nsCOMPtr<nsIConstraintValidation> cvElmt =
do_QueryInterface((nsGenericHTMLElement*)sortedControls[i]);
nsCOMPtr<nsIConstraintValidation> cvElmt = do_QueryObject(sortedControls[i]);
if (cvElmt && cvElmt->IsCandidateForConstraintValidation() &&
!cvElmt->IsValid()) {
ret = false;
@ -1878,7 +1875,7 @@ HTMLFormElement::CheckFormValidity(nsIMutableArray* aInvalidElements) const
// Add all unhandled invalid controls to aInvalidElements if the caller
// requested them.
if (defaultAction && aInvalidElements) {
aInvalidElements->AppendElement((nsGenericHTMLElement*)sortedControls[i],
aInvalidElements->AppendElement(ToSupports(sortedControls[i]),
false);
}
}

View File

@ -52,15 +52,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLFormElement
NS_DECL_NSIDOMHTMLFORMELEMENT
@ -282,8 +273,6 @@ public:
*/
bool CheckValidFormSubmission();
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
/**
* Walk over the form elements and call SubmitNamesValues() on them to get
* their data pumped into the FormSubmitter.

View File

@ -25,17 +25,8 @@ HTMLFrameElement::~HTMLFrameElement()
}
NS_IMPL_ADDREF_INHERITED(HTMLFrameElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLFrameElement, Element)
// QueryInterface implementation for HTMLFrameElement
NS_INTERFACE_TABLE_HEAD(HTMLFrameElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFrameElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLFrameElement, nsIDOMHTMLFrameElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLFrameElement, nsGenericHTMLFrameElement,
nsIDOMHTMLFrameElement)
NS_IMPL_ELEMENT_CLONE(HTMLFrameElement)

View File

@ -29,15 +29,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLFrameElement
NS_DECL_NSIDOMHTMLFRAMEELEMENT
@ -49,7 +40,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// WebIDL API
// The XPCOM GetFrameBorder is OK for us

View File

@ -23,17 +23,8 @@ HTMLFrameSetElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope)
return HTMLFrameSetElementBinding::Wrap(aCx, aScope, this);
}
NS_IMPL_ADDREF_INHERITED(HTMLFrameSetElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLFrameSetElement, Element)
// QueryInterface implementation for HTMLFrameSetElement
NS_INTERFACE_TABLE_HEAD(HTMLFrameSetElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLFrameSetElement,
nsIDOMHTMLFrameSetElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLFrameSetElement, nsGenericHTMLElement,
nsIDOMHTMLFrameSetElement)
NS_IMPL_ELEMENT_CLONE(HTMLFrameSetElement)

View File

@ -60,15 +60,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLFrameSetElement
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
@ -148,7 +139,6 @@ public:
int32_t aModType) const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx,

View File

@ -20,17 +20,8 @@ HTMLHRElement::~HTMLHRElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLHRElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLHRElement, Element)
// QueryInterface implementation for HTMLHRElement
NS_INTERFACE_TABLE_HEAD(HTMLHRElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLHRElement,
nsIDOMHTMLHRElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLHRElement, nsGenericHTMLElement,
nsIDOMHTMLHRElement)
NS_IMPL_ELEMENT_CLONE(HTMLHRElement)

View File

@ -26,15 +26,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLHRElement
NS_DECL_NSIDOMHTMLHRELEMENT
@ -45,7 +36,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// WebIDL API
void SetAlign(const nsAString& aAlign, ErrorResult& aError)

View File

@ -22,17 +22,8 @@ HTMLHeadingElement::~HTMLHeadingElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLHeadingElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLHeadingElement, Element)
// QueryInterface implementation for HTMLHeadingElement
NS_INTERFACE_TABLE_HEAD(HTMLHeadingElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLHeadingElement,
nsIDOMHTMLHeadingElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLHeadingElement, nsGenericHTMLElement,
nsIDOMHTMLHeadingElement)
NS_IMPL_ELEMENT_CLONE(HTMLHeadingElement)

View File

@ -26,15 +26,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLHeadingElement
NS_DECL_NSIDOMHTMLHEADINGELEMENT
@ -45,7 +36,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// The XPCOM versions of GetAlign and SetAlign are fine for us for
// use from WebIDL.

View File

@ -29,16 +29,8 @@ HTMLIFrameElement::~HTMLIFrameElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLIFrameElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLIFrameElement, Element)
// QueryInterface implementation for HTMLIFrameElement
NS_INTERFACE_TABLE_HEAD(HTMLIFrameElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFrameElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLIFrameElement,
nsIDOMHTMLIFrameElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLIFrameElement, nsGenericHTMLFrameElement,
nsIDOMHTMLIFrameElement)
NS_IMPL_ELEMENT_CLONE(HTMLIFrameElement)

View File

@ -26,15 +26,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLIFrameElement
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
@ -47,7 +38,6 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)

View File

@ -66,14 +66,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLImageElement, Element)
// QueryInterface implementation for HTMLImageElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLImageElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED4(HTMLImageElement,
nsIDOMHTMLImageElement,
nsIImageLoadingContent,
imgIOnloadBlocker,
imgINotificationObserver)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLImageElement)

View File

@ -31,15 +31,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
virtual bool Draggable() const MOZ_OVERRIDE;
// nsIDOMHTMLImageElement
@ -86,7 +77,6 @@ public:
nsresult CopyInnerTo(Element* aDest);
void MaybeLoadImage();
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
bool IsMap()
{

View File

@ -854,7 +854,6 @@ NS_IMPL_RELEASE_INHERITED(HTMLInputElement, Element)
// QueryInterface implementation for HTMLInputElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLInputElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElementWithState)
NS_INTERFACE_TABLE_INHERITED8(HTMLInputElement,
nsIDOMHTMLInputElement,
nsITextControlElement,
@ -864,8 +863,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLInputElement)
imgIOnloadBlocker,
nsIDOMNSEditableElement,
nsIConstraintValidation)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
// nsIConstraintValidation
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLInputElement)
@ -3119,7 +3117,8 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
nsCOMPtr<nsIContent> radioContent =
do_QueryInterface(selectedRadioButton);
if (radioContent) {
rv = selectedRadioButton->Focus();
nsCOMPtr<nsIDOMHTMLElement> elem = do_QueryInterface(selectedRadioButton);
rv = elem->Focus();
if (NS_SUCCEEDED(rv)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,

View File

@ -101,15 +101,8 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
using nsGenericHTMLElement::Focus;
virtual void Focus(ErrorResult& aError) MOZ_OVERRIDE;
// nsIDOMHTMLInputElement
@ -233,8 +226,6 @@ public:
void MaybeLoadImage();
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// nsIConstraintValidation
bool IsTooLong();
bool IsValueMissing() const;

View File

@ -21,16 +21,8 @@ HTMLLIElement::~HTMLLIElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLLIElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLLIElement, Element)
// QueryInterface implementation for nsHTMLLIElement
NS_INTERFACE_TABLE_HEAD(HTMLLIElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLLIElement, nsIDOMHTMLLIElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLLIElement, nsGenericHTMLElement,
nsIDOMHTMLLIElement)
NS_IMPL_ELEMENT_CLONE(HTMLLIElement)

View File

@ -27,15 +27,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLLIElement
NS_DECL_NSIDOMHTMLLIELEMENT
@ -46,7 +37,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// WebIDL API
void GetType(nsString& aType)

View File

@ -30,18 +30,8 @@ HTMLLabelElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aScope)
// nsISupports
NS_IMPL_ADDREF_INHERITED(HTMLLabelElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLLabelElement, Element)
// QueryInterface implementation for HTMLLabelElement
NS_INTERFACE_TABLE_HEAD(HTMLLabelElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLLabelElement,
nsIDOMHTMLLabelElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLLabelElement, nsGenericHTMLFormElement,
nsIDOMHTMLLabelElement)
// nsIDOMHTMLLabelElement
@ -56,7 +46,7 @@ HTMLLabelElement::GetForm(nsIDOMHTMLFormElement** aForm)
NS_IMETHODIMP
HTMLLabelElement::GetControl(nsIDOMHTMLElement** aElement)
{
nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(GetLabeledElement());
nsCOMPtr<nsIDOMHTMLElement> element = do_QueryObject(GetLabeledElement());
element.forget(aElement);
return NS_OK;
}
@ -84,7 +74,7 @@ HTMLLabelElement::Focus(ErrorResult& aError)
// retarget the focus method at the for content
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(GetLabeledElement());
nsCOMPtr<nsIDOMElement> elem = do_QueryObject(GetLabeledElement());
if (elem)
fm->SetFocus(elem, 0);
}

View File

@ -32,18 +32,9 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLLabelElement
NS_DECL_NSIDOMHTMLLABELELEMENT
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
using nsGenericHTMLFormElement::GetForm;
void GetHtmlFor(nsString& aHtmlFor)
{
@ -58,6 +49,7 @@ public:
return GetLabeledElement();
}
using nsGenericHTMLElement::Focus;
virtual void Focus(mozilla::ErrorResult& aError) MOZ_OVERRIDE;
// nsIFormControl
@ -73,8 +65,6 @@ public:
bool aIsTrustedEvent) MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
nsGenericHTMLElement* GetLabeledElement() const;
protected:
virtual JSObject* WrapNode(JSContext *aCx,

View File

@ -19,17 +19,6 @@ HTMLLegendElement::~HTMLLegendElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLLegendElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLLegendElement, Element)
// QueryInterface implementation for HTMLLegendElement
NS_INTERFACE_MAP_BEGIN(HTMLLegendElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLLegendElement)
// this contains center, because IE4 does

View File

@ -13,8 +13,7 @@
namespace mozilla {
namespace dom {
class HTMLLegendElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
class HTMLLegendElement MOZ_FINAL : public nsGenericHTMLElement
{
public:
HTMLLegendElement(already_AddRefed<nsINodeInfo> aNodeInfo)
@ -25,18 +24,7 @@ public:
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLegendElement, legend)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
using nsGenericHTMLElement::Focus;
virtual void Focus(ErrorResult& aError) MOZ_OVERRIDE;
virtual void PerformAccesskey(bool aKeyCausesActivation,
@ -74,8 +62,6 @@ public:
return fieldsetControl ? fieldsetControl->GetFormElement() : nullptr;
}
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
/**
* WebIDL Interface
*/

View File

@ -15,7 +15,6 @@
#include "nsIDocument.h"
#include "nsIDOMEvent.h"
#include "nsIDOMStyleSheet.h"
#include "nsILink.h"
#include "nsIStyleSheet.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsIURL.h"
@ -58,15 +57,12 @@ NS_IMPL_RELEASE_INHERITED(HTMLLinkElement, Element)
// QueryInterface implementation for HTMLLinkElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLLinkElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED5(HTMLLinkElement,
NS_INTERFACE_TABLE_INHERITED4(HTMLLinkElement,
nsIDOMHTMLLinkElement,
nsIDOMLinkStyle,
nsILink,
nsIStyleSheetLinkingElement,
Link)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
@ -149,18 +145,16 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
return rv;
}
NS_IMETHODIMP
void
HTMLLinkElement::LinkAdded()
{
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkAdded"));
return NS_OK;
}
NS_IMETHODIMP
void
HTMLLinkElement::LinkRemoved()
{
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkRemoved"));
return NS_OK;
}
void

View File

@ -10,7 +10,6 @@
#include "mozilla/dom/Link.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsILink.h"
#include "nsStyleLinkElement.h"
namespace mozilla {
@ -18,7 +17,6 @@ namespace dom {
class HTMLLinkElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLLinkElement,
public nsILink,
public nsStyleLinkElement,
public Link
{
@ -33,24 +31,14 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLLinkElement,
nsGenericHTMLElement)
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLLinkElement
NS_DECL_NSIDOMHTMLLINKELEMENT
// DOM memory reporter participant
NS_DECL_SIZEOF_EXCLUDING_THIS
// nsILink
NS_IMETHOD LinkAdded() MOZ_OVERRIDE;
NS_IMETHOD LinkRemoved() MOZ_OVERRIDE;
void LinkAdded();
void LinkRemoved();
// nsIDOMEventTarget
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
@ -58,7 +46,6 @@ public:
// nsINode
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

View File

@ -33,10 +33,8 @@ NS_IMPL_RELEASE_INHERITED(HTMLMapElement, Element)
// QueryInterface implementation for HTMLMapElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLMapElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLMapElement, nsIDOMHTMLMapElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLMapElement)

View File

@ -26,15 +26,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMapElement
NS_DECL_NSIDOMHTMLMAPELEMENT
@ -43,8 +34,6 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLMapElement,
nsGenericHTMLElement)
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// XPCOM GetName is fine.
void SetName(const nsAString& aName, ErrorResult& aError)
{

View File

@ -50,19 +50,8 @@ HTMLMenuElement::~HTMLMenuElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLMenuElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLMenuElement, Element)
// QueryInterface implementation for HTMLMenuElement
NS_INTERFACE_TABLE_HEAD(HTMLMenuElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED2(HTMLMenuElement,
nsIDOMHTMLMenuElement,
nsIHTMLMenu)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED2(HTMLMenuElement, nsGenericHTMLElement,
nsIDOMHTMLMenuElement, nsIHTMLMenu)
NS_IMPL_ELEMENT_CLONE(HTMLMenuElement)

View File

@ -27,15 +27,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMenuElement
NS_DECL_NSIDOMHTMLMENUELEMENT
@ -49,8 +40,6 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
uint8_t GetType() const { return mType; }
// WebIDL

View File

@ -169,17 +169,8 @@ HTMLMenuItemElement::~HTMLMenuItemElement()
}
NS_IMPL_ADDREF_INHERITED(HTMLMenuItemElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLMenuItemElement, Element)
// QueryInterface implementation for HTMLMenuItemElement
NS_INTERFACE_TABLE_HEAD(HTMLMenuItemElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLMenuItemElement,
nsIDOMHTMLMenuItemElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLMenuItemElement, nsGenericHTMLElement,
nsIDOMHTMLMenuItemElement)
//NS_IMPL_ELEMENT_CLONE(HTMLMenuItemElement)
nsresult

View File

@ -30,15 +30,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMenuItemElement
NS_DECL_NSIDOMHTMLMENUITEMELEMENT
@ -58,8 +49,6 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
uint8_t GetType() const { return mType; }
/**

View File

@ -24,17 +24,8 @@ HTMLMetaElement::~HTMLMetaElement()
}
NS_IMPL_ADDREF_INHERITED(HTMLMetaElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLMetaElement, Element)
// QueryInterface implementation for HTMLMetaElement
NS_INTERFACE_TABLE_HEAD(HTMLMetaElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLMetaElement, nsIDOMHTMLMetaElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS_INHERITED1(HTMLMetaElement, nsGenericHTMLElement,
nsIDOMHTMLMetaElement)
NS_IMPL_ELEMENT_CLONE(HTMLMetaElement)

View File

@ -23,15 +23,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLMetaElement
NS_DECL_NSIDOMHTMLMETAELEMENT
@ -44,8 +35,6 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// XPCOM GetName is fine.
void SetName(const nsAString& aName, ErrorResult& aRv)
{

View File

@ -25,17 +25,8 @@ HTMLMeterElement::~HTMLMeterElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLMeterElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLMeterElement, Element)
NS_INTERFACE_MAP_BEGIN(HTMLMeterElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLMeterElement)
nsEventStates
HTMLMeterElement::IntrinsicState() const
{

View File

@ -17,25 +17,12 @@
namespace mozilla {
namespace dom {
class HTMLMeterElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLElement
class HTMLMeterElement MOZ_FINAL : public nsGenericHTMLElement
{
public:
HTMLMeterElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLMeterElement();
/* nsISupports */
NS_DECL_ISUPPORTS_INHERITED
/* nsIDOMNode */
NS_FORWARD_NSIDOMNODE_TO_NSINODE
/* nsIDOMElement */
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
/* nsIDOMHTMLElement */
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
@ -43,8 +30,6 @@ public:
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE;
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
// WebIDL
/* @return the value */

View File

@ -21,16 +21,6 @@ HTMLModElement::~HTMLModElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLModElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLModElement, Element)
// QueryInterface implementation for HTMLModElement
NS_INTERFACE_MAP_BEGIN(HTMLModElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLModElement)
JSObject*

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