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

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

Issue 1310863003: Devtools UI: Tooltip needs to consider tooltip height in placing tooltip (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!Document} doc 7 * @param {!Document} doc
8 */ 8 */
9 WebInspector.Tooltip = function(doc) 9 WebInspector.Tooltip = function(doc)
10 { 10 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 var anchorBox = this._anchorElement.boxInWindow(this.element.window()); 94 var anchorBox = this._anchorElement.boxInWindow(this.element.window());
95 const anchorOffset = 2; 95 const anchorOffset = 2;
96 const pageMargin = 2; 96 const pageMargin = 2;
97 this._tooltipElement.style.maxWidth = (containerOffsetWidth - pageMargin * 2) + "px"; 97 this._tooltipElement.style.maxWidth = (containerOffsetWidth - pageMargin * 2) + "px";
98 var tooltipWidth = this._tooltipElement.offsetWidth; 98 var tooltipWidth = this._tooltipElement.offsetWidth;
99 var tooltipHeight = this._tooltipElement.offsetHeight; 99 var tooltipHeight = this._tooltipElement.offsetHeight;
100 var tooltipX = anchorBox.x; 100 var tooltipX = anchorBox.x;
101 tooltipX = Number.constrain(tooltipX, 101 tooltipX = Number.constrain(tooltipX,
102 containerOffset.x + pageMargin, 102 containerOffset.x + pageMargin,
103 containerOffset.x + containerOffsetWidth - tooltipWidth - pageMargin ); 103 containerOffset.x + containerOffsetWidth - tooltipWidth - pageMargin );
104 var onBottom = anchorBox.y + anchorOffset + anchorBox.height < container Offset.y + containerOffsetHeight; 104 var onBottom = anchorBox.y + anchorOffset + anchorBox.height + tooltipHe ight < containerOffset.y + containerOffsetHeight;
105 var tooltipY = onBottom ? anchorBox.y + anchorBox.height + anchorOffset : anchorBox.y - tooltipHeight - anchorOffset; 105 var tooltipY = onBottom ? anchorBox.y + anchorBox.height + anchorOffset : anchorBox.y - tooltipHeight - anchorOffset;
106 this._tooltipElement.positionAt(tooltipX, tooltipY); 106 this._tooltipElement.positionAt(tooltipX, tooltipY);
107 }, 107 },
108 108
109 _hide: function() 109 _hide: function()
110 { 110 {
111 delete this._anchorElement; 111 delete this._anchorElement;
112 this._tooltipElement.classList.remove("shown"); 112 this._tooltipElement.classList.remove("shown");
113 if (Date.now() > this._tooltipLastOpened) 113 if (Date.now() > this._tooltipLastOpened)
114 this._tooltipLastClosed = Date.now(); 114 this._tooltipLastClosed = Date.now();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 /** 153 /**
154 * @param {!Element|string} x 154 * @param {!Element|string} x
155 * @this {!Element} 155 * @this {!Element}
156 */ 156 */
157 set: function(x) 157 set: function(x)
158 { 158 {
159 WebInspector.Tooltip.install(this, x); 159 WebInspector.Tooltip.install(this, x);
160 } 160 }
161 }); 161 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698