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

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

Issue 1204453002: Devtools: Create layout editor experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 #node-id { 139 #node-id {
140 /* Keep this in sync with view-source.css (.html-attribute-value) */ 140 /* Keep this in sync with view-source.css (.html-attribute-value) */
141 color: rgb(26, 26, 166); 141 color: rgb(26, 26, 166);
142 } 142 }
143 143
144 #class-name { 144 #class-name {
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 {
150 height: 12px;
151 width: 12px;
152 position: absolute;
153 }
154
149 </style> 155 </style>
150 <script> 156 <script>
151 const lightGridColor = "rgba(0,0,0,0.2)"; 157 const lightGridColor = "rgba(0,0,0,0.2)";
152 const darkGridColor = "rgba(0,0,0,0.7)"; 158 const darkGridColor = "rgba(0,0,0,0.7)";
153 const transparentColor = "rgba(0, 0, 0, 0)"; 159 const transparentColor = "rgba(0, 0, 0, 0)";
154 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)"; 160 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)";
155 161
156 function drawPausedInDebuggerMessage(message) 162 function drawPausedInDebuggerMessage(message)
157 { 163 {
158 window._controlsVisible = true; 164 window._controlsVisible = true;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 canvas.height = deviceScaleFactor * viewportSize.height; 339 canvas.height = deviceScaleFactor * viewportSize.height;
334 canvas.style.width = viewportSize.width + "px"; 340 canvas.style.width = viewportSize.width + "px";
335 canvas.style.height = viewportSize.height + "px"; 341 canvas.style.height = viewportSize.height + "px";
336 context.scale(deviceScaleFactor, deviceScaleFactor); 342 context.scale(deviceScaleFactor, deviceScaleFactor);
337 window.canvasWidth = viewportSize.width; 343 window.canvasWidth = viewportSize.width;
338 window.canvasHeight = viewportSize.height; 344 window.canvasHeight = viewportSize.height;
339 345
340 window._controlsVisible = false; 346 window._controlsVisible = false;
341 document.querySelector(".controls-line").style.visibility = "hidden"; 347 document.querySelector(".controls-line").style.visibility = "hidden";
342 document.getElementById("element-title").style.visibility = "hidden"; 348 document.getElementById("element-title").style.visibility = "hidden";
349 var editor = document.getElementById("editor");
350 editor.style.visibility = "hidden";
351 editor.textContent = "";
343 document.body.classList.remove("dimmed"); 352 document.body.classList.remove("dimmed");
344 window._gridPainted = false; 353 window._gridPainted = false;
345 } 354 }
346 355
347 function _drawElementTitle(elementInfo, bounds) 356 function _drawElementTitle(elementInfo, bounds)
348 { 357 {
349 document.getElementById("tag-name").textContent = elementInfo.tagName; 358 document.getElementById("tag-name").textContent = elementInfo.tagName;
350 document.getElementById("node-id").textContent = elementInfo.idValue ? "#" + elementInfo.idValue : ""; 359 document.getElementById("node-id").textContent = elementInfo.idValue ? "#" + elementInfo.idValue : "";
351 var className = elementInfo.className; 360 var className = elementInfo.className;
352 if (className && className.length > 50) 361 if (className && className.length > 50)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 if (highlight.showRulers) 566 if (highlight.showRulers)
558 _drawGrid(rulerAtRight, rulerAtBottom); 567 _drawGrid(rulerAtRight, rulerAtBottom);
559 568
560 if (highlight.paths.length) { 569 if (highlight.paths.length) {
561 if (highlight.showExtensionLines) 570 if (highlight.showExtensionLines)
562 _drawRulers(bounds, rulerAtRight, rulerAtBottom); 571 _drawRulers(bounds, rulerAtRight, rulerAtBottom);
563 572
564 if (highlight.elementInfo) 573 if (highlight.elementInfo)
565 _drawElementTitle(highlight.elementInfo, bounds); 574 _drawElementTitle(highlight.elementInfo, bounds);
566 } 575 }
567 context.restore(); 576
dgozman 2015/06/23 14:00:30 Bring it back!
sergeyv 2015/06/23 16:36:52 Done.
577 if (highlight.wysiwygInfo)
578 showWYSIWYGEditor(highlight.wysiwygInfo);
568 } 579 }
569 580
570 function setPlatform(platform) 581 function setPlatform(platform)
571 { 582 {
572 window.platform = platform; 583 window.platform = platform;
573 document.body.classList.add("platform-" + platform); 584 document.body.classList.add("platform-" + platform);
574 } 585 }
575 586
576 function dispatch(message) 587 function dispatch(message)
577 { 588 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 function onDocumentKeyDown(event) 621 function onDocumentKeyDown(event)
611 { 622 {
612 if (!window._controlsVisible) 623 if (!window._controlsVisible)
613 return; 624 return;
614 if (event.keyIdentifier == "F8" || eventHasCtrlOrMeta(event) && event.keyCod e == 220 /* backslash */) 625 if (event.keyIdentifier == "F8" || eventHasCtrlOrMeta(event) && event.keyCod e == 220 /* backslash */)
615 InspectorOverlayHost.resume(); 626 InspectorOverlayHost.resume();
616 else if (event.keyIdentifier == "F10" || eventHasCtrlOrMeta(event) && event. keyCode == 222 /* single quote */) 627 else if (event.keyIdentifier == "F10" || eventHasCtrlOrMeta(event) && event. keyCode == 222 /* single quote */)
617 InspectorOverlayHost.stepOver(); 628 InspectorOverlayHost.stepOver();
618 } 629 }
619 630
631 function showWYSIWYGEditor(info)
632 {
633 var editorElement = document.getElementById("editor");
634 editorElement.style.visibility = "visible";
635 var anchors = info.anchors;
636 for (var i = 0; i < anchors.length; ++i)
637 editorElement.appendChild(createAnchor(anchors[i]));
638 }
639
640 function createAnchor(anchorInfo)
641 {
642 var handleWidth = 5;
643 context.save();
644 context.shadowColor = "black";
645 context.shadowBlur = 2;
646 context.strokeStyle = "rgb(0, 0, 128)";
647 context.fillStyle = "rgb(0, 0, 128)";
648 context.beginPath();
649 context.arc(anchorInfo.x, anchorInfo.y, handleWidth, 0, 2 * Math.PI);
650 context.fill();
651 context.stroke();
652 context.restore();
653
654 var anchorElement = document.createElement("div");
655 anchorElement.className = "editor-anchor";
656 anchorElement.style.left = anchorInfo.x - handleWidth + "px";
657 anchorElement.style.top = anchorInfo.y - handleWidth + "px";
658 return anchorElement;
659 }
660
620 window.addEventListener("DOMContentLoaded", onLoaded); 661 window.addEventListener("DOMContentLoaded", onLoaded);
621 document.addEventListener("keydown", onDocumentKeyDown); 662 document.addEventListener("keydown", onDocumentKeyDown);
622 663
623 </script> 664 </script>
624 </head> 665 </head>
625 <body class="fill"> 666 <body class="fill">
626 <div class="controls-line"> 667 <div class="controls-line">
627 <div class="message-box"><div id="paused-in-debugger"></div></div> 668 <div class="message-box"><div id="paused-in-debugger"></div></div>
628 <div class="button" id="resume-button" title="Resume script execution (F8)." ><div class="glyph"></div></div> 669 <div class="button" id="resume-button" title="Resume script execution (F8)." ><div class="glyph"></div></div>
629 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div> 670 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div>
630 </div> 671 </div>
631 </body> 672 </body>
632 <canvas id="canvas" class="fill"></canvas> 673 <canvas id="canvas" class="fill"></canvas>
633 <div id="element-title"> 674 <div id="element-title">
634 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> 675 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan>
635 <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> 676 <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>
636 </div> 677 </div>
678 <div id="editor"></div>
dgozman 2015/06/23 14:00:30 Let's make it class=fill.
sergeyv 2015/06/23 16:36:52 Done.
637 <div id="log"></div> 679 <div id="log"></div>
638 </html> 680 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698