Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2178)

Unified Diff: Source/devtools/front_end/sdk/DOMModel.js

Issue 720793003: DevTools: Replace visibleChildrenCount with hasVisibleChildren in ElementsTreeOutline. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/elements/ElementsTreeOutline.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/DOMModel.js
diff --git a/Source/devtools/front_end/sdk/DOMModel.js b/Source/devtools/front_end/sdk/DOMModel.js
index d6de3a453eef6d2c75a44f09cdd7e160cd741eea..374f748743711322c2429b8f4118e907b819d216 100644
--- a/Source/devtools/front_end/sdk/DOMModel.js
+++ b/Source/devtools/front_end/sdk/DOMModel.js
@@ -229,11 +229,11 @@ WebInspector.DOMNode.prototype = {
*/
hasPseudoElements: function()
{
- return Object.keys(this._pseudoElements).length !== 0;
+ return this._pseudoElements.size > 0;
},
/**
- * @return {!Object.<string, !WebInspector.DOMNode>}
+ * @return {!Map<string, !WebInspector.DOMNode>}
*/
pseudoElements: function()
{
@@ -241,6 +241,26 @@ WebInspector.DOMNode.prototype = {
},
/**
+ * @return {?WebInspector.DOMNode}
+ */
+ beforePseudoElement: function()
+ {
+ if (!this._pseudoElements)
+ return null;
+ return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementNames.Before);
+ },
+
+ /**
+ * @return {?WebInspector.DOMNode}
+ */
+ afterPseudoElement: function()
+ {
+ if (!this._pseudoElements)
+ return null;
+ return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementNames.After);
+ },
+
+ /**
* @return {boolean}
*/
isInShadowTree: function()
@@ -603,7 +623,7 @@ WebInspector.DOMNode.prototype = {
_removeChild: function(node)
{
if (node.pseudoType()) {
- delete this._pseudoElements[node.pseudoType()];
+ this._pseudoElements.delete(node.pseudoType());
} else {
var shadowRootIndex = this._shadowRoots.indexOf(node);
if (shadowRootIndex !== -1)
@@ -639,14 +659,14 @@ WebInspector.DOMNode.prototype = {
*/
_setPseudoElements: function(payloads)
{
- this._pseudoElements = {};
+ this._pseudoElements = new Map();
if (!payloads)
return;
for (var i = 0; i < payloads.length; ++i) {
var node = new WebInspector.DOMNode(this._domModel, this.ownerDocument, this._isInShadowTree, payloads[i]);
node.parentNode = this;
- this._pseudoElements[node.pseudoType()] = node;
+ this._pseudoElements.set(node.pseudoType(), node);
}
},
@@ -1320,8 +1340,8 @@ WebInspector.DOMModel.prototype = {
var node = new WebInspector.DOMNode(this, parent.ownerDocument, false, pseudoElement);
node.parentNode = parent;
this._idToDOMNode[node.id] = node;
- console.assert(!parent._pseudoElements[node.pseudoType()]);
- parent._pseudoElements[node.pseudoType()] = node;
+ console.assert(!parent._pseudoElements.get(node.pseudoType()));
+ parent._pseudoElements.set(node.pseudoType(), node);
this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted, node);
},
@@ -1353,8 +1373,8 @@ WebInspector.DOMModel.prototype = {
for (var i = 0; i < node._shadowRoots.length; ++i)
this._unbind(node._shadowRoots[i]);
var pseudoElements = node.pseudoElements();
- for (var id in pseudoElements)
- this._unbind(pseudoElements[id]);
+ for (var pseudoType of pseudoElements.keys())
+ this._unbind(pseudoElements.get(pseudoType));
if (node._templateContent)
this._unbind(node._templateContent);
},
« no previous file with comments | « Source/devtools/front_end/elements/ElementsTreeOutline.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698