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

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

Issue 2658383002: [DevTools] Make UI.GlassPane position contentElement for different overlay controls. (Closed)
Patch Set: rebased Created 3 years, 11 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/SoftContextMenu.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
index 2081f9956cd9d28ed7f9812ebcd43d2f16a6a8f6..ed7e23c7ecc07bd721a80cdc1aac1b16500897fd 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
@@ -82,8 +82,9 @@ UI.SoftContextMenu = class {
}
// Re-position menu in case it does not fit.
- var hostLeft = UI.Dialog.modalHostView().element.totalOffsetLeft();
- var hostRight = hostLeft + UI.Dialog.modalHostView().element.offsetWidth;
+ var containerElement = UI.GlassPane.container(document);
+ var hostLeft = containerElement.totalOffsetLeft();
+ var hostRight = hostLeft + containerElement.offsetWidth;
if (hostRight < this.element.offsetLeft + this.element.offsetWidth) {
var left = this._parentMenu ? this._parentMenu.element.offsetLeft - this.element.offsetWidth + subMenuOverlap :
hostRight - this.element.offsetWidth;
@@ -92,13 +93,12 @@ UI.SoftContextMenu = class {
// Move submenus upwards if it does not fit.
if (this._parentMenu && document.body.offsetHeight < this.element.offsetTop + this.element.offsetHeight) {
- y = Math.max(
- UI.Dialog.modalHostView().element.totalOffsetTop(), document.body.offsetHeight - this.element.offsetHeight);
+ y = Math.max(containerElement.totalOffsetTop(), document.body.offsetHeight - this.element.offsetHeight);
this.element.style.top = y + 'px';
}
- var maxHeight = UI.Dialog.modalHostView().element.offsetHeight;
- maxHeight -= y - UI.Dialog.modalHostView().element.totalOffsetTop();
+ var maxHeight = containerElement.offsetHeight;
+ maxHeight -= y - containerElement.totalOffsetTop();
this.element.style.maxHeight = maxHeight + 'px';
this._focus();

Powered by Google App Engine
This is Rietveld 408576698