mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 429732 - speed up highlighting by optimizing _getEditableNode. r=ehsan
This commit is contained in:
parent
eb28461a73
commit
17d1005769
@ -613,19 +613,18 @@ Finder.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For a given node, walk up it's parent chain, to try and find an
|
* For a given node returns its editable parent or null if there is none.
|
||||||
* editable node.
|
* It's enough to check if aNode is a text node and its parent's parent is
|
||||||
|
* instance of nsIDOMNSEditableElement.
|
||||||
*
|
*
|
||||||
* @param aNode the node we want to check
|
* @param aNode the node we want to check
|
||||||
* @returns the first node in the parent chain that is editable,
|
* @returns the first node in the parent chain that is editable,
|
||||||
* null if there is no such node
|
* null if there is no such node
|
||||||
*/
|
*/
|
||||||
_getEditableNode: function (aNode) {
|
_getEditableNode: function (aNode) {
|
||||||
while (aNode) {
|
if (aNode.nodeType === aNode.TEXT_NODE && aNode.parentNode && aNode.parentNode.parentNode &&
|
||||||
if (aNode instanceof Ci.nsIDOMNSEditableElement)
|
aNode.parentNode.parentNode instanceof Ci.nsIDOMNSEditableElement) {
|
||||||
return aNode.editor ? aNode : null;
|
return aNode.parentNode.parentNode;
|
||||||
|
|
||||||
aNode = aNode.parentNode;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user