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

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

Issue 2644393002: [DevTools] Implement dock to left. (Closed)
Patch Set: 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 f647177b3f1191fd104fcc2473ba27d8a4197673..447bf9ee8954331ddfd770db19be7a25d8886d2e 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
@@ -82,13 +82,12 @@ UI.SoftContextMenu = class {
}
// Re-position menu in case it does not fit.
- if (document.body.offsetWidth < this.element.offsetLeft + this.element.offsetWidth) {
- this.element.style.left =
- Math.max(
- UI.Dialog.modalHostView().element.totalOffsetLeft(), this._parentMenu ?
- this._parentMenu.element.offsetLeft - this.element.offsetWidth + subMenuOverlap :
- document.body.offsetWidth - this.element.offsetWidth) +
- 'px';
+ var hostLeft = UI.Dialog.modalHostView().element.totalOffsetLeft();
+ var hostRight = hostLeft + UI.Dialog.modalHostView().element.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;
+ this.element.style.left = Math.max(hostLeft, left) + 'px';
}
// Move submenus upwards if it does not fit.

Powered by Google App Engine
This is Rietveld 408576698