зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 286300 (Clean up HTML tags enum and related code). r/sr=jst, a=asa.
This commit is contained in:
Родитель
6c3bda1208
Коммит
555cc2a1f9
|
@ -4932,12 +4932,14 @@ function findParentNode(node, parentNode)
|
|||
node = node.parentNode;
|
||||
}
|
||||
while (node) {
|
||||
if (node.nodeType == Node.DOCUMENT_NODE) {
|
||||
return null;
|
||||
}
|
||||
var nodeName = node.localName;
|
||||
if (!nodeName)
|
||||
return null;
|
||||
nodeName = nodeName.toLowerCase();
|
||||
if (nodeName == "body" || nodeName == "html" ||
|
||||
nodeName == "#document") {
|
||||
if (nodeName == "body" || nodeName == "html") {
|
||||
return null;
|
||||
}
|
||||
if (nodeName == parentNode)
|
||||
|
|
|
@ -322,7 +322,7 @@ function gatherTextUnder ( root )
|
|||
var depth = 1;
|
||||
while ( node && depth > 0 ) {
|
||||
// See if this node is text.
|
||||
if ( node.nodeName == "#text" ) {
|
||||
if ( node.nodeType == Node.TEXT_NODE ) {
|
||||
// Add this text to our collection.
|
||||
text += " " + node.data;
|
||||
} else if ( node.nodeType == Node.ELEMENT_NODE
|
||||
|
|
|
@ -281,7 +281,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
|||
res = tableChild->GetFirstChild(getter_AddRefs(rowNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// We can encounter "__moz_text" nodes here -- must find a row
|
||||
// We can encounter textnodes here -- must find a row
|
||||
while (rowNode && !nsHTMLEditUtils::IsTableRow(rowNode))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
|
@ -300,7 +300,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
|||
}
|
||||
// Here if table child was a CAPTION or COLGROUP
|
||||
// or child of a row parent wasn't a row (bad HTML?),
|
||||
// or first child was a "__moz_text" node
|
||||
// or first child was a textnode
|
||||
// Look in next table child
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = tableChild->GetNextSibling(getter_AddRefs(nextChild));
|
||||
|
@ -330,7 +330,7 @@ nsHTMLEditor::GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode **aRowNode)
|
|||
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
|
||||
// Skip over any "__moz_text" nodes here
|
||||
// Skip over any textnodes here
|
||||
while (nextRow && !nsHTMLEditUtils::IsTableRow(nextRow))
|
||||
{
|
||||
res = nextRow->GetNextSibling(getter_AddRefs(nextNode));
|
||||
|
@ -360,7 +360,7 @@ nsHTMLEditor::GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode **aRowNode)
|
|||
res = parentSibling->GetFirstChild(getter_AddRefs(nextRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// We can encounter "__moz_text" nodes here -- must find a row
|
||||
// We can encounter textnodes here -- must find a row
|
||||
while (nextRow && !nsHTMLEditUtils::IsTableRow(nextRow))
|
||||
{
|
||||
res = nextRow->GetNextSibling(getter_AddRefs(nextNode));
|
||||
|
@ -404,7 +404,7 @@ nsHTMLEditor::GetFirstCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode)
|
|||
|
||||
while (rowChild && !nsHTMLEditUtils::IsTableCell(rowChild))
|
||||
{
|
||||
// Skip over "__moz_text" nodes
|
||||
// Skip over textnodes
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = rowChild->GetNextSibling(getter_AddRefs(nextChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -436,7 +436,7 @@ nsHTMLEditor::GetNextCellInRow(nsIDOMNode* aCurrentCellNode, nsIDOMNode** aCellN
|
|||
|
||||
while (nextCell && !nsHTMLEditUtils::IsTableCell(nextCell))
|
||||
{
|
||||
// Skip over "__moz_text" nodes
|
||||
// Skip over textnodes
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = nextCell->GetNextSibling(getter_AddRefs(nextChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -468,7 +468,7 @@ nsHTMLEditor::GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode)
|
|||
|
||||
while (rowChild && !nsHTMLEditUtils::IsTableCell(rowChild))
|
||||
{
|
||||
// Skip over "__moz_text" nodes
|
||||
// Skip over textnodes
|
||||
nsCOMPtr<nsIDOMNode> previousChild;
|
||||
res = rowChild->GetPreviousSibling(getter_AddRefs(previousChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
|
|
@ -472,7 +472,7 @@ sampleJSTransaction.prototype = {
|
|||
|
||||
doTransaction: function()
|
||||
{
|
||||
if (this.mContainer.nodeName != "#text")
|
||||
if (this.mContainer.nodeType != Node.TEXT_NODE)
|
||||
{
|
||||
// We're not in a text node, so create one and
|
||||
// we'll just insert it at (mContainer, mOffset).
|
||||
|
|
|
@ -57,7 +57,7 @@ function DumpNodeAndChildren(node, prefix)
|
|||
dump(" id=\"" + text + "\"");
|
||||
}
|
||||
|
||||
if ( node.nodeName == "#text" )
|
||||
if ( node.nodeType == Node.TEXT_NODE )
|
||||
dump(" = \"" + node.data + "\"");
|
||||
|
||||
dump(">\n");
|
||||
|
|
|
@ -4253,6 +4253,11 @@ nsresult nsMsgCompose::TagConvertible(nsIDOMNode *node, PRInt32 *_retval)
|
|||
|
||||
*_retval = nsIMsgCompConvertible::No;
|
||||
|
||||
PRInt16 nodeType;
|
||||
rv = node->GetNodeType(&nodeType);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString element;
|
||||
rv = node->GetNodeName(element);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -4260,7 +4265,7 @@ nsresult nsMsgCompose::TagConvertible(nsIDOMNode *node, PRInt32 *_retval)
|
|||
|
||||
nsCOMPtr<nsIDOMNode> pItem;
|
||||
if (
|
||||
element.LowerCaseEqualsLiteral("#text") ||
|
||||
nodeType == nsIDOMNode::TEXT_NODE ||
|
||||
element.LowerCaseEqualsLiteral("br") ||
|
||||
element.LowerCaseEqualsLiteral("p") ||
|
||||
element.LowerCaseEqualsLiteral("pre") ||
|
||||
|
|
|
@ -609,12 +609,14 @@ function findParentNode(node, parentNode)
|
|||
node = node.parentNode;
|
||||
}
|
||||
while (node) {
|
||||
if (node.nodeType == Node.DOCUMENT_NODE) {
|
||||
return null;
|
||||
}
|
||||
var nodeName = node.localName;
|
||||
if (!nodeName)
|
||||
return null;
|
||||
nodeName = nodeName.toLowerCase();
|
||||
if (nodeName == "body" || nodeName == "html" ||
|
||||
nodeName == "#document") {
|
||||
if (nodeName == "body" || nodeName == "html") {
|
||||
return null;
|
||||
}
|
||||
if (nodeName == parentNode)
|
||||
|
|
|
@ -556,7 +556,7 @@ int CStringTester::TestLogical(){
|
|||
}
|
||||
|
||||
{
|
||||
nsString foo("__moz_text");
|
||||
nsString foo("#text");
|
||||
PRInt32 cmp=foo.Compare("pre",PR_FALSE,-1);
|
||||
cmp=cmp;
|
||||
}
|
||||
|
|
|
@ -184,12 +184,14 @@ function findParentNode(node, parentNode)
|
|||
node = node.parentNode;
|
||||
}
|
||||
while (node) {
|
||||
if (node.nodeType == Node.DOCUMENT_NODE) {
|
||||
return null;
|
||||
}
|
||||
var nodeName = node.localName;
|
||||
if (!nodeName)
|
||||
return null;
|
||||
nodeName = nodeName.toLowerCase();
|
||||
if (nodeName == "body" || nodeName == "html" ||
|
||||
nodeName == "#document") {
|
||||
if (nodeName == "body" || nodeName == "html") {
|
||||
return null;
|
||||
}
|
||||
if (nodeName == parentNode)
|
||||
|
|
|
@ -447,7 +447,7 @@ function gatherTextUnder ( root )
|
|||
var depth = 1;
|
||||
while ( node && depth > 0 ) {
|
||||
// See if this node is text.
|
||||
if ( node.nodeName == "#text" ) {
|
||||
if ( node.nodeType == Node.TEXT_NODE ) {
|
||||
// Add this text to our collection.
|
||||
text += " " + node.data;
|
||||
} else if ( node.nodeType == Node.ELEMENT_NODE
|
||||
|
|
|
@ -700,7 +700,7 @@ if (!CUST_DEBUG) {
|
|||
var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | + ";
|
||||
debug(indent.substr(indent.length - depth*2) + index +
|
||||
" " + node.nodeName);
|
||||
if (node.nodeName != "#text") {
|
||||
if (node.nodeType != Node.TEXT_NODE) {
|
||||
dump_attributes(node, depth);
|
||||
}
|
||||
var kids = node.childNodes;
|
||||
|
|
|
@ -1634,7 +1634,7 @@ if (!SB_DEBUG) {
|
|||
var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | + ";
|
||||
debug(indent.substr(indent.length - depth*2) + index +
|
||||
" " + node.nodeName);
|
||||
if (node.nodeName != "#text") {
|
||||
if (node.nodeType != Node.TEXT_NODE) {
|
||||
dump_attributes(node, depth);
|
||||
}
|
||||
var kids = node.childNodes;
|
||||
|
|
Загрузка…
Ссылка в новой задаче