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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/Tooltip.js

Issue 2658383002: [DevTools] Make UI.GlassPane position contentElement for different overlay controls. (Closed)
Patch Set: less layouts Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 UI.Tooltip = class { 7 UI.Tooltip = class {
8 /** 8 /**
9 * @param {!Document} doc 9 * @param {!Document} doc
10 */ 10 */
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Reposition to ensure text doesn't overflow unnecessarily. 106 // Reposition to ensure text doesn't overflow unnecessarily.
107 this._tooltipElement.positionAt(0, 0); 107 this._tooltipElement.positionAt(0, 0);
108 108
109 // Show tooltip instantly if a tooltip was shown recently. 109 // Show tooltip instantly if a tooltip was shown recently.
110 var now = Date.now(); 110 var now = Date.now();
111 var instant = (this._tooltipLastClosed && now - this._tooltipLastClosed < UI .Tooltip.Timing.InstantThreshold); 111 var instant = (this._tooltipLastClosed && now - this._tooltipLastClosed < UI .Tooltip.Timing.InstantThreshold);
112 this._tooltipElement.classList.toggle('instant', instant); 112 this._tooltipElement.classList.toggle('instant', instant);
113 this._tooltipLastOpened = instant ? now : now + UI.Tooltip.Timing.OpeningDel ay; 113 this._tooltipLastOpened = instant ? now : now + UI.Tooltip.Timing.OpeningDel ay;
114 114
115 // Get container element. 115 // Get container element.
116 var container = UI.Dialog.modalHostView().element; 116 var container = UI.ModalOverlay.rootElement();
117 if (!anchorElement.isDescendant(container)) 117 if (!anchorElement.isDescendant(container))
118 container = this.element.parentElement; 118 container = this.element.parentElement;
119 119
120 // Posititon tooltip based on the anchor element. 120 // Posititon tooltip based on the anchor element.
121 var containerBox = container.boxInWindow(this.element.window()); 121 var containerBox = container.boxInWindow(this.element.window());
122 var anchorBox = this._anchorElement.boxInWindow(this.element.window()); 122 var anchorBox = this._anchorElement.boxInWindow(this.element.window());
123 const anchorOffset = 2; 123 const anchorOffset = 2;
124 const pageMargin = 2; 124 const pageMargin = 2;
125 var cursorOffset = 10; 125 var cursorOffset = 10;
126 this._tooltipElement.classList.toggle('tooltip-breakword', !this._tooltipEle ment.textContent.match('\\s')); 126 this._tooltipElement.classList.toggle('tooltip-breakword', !this._tooltipEle ment.textContent.match('\\s'));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 }, 191 },
192 192
193 /** 193 /**
194 * @param {!Element|string} x 194 * @param {!Element|string} x
195 * @this {!Element} 195 * @this {!Element}
196 */ 196 */
197 set: function(x) { 197 set: function(x) {
198 UI.Tooltip.install(this, x); 198 UI.Tooltip.install(this, x);
199 } 199 }
200 }); 200 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698