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

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

Issue 2771413006: Revert of [DevTools] Migrate SoftContextMenu to use GlassPane (Closed)
Patch Set: Created 3 years, 9 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/GlassPane.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
index 831020febb1ea1fd6b2f977786e205be74dfe925..7d8f5f0ad554d370e0ab11d24b3f74c329443b74 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
@@ -26,7 +26,7 @@
this._anchorBox = null;
this._anchorBehavior = UI.GlassPane.AnchorBehavior.PreferTop;
this._sizeBehavior = UI.GlassPane.SizeBehavior.SetExactSize;
- this._marginBehavior = UI.GlassPane.MarginBehavior.DefaultMargin;
+ this._showArrow = false;
}
/**
@@ -108,11 +108,11 @@
}
/**
- * @param {boolean} behavior
- */
- setMarginBehavior(behavior) {
- this._marginBehavior = behavior;
- this._arrowElement.classList.toggle('hidden', behavior !== UI.GlassPane.MarginBehavior.Arrow);
+ * @param {boolean} showArrow
+ */
+ setShowArrow(showArrow) {
+ this._showArrow = showArrow;
+ this._arrowElement.classList.toggle('hidden', !showArrow);
}
/**
@@ -123,7 +123,7 @@
return;
// Deliberately starts with 3000 to hide other z-indexed elements below.
this.element.style.zIndex = 3000 + 1000 * UI.GlassPane._panes.size;
- document.body.addEventListener('click', this._onMouseDownBound, true);
+ document.body.addEventListener('mousedown', this._onMouseDownBound, true);
this._widget.show(document.body);
UI.GlassPane._panes.add(this);
this._positionContent();
@@ -133,7 +133,7 @@
if (!this.isShowing())
return;
UI.GlassPane._panes.delete(this);
- this.element.ownerDocument.body.removeEventListener('click', this._onMouseDownBound, true);
+ this.element.ownerDocument.body.removeEventListener('mousedown', this._onMouseDownBound, true);
this._widget.detach();
}
@@ -152,8 +152,7 @@
if (!this.isShowing())
return;
- var showArrow = this._marginBehavior === UI.GlassPane.MarginBehavior.Arrow;
- var gutterSize = showArrow ? 8 : (this._marginBehavior === UI.GlassPane.MarginBehavior.NoMargin ? 0 : 3);
+ var gutterSize = this._showArrow ? 8 : 3;
var scrollbarSize = 14;
var arrowSize = 10;
@@ -241,7 +240,7 @@
positionX = Math.max(gutterSize, Math.min(anchorBox.x, containerWidth - width - gutterSize));
if (!enoughHeight)
positionX += arrowSize;
- else if (showArrow && positionX - arrowSize >= gutterSize)
+ else if (this._showArrow && positionX - arrowSize >= gutterSize)
positionX -= arrowSize;
width = Math.min(width, containerWidth - positionX - gutterSize);
if (2 * arrowSize >= width) {
@@ -299,7 +298,7 @@
positionY = Math.max(gutterSize, Math.min(anchorBox.y, containerHeight - height - gutterSize));
if (!enoughWidth)
positionY += arrowSize;
- else if (showArrow && positionY - arrowSize >= gutterSize)
+ else if (this._showArrow && positionY - arrowSize >= gutterSize)
positionY -= arrowSize;
height = Math.min(height, containerHeight - positionY - gutterSize);
if (2 * arrowSize >= height) {
@@ -382,15 +381,6 @@
MeasureContent: Symbol('MeasureContent')
};
-/**
- * @enum {symbol}
- */
-UI.GlassPane.MarginBehavior = {
- Arrow: Symbol('Arrow'),
- DefaultMargin: Symbol('DefaultMargin'),
- NoMargin: Symbol('NoMargin')
-};
-
/** @type {!Map<!Document, !Element>} */
UI.GlassPane._containers = new Map();
/** @type {!Set<!UI.GlassPane>} */

Powered by Google App Engine
This is Rietveld 408576698