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

Unified Diff: Source/devtools/front_end/Layers3DView.js

Issue 166273018: Added showing slow scroll rectangles in Layers panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixes. Created 6 years, 10 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/Layers3DView.js
diff --git a/Source/devtools/front_end/Layers3DView.js b/Source/devtools/front_end/Layers3DView.js
index 0ba03ccf3652e9198f5530eba4362e9a849770e6..3028c747ad91c12c26f3149e6874b7f0dc1b1002 100644
--- a/Source/devtools/front_end/Layers3DView.js
+++ b/Source/devtools/front_end/Layers3DView.js
@@ -50,6 +50,7 @@ WebInspector.Layers3DView = function(model)
this.element.addEventListener("dblclick", this._onDoubleClick.bind(this), false);
this.element.addEventListener("click", this._onClick.bind(this), false);
this._elementsByLayerId = {};
+ this._scrollRectElementsByLayerId = {}
this._rotateX = 0;
this._rotateY = 0;
this._scaleAdjustmentStylesheet = this.element.ownerDocument.head.createChild("style");
@@ -82,6 +83,15 @@ WebInspector.Layers3DView.PaintRectColors = [
WebInspector.Color.fromRGBA([0, 0xFF, 0, 0x3F])
]
+/**
+ * @enum {string}
+ */
+WebInspector.Layers3DView.ScrollRectTitles = {
+ RepaintsOnScroll: WebInspector.UIString("repaints on scroll"),
+ TouchEventHandler: WebInspector.UIString("touch event listener"),
+ WheelEventHandler: WebInspector.UIString("mousewheel event listener")
+}
+
WebInspector.Layers3DView.prototype = {
onResize: function()
{
@@ -181,6 +191,65 @@ WebInspector.Layers3DView.prototype = {
element.style.top = ((this._clientHeight - root.height() * this._scale) >> 1) + "px";
},
+ /**
+ * @param {!Element} element
+ */
+ _removeElement: function(element)
+ {
+ element.remove()
+ },
+
+ /**
+ * @param {!string} layerId
+ */
+ _removeScrollRects: function(layerId)
+ {
+ this._scrollRectElementsByLayerId[layerId].forEach(this._removeElement);
+ delete this._scrollRectElementsByLayerId[layerId];
+ },
+
+ /**
+ * @param {!LayerTreeAgent.ScrollRect} scrollRect
+ * @param {!WebInspector.Layer} layer
+ * @return {!Element}
+ */
+ _createScrollRectElement: function(scrollRect, layer)
+ {
+ var element = document.createElement("div");
+ var style = element.style;
+ var parentLayerId = layer.nodeId() ? layer.id() : this._model.contentRoot().id();
+ var parentLayerElement = this._elementsByLayerId[parentLayerId];
+ element.className = "scroll-rect";
+ element.title = WebInspector.Layers3DView.ScrollRectTitles[scrollRect.type];
+ style.width = scrollRect.rect.width + "px";
+ style.height = scrollRect.rect.height + "px";
+ style.left = scrollRect.rect.x + "px";
+ style.top = scrollRect.rect.y + "px";
+ parentLayerElement.appendChild(element);
+ element.__scrollRect = scrollRect;
+ return element;
+ },
+
+ /**
+ * @param {!WebInspector.Layer} layer
+ */
+ _updateScrollRectsForLayer: function(layer)
+ {
+ if (!this._scrollRectElementsByLayerId[layer.id()])
+ this._scrollRectElementsByLayerId[layer.id()] = [];
+ var newScrollRects = layer.scrollRects(),
+ scrollRectElements = this._scrollRectElementsByLayerId[layer.id()];
+ for (var i = 0; i < newScrollRects.length; ++i) {
+ if (i >= scrollRectElements.length) {
+ scrollRectElements.push(this._createScrollRectElement(newScrollRects[i], layer));
+ } else if (newScrollRects[i] != scrollRectElements[i].__scrollRect) {
+ scrollRectElements[i].remove();
+ scrollRectElements[i] = this._createScrollRectElement(newScrollRects[i], layer);
+ }
+ }
+ scrollRectElements.splice(newScrollRects.length).forEach(this._removeElement);
+ },
+
_update: function()
{
if (!this.isShowing()) {
@@ -208,9 +277,11 @@ WebInspector.Layers3DView.prototype = {
continue;
this._elementsByLayerId[layerId].remove();
delete this._elementsByLayerId[layerId];
+ this._removeScrollRects(layerId);
}
this._scaleToFit();
this._model.forEachLayer(updateLayer.bind(this), this._model.contentRoot());
+ this._model.forEachLayer(this._updateScrollRectsForLayer.bind(this));
this._needsUpdate = false;
},
@@ -284,6 +355,9 @@ WebInspector.Layers3DView.prototype = {
}
},
+ /**
+ * @param {!Element} element
+ */
_updatePaintRect: function(element)
{
var details = element.__layerDetails;

Powered by Google App Engine
This is Rietveld 408576698