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

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

Issue 237313003: CSS shapes support in Web Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review comments Created 6 years, 7 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 <!-- 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */ 149 /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
150 color: rgb(153, 69, 0); 150 color: rgb(153, 69, 0);
151 } 151 }
152 152
153 </style> 153 </style>
154 <script> 154 <script>
155 const lightGridColor = "rgba(0,0,0,0.2)"; 155 const lightGridColor = "rgba(0,0,0,0.2)";
156 const darkGridColor = "rgba(0,0,0,0.7)"; 156 const darkGridColor = "rgba(0,0,0,0.7)";
157 const transparentColor = "rgba(0, 0, 0, 0)"; 157 const transparentColor = "rgba(0, 0, 0, 0)";
158 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)"; 158 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)";
159 // CSS shapes
160 const shapeHighlightColor = "rgba(96, 82, 127, 0.8)";
161 const shapeMarginHighlightColor = "rgba(96, 82, 127, 0.6)";
159 162
160 function drawPausedInDebuggerMessage(message) 163 function drawPausedInDebuggerMessage(message)
161 { 164 {
162 window._controlsVisible = true; 165 window._controlsVisible = true;
163 document.querySelector(".controls-line").style.visibility = "visible"; 166 document.querySelector(".controls-line").style.visibility = "visible";
164 document.getElementById("paused-in-debugger").textContent = message; 167 document.getElementById("paused-in-debugger").textContent = message;
165 document.body.classList.add("dimmed"); 168 document.body.classList.add("dimmed");
166 } 169 }
167 170
168 function _drawGrid(rulerAtRight, rulerAtBottom) 171 function _drawGrid(rulerAtRight, rulerAtBottom)
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 for (var x in topmostYForX) { 539 for (var x in topmostYForX) {
537 context.beginPath(); 540 context.beginPath();
538 context.moveTo(x, 0); 541 context.moveTo(x, 0);
539 context.lineTo(x, topmostYForX[x]); 542 context.lineTo(x, topmostYForX[x]);
540 context.stroke(); 543 context.stroke();
541 } 544 }
542 } 545 }
543 546
544 context.restore(); 547 context.restore();
545 } 548 }
549 // CSS shapes
550 function drawPath(commands, fillColor)
551 {
552 context.save();
553 context.beginPath();
554
555 var commandsIndex = 0;
556 var commandsLength = commands.length;
557 while (commandsIndex < commandsLength) {
558 switch (commands[commandsIndex++]) {
559 case "M":
560 context.moveTo(commands[commandsIndex++], commands[commandsIndex++]) ;
561 break;
562 case "L":
563 context.lineTo(commands[commandsIndex++], commands[commandsIndex++]) ;
564 break;
565 case "C":
566 context.bezierCurveTo(commands[commandsIndex++], commands[commandsIn dex++], commands[commandsIndex++],
567 commands[commandsIndex++], commands[commandsIn dex++], commands[commandsIndex++]);
568 break;
569 case "Q":
570 context.quadraticCurveTo(commands[commandsIndex++], commands[command sIndex++], commands[commandsIndex++],
571 commands[commandsIndex++]);
572 break;
573 case "Z":
574 context.closePath();
575 break;
576 }
577 }
578 context.closePath();
579 context.fillStyle = fillColor;
580 context.fill();
581
582 context.restore();
583 }
546 584
585 function drawShapeHighlight(shapeInfo)
586 {
587 if (shapeInfo.marginShape)
588 drawPath(shapeInfo.marginShape, shapeMarginHighlightColor);
589 else
590 drawOutlinedQuad(shapeInfo.bounds, shapeHighlightColor, shapeHighlightCo lor);
591
592 if (shapeInfo.shape)
593 drawPath(shapeInfo.shape, shapeHighlightColor);
594 else
595 drawOutlinedQuad(shapeInfo.bounds, shapeHighlightColor, shapeHighlightCo lor);
596 }
597
547 function drawNodeHighlight(highlight) 598 function drawNodeHighlight(highlight)
548 { 599 {
549 { 600 {
550 for (var i = 0; i < highlight.quads.length; ++i) { 601 for (var i = 0; i < highlight.quads.length; ++i) {
551 var quad = highlight.quads[i]; 602 var quad = highlight.quads[i];
552 for (var j = 0; j < quad.length; ++j) { 603 for (var j = 0; j < quad.length; ++j) {
553 quad[j].x = Math.round(quad[j].x * pageScaleFactor - scrollX); 604 quad[j].x = Math.round(quad[j].x * pageScaleFactor - scrollX);
554 quad[j].y = Math.round(quad[j].y * pageScaleFactor - scrollY); 605 quad[j].y = Math.round(quad[j].y * pageScaleFactor - scrollY);
555 } 606 }
556 } 607 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 659 }
609 } 660 }
610 661
611 var rulerAtRight = minX < 20 && maxX + 20 < width; 662 var rulerAtRight = minX < 20 && maxX + 20 < width;
612 var rulerAtBottom = minY < 20 && maxY + 20 < height; 663 var rulerAtBottom = minY < 20 && maxY + 20 < height;
613 664
614 if (highlight.showRulers) { 665 if (highlight.showRulers) {
615 _drawGrid(rulerAtRight, rulerAtBottom); 666 _drawGrid(rulerAtRight, rulerAtBottom);
616 _drawRulers(highlight, rulerAtRight, rulerAtBottom); 667 _drawRulers(highlight, rulerAtRight, rulerAtBottom);
617 } 668 }
669 if (highlight.elementInfo && highlight.elementInfo.shapeOutsideInfo)
670 drawShapeHighlight(highlight.elementInfo.shapeOutsideInfo);
618 _drawElementTitle(highlight); 671 _drawElementTitle(highlight);
619 672
620 context.restore(); 673 context.restore();
621 } 674 }
622 675
623 function drawQuadHighlight(highlight) 676 function drawQuadHighlight(highlight)
624 { 677 {
625 context.save(); 678 context.save();
626 drawOutlinedQuad(highlight.quads[0], highlight.contentColor, highlight.conte ntOutlineColor); 679 drawOutlinedQuad(highlight.quads[0], highlight.contentColor, highlight.conte ntOutlineColor);
627 context.restore(); 680 context.restore();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> 742 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div>
690 </div> 743 </div>
691 </body> 744 </body>
692 <canvas id="canvas" class="fill"></canvas> 745 <canvas id="canvas" class="fill"></canvas>
693 <div id="element-title"> 746 <div id="element-title">
694 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> 747 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan>
695 <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> 748 <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>
696 </div> 749 </div>
697 <div id="log"></div> 750 <div id="log"></div>
698 </html> 751 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698