Bug 1433542 - Port bug 1418085: Remove use of nsIDOMHTMLElement. rs=bustage-fix, r=frg, f=bz

--HG--
extra : rebase_source : 665c8f17b74e72b314cee11e0bfdc0467cad7d2b
This commit is contained in:
Jorg K 2018-01-30 11:19:59 +01:00
Родитель 26ebad3a27
Коммит 1c2f7b5574
5 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -249,7 +249,8 @@ function cleanupNode(aNode, aRules, aTextModifiers)
{
for (let i = 0; i < aNode.childNodes.length; ++i) {
let node = aNode.childNodes[i];
if (node instanceof Components.interfaces.nsIDOMHTMLElement) {
if (node.nodeType == node.ELEMENT_NODE &&
node.namespaceURI == "http://www.w3.org/1999/xhtml") {
// check if node allowed
let nodeName = node.localName;
if (!(nodeName in aRules.tags)) {

Просмотреть файл

@ -206,7 +206,8 @@ function smileNode(aNode)
{
for (let i = 0; i < aNode.childNodes.length; ++i) {
let node = aNode.childNodes[i];
if (node instanceof Components.interfaces.nsIDOMHTMLElement) {
if (node.nodeType == node.ELEMENT_NODE &&
node.namespaceURI == "http://www.w3.org/1999/xhtml") {
// we are on a tag, recurse to process its children
smileNode(node);
} else if (node instanceof Components.interfaces.nsIDOMText) {

Просмотреть файл

@ -552,8 +552,10 @@ function insertHTMLForMessage(aMsg, aHTML, aDoc, aIsNext)
for (let root = result; root; root = root.nextSibling)
root._originalMsg = aMsg;
// make sure the result is an HTMLElement and not some whitespace...
while (result && !(result instanceof Ci.nsIDOMHTMLElement))
// make sure the result is an HTMLElement and not some text (whitespace)...
while (result &&
!(result.nodeType == result.ELEMENT_NODE &&
result.namespaceURI == "http://www.w3.org/1999/xhtml"))
result = result.nextSibling;
if (insert)
parent.replaceChild(documentFragment, insert);
@ -977,7 +979,8 @@ function getMessagesForRange(aRange)
return true;
// recurse through children
if (aNode instanceof Ci.nsIDOMHTMLElement) {
if (aNode.nodeType == aNode.ELEMENT_NODE &&
aNode.namespaceURI == "http://www.w3.org/1999/xhtml") {
for (let i = 0; i < aNode.childNodes.length; ++i)
if (processSubtree(aNode.childNodes[i]))
return true;
@ -987,7 +990,8 @@ function getMessagesForRange(aRange)
};
let currentNode = aRange.commonAncestorContainer;
if (currentNode instanceof Ci.nsIDOMHTMLElement) {
if (currentNode.nodeType == currentNode.ELEMENT_NODE &&
currentNode.namespaceURI == "http://www.w3.org/1999/xhtml") {
// Determine the index of the first and last children of currentNode
// that we should process.
let found = false;

Просмотреть файл

@ -153,7 +153,8 @@ typeAheadFind.prototype = {
// Don't start a find if the focus is an editable element.
var window = aEvent.currentTarget;
var element = window.document.commandDispatcher.focusedElement;
if (element instanceof Components.interfaces.nsIDOMHTMLElement &&
if (element.nodeType == element.ELEMENT_NODE &&
element.namespaceURI == "http://www.w3.org/1999/xhtml" &&
element.isContentEditable)
return true;

Просмотреть файл

@ -1433,7 +1433,8 @@ nsContextMenu.prototype = {
return true;
for (var node = this.target; node; node = node.parentNode)
if (node instanceof Components.interfaces.nsIDOMHTMLElement)
if (node.nodeType == node.ELEMENT_NODE &&
node.namespaceURI == "http://www.w3.org/1999/xhtml")
return node.isContentEditable;
return false;
},