OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 | |
590 if (shapeInfo.shape) | |
591 drawPath(shapeInfo.shape, shapeHighlightColor); | |
592 | |
593 if (!shapeInfo.shape && !shapeInfo.marginShape) | |
rwlbuis
2014/04/24 15:17:27
You could combine above using else so you only tes
Habib Virji
2014/04/24 17:12:22
Done.
| |
594 drawOutlinedQuad(shapeInfo.bounds, shapeHighlightColor, shapeHighlightCo lor); | |
595 } | |
596 | |
547 function drawNodeHighlight(highlight) | 597 function drawNodeHighlight(highlight) |
548 { | 598 { |
549 { | 599 { |
550 for (var i = 0; i < highlight.quads.length; ++i) { | 600 for (var i = 0; i < highlight.quads.length; ++i) { |
551 var quad = highlight.quads[i]; | 601 var quad = highlight.quads[i]; |
552 for (var j = 0; j < quad.length; ++j) { | 602 for (var j = 0; j < quad.length; ++j) { |
553 quad[j].x = Math.round(quad[j].x * pageScaleFactor - scrollX); | 603 quad[j].x = Math.round(quad[j].x * pageScaleFactor - scrollX); |
554 quad[j].y = Math.round(quad[j].y * pageScaleFactor - scrollY); | 604 quad[j].y = Math.round(quad[j].y * pageScaleFactor - scrollY); |
555 } | 605 } |
556 } | 606 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 } | 658 } |
609 } | 659 } |
610 | 660 |
611 var rulerAtRight = minX < 20 && maxX + 20 < width; | 661 var rulerAtRight = minX < 20 && maxX + 20 < width; |
612 var rulerAtBottom = minY < 20 && maxY + 20 < height; | 662 var rulerAtBottom = minY < 20 && maxY + 20 < height; |
613 | 663 |
614 if (highlight.showRulers) { | 664 if (highlight.showRulers) { |
615 _drawGrid(rulerAtRight, rulerAtBottom); | 665 _drawGrid(rulerAtRight, rulerAtBottom); |
616 _drawRulers(highlight, rulerAtRight, rulerAtBottom); | 666 _drawRulers(highlight, rulerAtRight, rulerAtBottom); |
617 } | 667 } |
668 if (highlight.elementInfo && highlight.elementInfo.shapeOutsideInfo) | |
669 drawShapeHighlight(highlight.elementInfo.shapeOutsideInfo); | |
618 _drawElementTitle(highlight); | 670 _drawElementTitle(highlight); |
619 | 671 |
620 context.restore(); | 672 context.restore(); |
621 } | 673 } |
622 | 674 |
623 function drawQuadHighlight(highlight) | 675 function drawQuadHighlight(highlight) |
624 { | 676 { |
625 context.save(); | 677 context.save(); |
626 drawOutlinedQuad(highlight.quads[0], highlight.contentColor, highlight.conte ntOutlineColor); | 678 drawOutlinedQuad(highlight.quads[0], highlight.contentColor, highlight.conte ntOutlineColor); |
627 context.restore(); | 679 context.restore(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
689 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> | 741 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> |
690 </div> | 742 </div> |
691 </body> | 743 </body> |
692 <canvas id="canvas" class="fill"></canvas> | 744 <canvas id="canvas" class="fill"></canvas> |
693 <div id="element-title"> | 745 <div id="element-title"> |
694 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> | 746 <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"> × ; </span><span id="node-height"></span><span class="px">px</span> | 747 <span id="node-width"></span><span class="px">px</span><span class="px"> × ; </span><span id="node-height"></span><span class="px">px</span> |
696 </div> | 748 </div> |
697 <div id="log"></div> | 749 <div id="log"></div> |
698 </html> | 750 </html> |
OLD | NEW |