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

Unified Diff: third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js

Issue 2861053003: DevTools: [lighthouse] Implement performance metrics filmstrip (Closed)
Patch Set: test fixed Created 3 years, 7 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: third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js b/third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js
index a3f74fce548b2d4641ab845d848af06e54db5beb..9323bf9a936ec30ea02af3aea5fcc20071b9f6d2 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/InspectedPagePlaceholder.js
@@ -1,6 +1,7 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
/**
* @unrestricted
*/
@@ -18,7 +19,7 @@ Emulation.InspectedPagePlaceholder = class extends UI.Widget {
onResize() {
if (this._updateId)
this.element.window().cancelAnimationFrame(this._updateId);
- this._updateId = this.element.window().requestAnimationFrame(this.update.bind(this));
+ this._updateId = this.element.window().requestAnimationFrame(this.update.bind(this, false));
}
restoreMinimumSize() {
@@ -42,19 +43,35 @@ Emulation.InspectedPagePlaceholder = class extends UI.Widget {
return {x: left, y: top, width: right - left, height: bottom - top};
}
- update() {
+ /**
+ * @param {boolean=} force
+ */
+ update(force) {
delete this._updateId;
var rect = this._dipPageRect();
var bounds = {
x: Math.round(rect.x),
y: Math.round(rect.y),
height: Math.max(1, Math.round(rect.height)),
- width: Math.max(1, Math.round(rect.width))
+ width: Math.max(1, Math.round(rect.width)),
};
+ if (force) {
+ // Short term fix for Lighthouse interop.
+ --bounds.height;
+ this.dispatchEventToListeners(Emulation.InspectedPagePlaceholder.Events.Update, bounds);
+ ++bounds.height;
+ }
this.dispatchEventToListeners(Emulation.InspectedPagePlaceholder.Events.Update, bounds);
}
};
+/**
+ * @return {!Emulation.InspectedPagePlaceholder}
+ */
+Emulation.InspectedPagePlaceholder.instance = function() {
+ return singleton(Emulation.InspectedPagePlaceholder);
+};
+
/** @enum {symbol} */
Emulation.InspectedPagePlaceholder.Events = {
Update: Symbol('Update')

Powered by Google App Engine
This is Rietveld 408576698