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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/LayerViewHost.js

Issue 1463143005: DevTools: avoid layout thrashing on Layers panel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extracted reveal() change Created 5 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
Index: third_party/WebKit/Source/devtools/front_end/timeline/LayerViewHost.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/LayerViewHost.js b/third_party/WebKit/Source/devtools/front_end/timeline/LayerViewHost.js
index b6d87895e8a920c32e3c92dcec8e4d542f96095d..be790dc890f9a31a2bb849cb3633f8cbc5857ffe 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/LayerViewHost.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/LayerViewHost.js
@@ -49,6 +49,16 @@ WebInspector.LayerView.Selection.Type = {
Tile: "Tile",
}
+/**
+ * @param {?WebInspector.LayerView.Selection} a
+ * @param {?WebInspector.LayerView.Selection} b
+ * @return {boolean}
+ */
+WebInspector.LayerView.Selection.isEqual = function(a, b)
+{
+ return a && b ? a._isEqual(b) : a === b;
+}
+
WebInspector.LayerView.Selection.prototype = {
/**
* @return {!WebInspector.LayerView.Selection.Type}
@@ -70,7 +80,7 @@ WebInspector.LayerView.Selection.prototype = {
* @param {!WebInspector.LayerView.Selection} other
* @return {boolean}
*/
- isEqual: function(other)
+ _isEqual: function(other)
{
return false;
}
@@ -93,7 +103,7 @@ WebInspector.LayerView.LayerSelection.prototype = {
* @param {!WebInspector.LayerView.Selection} other
* @return {boolean}
*/
- isEqual: function(other)
+ _isEqual: function(other)
{
return other._type === WebInspector.LayerView.Selection.Type.Layer && other.layer().id() === this.layer().id();
},
@@ -119,7 +129,7 @@ WebInspector.LayerView.ScrollRectSelection.prototype = {
* @param {!WebInspector.LayerView.Selection} other
* @return {boolean}
*/
- isEqual: function(other)
+ _isEqual: function(other)
{
return other._type === WebInspector.LayerView.Selection.Type.ScrollRect &&
this.layer().id() === other.layer().id() && this.scrollRectIndex === other.scrollRectIndex;
@@ -146,7 +156,7 @@ WebInspector.LayerView.TileSelection.prototype = {
* @param {!WebInspector.LayerView.Selection} other
* @return {boolean}
*/
- isEqual: function(other)
+ _isEqual: function(other)
{
return other._type === WebInspector.LayerView.Selection.Type.Tile
&& this.layer().id() === other.layer().id() && this.traceEvent === other.traceEvent;
@@ -205,7 +215,7 @@ WebInspector.LayerViewHost.prototype = {
*/
hoverObject: function(selection)
{
- if (this._hoveredObject === selection)
+ if (WebInspector.LayerView.Selection.isEqual(this._hoveredObject, selection))
return;
this._hoveredObject = selection;
var layer = selection && selection.layer();
@@ -219,7 +229,7 @@ WebInspector.LayerViewHost.prototype = {
*/
selectObject: function(selection)
{
- if (this._selectedObject === selection)
+ if (WebInspector.LayerView.Selection.isEqual(this._selectedObject, selection))
return;
this._selectedObject = selection;
for (var view of this._views)

Powered by Google App Engine
This is Rietveld 408576698