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

Side by Side Diff: Source/core/inspector/InspectorOverlayPage.html

Issue 1286483003: Devtools UI: Update inspect element node description label UI (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase tests Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorHighlight.cpp ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 Copyright (C) 2012 Google Inc. All rights reserved. 2 Copyright (C) 2012 Google Inc. All rights reserved.
3 3
4 Redistribution and use in source and binary forms, with or without 4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions 5 modification, are permitted provided that the following conditions
6 are met: 6 are met:
7 7
8 1. Redistributions of source code must retain the above copyright 8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer. 9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright 10 2. Redistributions in binary form must reproduce the above copyright
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 /* Keep this in sync with view-source.css (.html-attribute-name) */ 145 /* Keep this in sync with view-source.css (.html-attribute-name) */
146 color: rgb(153, 69, 0); 146 color: rgb(153, 69, 0);
147 } 147 }
148 148
149 .editor-anchor { 149 .editor-anchor {
150 height: 12px; 150 height: 12px;
151 width: 12px; 151 width: 12px;
152 position: absolute; 152 position: absolute;
153 } 153 }
154 154
155
156 /* Material */
157 .hidden {
158 display: none !important;
159 }
160
161 #tooltip-container {
162 -webkit-filter: drop-shadow(0 1px 1px hsla(0, 0%, 0%, 0.1)) drop-shadow(0 0p x 1px hsla(0, 0%, 0%, 0.2));
163 }
164
165 #element-tooltip,
166 #element-tooltip-arrow {
167 position: absolute;
168 z-index: 10;
169 -webkit-user-select: none;
170 }
171
172 #element-tooltip {
173 background-color: hsl(0, 0%, 25%);
174 font-size: 11px;
175 line-height: 14px;
176 padding: 5px 6px;
177 border-radius: 2px;
178 color: white;
179 display: flex;
180 align-content: stretch;
181 box-sizing: border-box;
182 max-width: calc(100% - 4px);
183 border: 1px solid hsla(0, 0%, 0%, 0.1);
184 z-index: 1;
185 background-clip: padding-box;
186 will-change: transform;
187 text-rendering: optimizeLegibility;
188 }
189
190 #element-tooltip-arrow {
191 border: solid;
192 border-color: hsl(0, 0%, 25%) transparent;
193 border-width: 0 8px 8px 8px;
194 z-index: 2;
195 margin-top: 1px;
196 }
197
198 #element-tooltip-arrow.tooltip-arrow-top {
199 border-width: 8px 8px 0 8px;
200 margin-top: -1px;
201 }
202
203
204 #element-description {
205 flex: 1 1;
206 word-wrap: break-word;
207 }
208
209 #dimensions {
210 border-left: 1px solid hsl(0, 0%, 50%);
211 padding-left: 7px;
212 margin-left: 7px;
213 float: right;
214 flex: 0 0 auto;
215 white-space: nowrap;
216 display: flex;
217 align-items: center;
218 color: hsl(0, 0%, 85%);
219 }
220
221 #material-node-width {
222 margin-right: 2px;
223 }
224
225 #material-node-height {
226 margin-left: 2px;
227 }
228
229 #material-tag-name {
230 color: hsl(304, 77%, 70%);
231 }
232
233 #material-node-id {
234 color: hsl(27, 100%, 70%);
235 }
236
237 #material-class-name {
238 color: hsl(202, 90%, 75%);
239 }
240
241
155 </style> 242 </style>
156 <script> 243 <script>
157 const lightGridColor = "rgba(0,0,0,0.2)"; 244 const lightGridColor = "rgba(0,0,0,0.2)";
158 const darkGridColor = "rgba(0,0,0,0.7)"; 245 const darkGridColor = "rgba(0,0,0,0.7)";
159 const transparentColor = "rgba(0, 0, 0, 0)"; 246 const transparentColor = "rgba(0, 0, 0, 0)";
160 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)"; 247 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)";
161 248
162 function drawPausedInDebuggerMessage(message) 249 function drawPausedInDebuggerMessage(message)
163 { 250 {
164 window._controlsVisible = true; 251 window._controlsVisible = true;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 435
349 window.labelsCanvas = document.getElementById("labels-canvas"); 436 window.labelsCanvas = document.getElementById("labels-canvas");
350 resetLabelCanvas(); 437 resetLabelCanvas();
351 438
352 window.canvasWidth = viewportSize.width; 439 window.canvasWidth = viewportSize.width;
353 window.canvasHeight = viewportSize.height; 440 window.canvasHeight = viewportSize.height;
354 441
355 window._controlsVisible = false; 442 window._controlsVisible = false;
356 document.querySelector(".controls-line").style.visibility = "hidden"; 443 document.querySelector(".controls-line").style.visibility = "hidden";
357 document.getElementById("element-title").style.visibility = "hidden"; 444 document.getElementById("element-title").style.visibility = "hidden";
445 document.getElementById("tooltip-container").classList.add("hidden");
358 var editor = document.getElementById("editor"); 446 var editor = document.getElementById("editor");
359 editor.style.visibility = "hidden"; 447 editor.style.visibility = "hidden";
360 editor.textContent = ""; 448 editor.textContent = "";
361 document.body.classList.remove("dimmed"); 449 document.body.classList.remove("dimmed");
362 document.removeEventListener("mousemove", onGlobalMouseMove); 450 document.removeEventListener("mousemove", onGlobalMouseMove);
363 delete window.hoverableAreas; 451 delete window.hoverableAreas;
364 delete window.anchorsByType; 452 delete window.anchorsByType;
365 window._gridPainted = false; 453 window._gridPainted = false;
366 } 454 }
367 455
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 context.strokeStyle = "rgb(128, 128, 128)"; 519 context.strokeStyle = "rgb(128, 128, 128)";
432 context.stroke(); 520 context.stroke();
433 521
434 context.restore(); 522 context.restore();
435 523
436 elementTitle.style.visibility = "visible"; 524 elementTitle.style.visibility = "visible";
437 elementTitle.style.top = (boxY + 3) + "px"; 525 elementTitle.style.top = (boxY + 3) + "px";
438 elementTitle.style.left = (boxX + 3) + "px"; 526 elementTitle.style.left = (boxX + 3) + "px";
439 } 527 }
440 528
529 function _drawMaterialElementTitle(elementInfo, bounds)
530 {
531 // Reset position before measuring to ensure line-wraps are consistent.
532 var elementTitle = document.getElementById("element-tooltip");
533 elementTitle.style.top = "0";
534 elementTitle.style.left = "0";
535 document.getElementById("tooltip-container").classList.remove("hidden");
536
537 document.getElementById("material-tag-name").textContent = elementInfo.tagNa me;
538 document.getElementById("material-node-id").textContent = elementInfo.idValu e ? "#" + elementInfo.idValue : "";
539 document.getElementById("material-node-id").classList.toggle("hidden", !elem entInfo.idValue);
540 var className = elementInfo.className;
541 if (className && className.length > 50)
542 className = className.substring(0, 50) + "\u2026";
543 document.getElementById("material-class-name").textContent = className || "" ;
544 document.getElementById("material-class-name").classList.toggle("hidden", !c lassName);
545 document.getElementById("material-node-width").textContent = elementInfo.nod eWidth;
546 document.getElementById("material-node-height").textContent = elementInfo.no deHeight;
547
548 var titleWidth = elementTitle.offsetWidth;
549 var titleHeight = elementTitle.offsetHeight;
550 var arrowRadius = 8;
551 var pageMargin = 2;
552
553 var boxX = Math.max(pageMargin, bounds.minX + (bounds.maxX - bounds.minX) / 2 - titleWidth / 2);
554 boxX = Math.min(boxX, canvasWidth - titleWidth - pageMargin);
555
556 var boxY = bounds.minY - arrowRadius - titleHeight;
557 var onTop = true;
558 if (boxY < 0) {
559 boxY = bounds.maxY + arrowRadius;
560 onTop = false;
561 } else if (bounds.minY > canvasHeight) {
562 boxY = canvasHeight - arrowRadius - titleHeight;
563 }
564
565 elementTitle.style.top = boxY + "px";
566 elementTitle.style.left = boxX + "px";
567
568 var tooltipArrow = document.getElementById("element-tooltip-arrow");
569 // Center arrow if possible. Otherwise, try the bounds of the element.
570 var arrowX = bounds.minX + (bounds.maxX - bounds.minX) / 2 - arrowRadius;
571 var tooltipBorderRadius = 2;
572 if (arrowX < pageMargin + tooltipBorderRadius)
573 arrowX = bounds.maxX - arrowRadius * 2;
574 else if (arrowX + arrowRadius * 2 > canvasWidth - pageMargin - tooltipBorder Radius)
575 arrowX = bounds.minX;
576 // Hide arrow if element is completely off the sides of the page.
577 var arrowHidden = arrowX < pageMargin + tooltipBorderRadius || arrowX + arro wRadius * 2 > canvasWidth - pageMargin - tooltipBorderRadius;
578 tooltipArrow.classList.toggle("hidden", arrowHidden);
579 if (!arrowHidden) {
580 tooltipArrow.classList.toggle("tooltip-arrow-top", onTop);
581 tooltipArrow.style.top = (onTop ? boxY + titleHeight : boxY - arrowRadiu s) + "px";
582 tooltipArrow.style.left = arrowX + "px";
583 }
584 }
585
441 function _drawRulers(bounds, rulerAtRight, rulerAtBottom) 586 function _drawRulers(bounds, rulerAtRight, rulerAtBottom)
442 { 587 {
443 context.save(); 588 context.save();
444 var width = canvasWidth; 589 var width = canvasWidth;
445 var height = canvasHeight; 590 var height = canvasHeight;
446 context.strokeStyle = "rgba(128, 128, 128, 0.3)"; 591 context.strokeStyle = "rgba(128, 128, 128, 0.3)";
447 context.lineWidth = 1; 592 context.lineWidth = 1;
448 context.translate(0.5, 0.5); 593 context.translate(0.5, 0.5);
449 594
450 if (rulerAtRight) { 595 if (rulerAtRight) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 var rulerAtRight = highlight.paths.length && highlight.showRulers && bounds. minX < 20 && bounds.maxX + 20 < canvasWidth; 725 var rulerAtRight = highlight.paths.length && highlight.showRulers && bounds. minX < 20 && bounds.maxX + 20 < canvasWidth;
581 var rulerAtBottom = highlight.paths.length && highlight.showRulers && bounds .minY < 20 && bounds.maxY + 20 < canvasHeight; 726 var rulerAtBottom = highlight.paths.length && highlight.showRulers && bounds .minY < 20 && bounds.maxY + 20 < canvasHeight;
582 727
583 if (highlight.showRulers) 728 if (highlight.showRulers)
584 _drawGrid(rulerAtRight, rulerAtBottom); 729 _drawGrid(rulerAtRight, rulerAtBottom);
585 730
586 if (highlight.paths.length) { 731 if (highlight.paths.length) {
587 if (highlight.showExtensionLines) 732 if (highlight.showExtensionLines)
588 _drawRulers(bounds, rulerAtRight, rulerAtBottom); 733 _drawRulers(bounds, rulerAtRight, rulerAtBottom);
589 734
590 if (highlight.elementInfo) 735 if (highlight.elementInfo && highlight.displayAsMaterial)
736 _drawMaterialElementTitle(highlight.elementInfo, bounds);
737 else if (highlight.elementInfo)
591 _drawElementTitle(highlight.elementInfo, bounds); 738 _drawElementTitle(highlight.elementInfo, bounds);
592 } 739 }
593 context.restore(); 740 context.restore();
594 } 741 }
595 742
596 function setPlatform(platform) 743 function setPlatform(platform)
597 { 744 {
598 window.platform = platform; 745 window.platform = platform;
599 document.body.classList.add("platform-" + platform); 746 document.body.classList.add("platform-" + platform);
600 } 747 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 <div class="button" id="resume-button" title="Resume script execution (F8)." ><div class="glyph"></div></div> 1051 <div class="button" id="resume-button" title="Resume script execution (F8)." ><div class="glyph"></div></div>
905 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> 1052 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div>
906 </div> 1053 </div>
907 </body> 1054 </body>
908 <canvas id="canvas" class="fill"></canvas> 1055 <canvas id="canvas" class="fill"></canvas>
909 <canvas id="labels-canvas" class="fill"></canvas> 1056 <canvas id="labels-canvas" class="fill"></canvas>
910 <div id="element-title"> 1057 <div id="element-title">
911 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> 1058 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan>
912 <span id="node-width"></span><span class="px">px</span><span class="px"> &#xD7 ; </span><span id="node-height"></span><span class="px">px</span> 1059 <span id="node-width"></span><span class="px">px</span><span class="px"> &#xD7 ; </span><span id="node-height"></span><span class="px">px</span>
913 </div> 1060 </div>
1061 <div id="tooltip-container" class="hidden">
1062 <div id="element-tooltip">
1063 <div id="element-description" class="monospace"><span id="material-tag-nam e"></span><span id="material-node-id"></span><span id="material-class-name"></sp an></div>
1064 <div id="dimensions"><span id="material-node-width"></span>&#xD7;<span id= "material-node-height"></span></div>
1065 </div>
1066 <div id="element-tooltip-arrow"></div>
914 <div id="editor" class="fill"></div> 1067 <div id="editor" class="fill"></div>
915 <div id="log"></div> 1068 <div id="log"></div>
916 </html> 1069 </html>
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorHighlight.cpp ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698