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

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

Issue 2080763002: DevTools: break words while wrapping tooltips if those don't contain spaces (long paths). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | third_party/WebKit/Source/devtools/front_end/ui/tooltip.css » ('j') | 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 container = this.element.parentElement; 99 container = this.element.parentElement;
100 100
101 // Posititon tooltip based on the anchor element. 101 // Posititon tooltip based on the anchor element.
102 var containerOffset = container.offsetRelativeToWindow(this.element.wind ow()); 102 var containerOffset = container.offsetRelativeToWindow(this.element.wind ow());
103 var containerOffsetWidth = container.offsetWidth; 103 var containerOffsetWidth = container.offsetWidth;
104 var containerOffsetHeight = container.offsetHeight; 104 var containerOffsetHeight = container.offsetHeight;
105 var anchorBox = this._anchorElement.boxInWindow(this.element.window()); 105 var anchorBox = this._anchorElement.boxInWindow(this.element.window());
106 const anchorOffset = 2; 106 const anchorOffset = 2;
107 const pageMargin = 2; 107 const pageMargin = 2;
108 var cursorOffset = 10; 108 var cursorOffset = 10;
109 this._tooltipElement.classList.toggle("tooltip-breakword", !this._toolti pElement.textContent.match("\\s"));
109 this._tooltipElement.style.maxWidth = (containerOffsetWidth - pageMargin * 2) + "px"; 110 this._tooltipElement.style.maxWidth = (containerOffsetWidth - pageMargin * 2) + "px";
110 this._tooltipElement.style.maxHeight = ""; 111 this._tooltipElement.style.maxHeight = "";
111 var tooltipWidth = this._tooltipElement.offsetWidth; 112 var tooltipWidth = this._tooltipElement.offsetWidth;
112 var tooltipHeight = this._tooltipElement.offsetHeight; 113 var tooltipHeight = this._tooltipElement.offsetHeight;
113 var anchorTooltipAtElement = this._anchorElement.nodeName === "BUTTON" | | this._anchorElement.nodeName === "LABEL"; 114 var anchorTooltipAtElement = this._anchorElement.nodeName === "BUTTON" | | this._anchorElement.nodeName === "LABEL";
114 var tooltipX = anchorTooltipAtElement ? anchorBox.x : event.x + cursorOf fset; 115 var tooltipX = anchorTooltipAtElement ? anchorBox.x : event.x + cursorOf fset;
115 tooltipX = Number.constrain(tooltipX, 116 tooltipX = Number.constrain(tooltipX,
116 containerOffset.x + pageMargin, 117 containerOffset.x + pageMargin,
117 containerOffset.x + containerOffsetWidth - tooltipWidth - pageMargin ); 118 containerOffset.x + containerOffsetWidth - tooltipWidth - pageMargin );
118 var tooltipY; 119 var tooltipY;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 198
198 /** 199 /**
199 * @param {!Element|string} x 200 * @param {!Element|string} x
200 * @this {!Element} 201 * @this {!Element}
201 */ 202 */
202 set: function(x) 203 set: function(x)
203 { 204 {
204 WebInspector.Tooltip.install(this, x); 205 WebInspector.Tooltip.install(this, x);
205 } 206 }
206 }); 207 });
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/tooltip.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698