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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/Dialog.js

Issue 1938053002: DevTools: brush up command menu looks, render badges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/ui/Dialog.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
index fb24054e2b1d37c9310d8bb171060efd496cb07c..dda2f68041abcedc3f5136dfc8828851b4b2f6b5 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
@@ -105,6 +105,16 @@ WebInspector.Dialog.prototype = {
},
/**
+ * @param {number=} positionX
+ * @param {number=} positionY
+ */
+ setPosition: function(positionX, positionY)
+ {
+ this._defaultPositionX = positionX;
+ this._defaultPositionY = positionY;
+ },
+
+ /**
* @param {!Size} size
*/
setMaxSize: function(size)
@@ -194,11 +204,21 @@ WebInspector.Dialog.prototype = {
height = Math.min(height, this._maxSize.height);
}
- var positionX = (container.offsetWidth - width) / 2;
- positionX = Number.constrain(positionX, 0, container.offsetWidth - width);
+ var positionX;
+ if (typeof this._defaultPositionX === "number") {
+ positionX = this._defaultPositionX;
+ } else {
+ positionX = (container.offsetWidth - width) / 2;
+ positionX = Number.constrain(positionX, 0, container.offsetWidth - width);
+ }
- var positionY = (container.offsetHeight - height) / 2;
- positionY = Number.constrain(positionY, 0, container.offsetHeight - height);
+ var positionY;
+ if (typeof this._defaultPositionY === "number") {
+ positionY = this._defaultPositionY;
+ } else {
+ positionY = (container.offsetHeight - height) / 2;
+ positionY = Number.constrain(positionY, 0, container.offsetHeight - height);
+ }
this.element.style.width = width + "px";
this.element.style.height = height + "px";

Powered by Google App Engine
This is Rietveld 408576698