summaryrefslogtreecommitdiffstats
path: root/WebCore/page/inspector/utilities.js
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/inspector/utilities.js')
-rw-r--r--WebCore/page/inspector/utilities.js42
1 files changed, 18 insertions, 24 deletions
diff --git a/WebCore/page/inspector/utilities.js b/WebCore/page/inspector/utilities.js
index 47d721f..a92fe4d 100644
--- a/WebCore/page/inspector/utilities.js
+++ b/WebCore/page/inspector/utilities.js
@@ -123,6 +123,24 @@ Element.prototype.hasStyleClass = function(className)
return regex.test(this.className);
}
+Element.prototype.scrollToElement = function(element)
+{
+ if (!element || !this.isAncestor(element))
+ return;
+
+ var offsetTop = 0;
+ var current = element
+ while (current && current !== this) {
+ offsetTop += current.offsetTop;
+ current = current.offsetParent;
+ }
+
+ if (this.scrollTop > offsetTop)
+ this.scrollTop = offsetTop;
+ else if ((this.scrollTop + this.offsetHeight) < (offsetTop + element.offsetHeight))
+ this.scrollTop = offsetTop - this.offsetHeight + element.offsetHeight;
+}
+
Node.prototype.firstParentOrSelfWithNodeName = function(nodeName)
{
for (var node = this; node && (node !== document); node = node.parentNode)
@@ -407,18 +425,6 @@ function nodeDisplayName()
case Node.COMMENT_NODE:
return "<!--" + this.nodeValue + "-->";
-
- case Node.DOCUMENT_TYPE_NODE:
- var docType = "<!DOCTYPE " + this.nodeName;
- if (this.publicId) {
- docType += " PUBLIC \"" + this.publicId + "\"";
- if (this.systemId)
- docType += " \"" + this.systemId + "\"";
- } else if (this.systemId)
- docType += " SYSTEM \"" + this.systemId + "\"";
- if (this.internalSubset)
- docType += " [" + this.internalSubset + "]";
- return docType + ">";
}
return this.nodeName.toLowerCase().collapseWhitespace();
@@ -637,18 +643,6 @@ function nodeTitleInfo(hasChildren, linkify)
info.title = "<span class=\"webkit-html-comment\">&lt;!--" + this.nodeValue.escapeHTML() + "--&gt;</span>";
break;
- case Node.DOCUMENT_TYPE_NODE:
- info.title = "<span class=\"webkit-html-tag\">&lt;!DOCTYPE " + this.nodeName;
- if (this.publicId) {
- info.title += " PUBLIC \"" + this.publicId + "\"";
- if (this.systemId)
- info.title += " \"" + this.systemId + "\"";
- } else if (this.systemId)
- info.title += " SYSTEM \"" + this.systemId + "\"";
- if (this.internalSubset)
- info.title += " [" + this.internalSubset + "]";
- info.title += "&gt;</span>";
- break;
default:
info.title = this.nodeName.toLowerCase().collapseWhitespace().escapeHTML();
}