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

Unified Diff: Source/devtools/front_end/elements/MetricsSidebarPane.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months 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
Index: Source/devtools/front_end/elements/MetricsSidebarPane.js
diff --git a/Source/devtools/front_end/elements/MetricsSidebarPane.js b/Source/devtools/front_end/elements/MetricsSidebarPane.js
index aac2c21fbe2b3af379cb4ddac7a9b2c71692fa8a..b726f4394eafaaab5b012f7ebc6eff84a7cd0807 100644
--- a/Source/devtools/front_end/elements/MetricsSidebarPane.js
+++ b/Source/devtools/front_end/elements/MetricsSidebarPane.js
@@ -192,7 +192,7 @@ WebInspector.MetricsSidebarPane.prototype = {
_updateMetrics: function(style)
{
// Updating with computed style.
- var metricsElement = document.createElement("div");
+ var metricsElement = createElement("div");
metricsElement.className = "metrics";
var self = this;
@@ -214,7 +214,7 @@ WebInspector.MetricsSidebarPane.prototype = {
value = value.replace(/px$/, "");
value = Number.toFixedIfFloating(value);
- var element = document.createElement("div");
+ var element = createElement("div");
element.className = side;
element.textContent = value;
element.addEventListener("dblclick", this.startEditing.bind(this, element, name, propertyName, style), false);
@@ -294,7 +294,7 @@ WebInspector.MetricsSidebarPane.prototype = {
if (name === "position" && noPositionType[style.getPropertyValue("position")])
continue;
- var boxElement = document.createElement("div");
+ var boxElement = createElement("div");
boxElement.className = name;
boxElement._backgroundColor = boxColors[i].toString(WebInspector.Color.Format.RGBA);
boxElement._name = name;
@@ -303,11 +303,11 @@ WebInspector.MetricsSidebarPane.prototype = {
this._boxElements.push(boxElement);
if (name === "content") {
- var widthElement = document.createElement("span");
+ var widthElement = createElement("span");
widthElement.textContent = getContentAreaWidthPx(style);
widthElement.addEventListener("dblclick", this.startEditing.bind(this, widthElement, "width", "width", style), false);
- var heightElement = document.createElement("span");
+ var heightElement = createElement("span");
heightElement.textContent = getContentAreaHeightPx(style);
heightElement.addEventListener("dblclick", this.startEditing.bind(this, heightElement, "height", "height", style), false);
@@ -317,20 +317,20 @@ WebInspector.MetricsSidebarPane.prototype = {
} else {
var suffix = (name === "border" ? "-width" : "");
- var labelElement = document.createElement("div");
+ var labelElement = createElement("div");
labelElement.className = "label";
labelElement.textContent = boxLabels[i];
boxElement.appendChild(labelElement);
boxElement.appendChild(createBoxPartElement.call(this, style, name, "top", suffix));
- boxElement.appendChild(document.createElement("br"));
+ boxElement.appendChild(createElement("br"));
boxElement.appendChild(createBoxPartElement.call(this, style, name, "left", suffix));
if (previousBox)
boxElement.appendChild(previousBox);
boxElement.appendChild(createBoxPartElement.call(this, style, name, "right", suffix));
- boxElement.appendChild(document.createElement("br"));
+ boxElement.appendChild(createElement("br"));
boxElement.appendChild(createBoxPartElement.call(this, style, name, "bottom", suffix));
}

Powered by Google App Engine
This is Rietveld 408576698