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

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: Address comments#2 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 }
576
577 if (highlight.wysiwygInfo)
dgozman 2015/06/23 17:13:55 wysiwyg
sergeyv 2015/06/23 17:21:13 Done.
578 showWYSIWYGEditor(highlight.wysiwygInfo);
579
567 context.restore(); 580 context.restore();
568 } 581 }
569 582
570 function setPlatform(platform) 583 function setPlatform(platform)
571 { 584 {
572 window.platform = platform; 585 window.platform = platform;
573 document.body.classList.add("platform-" + platform); 586 document.body.classList.add("platform-" + platform);
574 } 587 }
575 588
576 function dispatch(message) 589 function dispatch(message)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 function onDocumentKeyDown(event) 623 function onDocumentKeyDown(event)
611 { 624 {
612 if (!window._controlsVisible) 625 if (!window._controlsVisible)
613 return; 626 return;
614 if (event.keyIdentifier == "F8" || eventHasCtrlOrMeta(event) && event.keyCod e == 220 /* backslash */) 627 if (event.keyIdentifier == "F8" || eventHasCtrlOrMeta(event) && event.keyCod e == 220 /* backslash */)
615 InspectorOverlayHost.resume(); 628 InspectorOverlayHost.resume();
616 else if (event.keyIdentifier == "F10" || eventHasCtrlOrMeta(event) && event. keyCode == 222 /* single quote */) 629 else if (event.keyIdentifier == "F10" || eventHasCtrlOrMeta(event) && event. keyCode == 222 /* single quote */)
617 InspectorOverlayHost.stepOver(); 630 InspectorOverlayHost.stepOver();
618 } 631 }
619 632
633 function showWYSIWYGEditor(info)
dgozman 2015/06/23 17:13:55 wysiwyg
sergeyv 2015/06/23 17:21:13 Done.
634 {
635 var editorElement = document.getElementById("editor");
636 editorElement.style.visibility = "visible";
637 var anchors = info.anchors;
638 for (var i = 0; i < anchors.length; ++i)
639 editorElement.appendChild(createAnchor(anchors[i]));
640 }
641
642 function createAnchor(anchorInfo)
643 {
644 var handleWidth = 5;
645 context.save();
646 context.shadowColor = "black";
647 context.shadowBlur = 2;
648 context.strokeStyle = "rgb(0, 0, 128)";
649 context.fillStyle = "rgb(0, 0, 128)";
650 context.beginPath();
651 context.arc(anchorInfo.x, anchorInfo.y, handleWidth, 0, 2 * Math.PI);
652 context.fill();
653 context.stroke();
654 context.restore();
655
656 var anchorElement = document.createElement("div");
657 anchorElement.className = "editor-anchor";
658 anchorElement.style.left = anchorInfo.x - handleWidth + "px";
659 anchorElement.style.top = anchorInfo.y - handleWidth + "px";
660 return anchorElement;
661 }
662
620 window.addEventListener("DOMContentLoaded", onLoaded); 663 window.addEventListener("DOMContentLoaded", onLoaded);
621 document.addEventListener("keydown", onDocumentKeyDown); 664 document.addEventListener("keydown", onDocumentKeyDown);
622 665
623 </script> 666 </script>
624 </head> 667 </head>
625 <body class="fill"> 668 <body class="fill">
626 <div class="controls-line"> 669 <div class="controls-line">
627 <div class="message-box"><div id="paused-in-debugger"></div></div> 670 <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> 671 <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> 672 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div>
630 </div> 673 </div>
631 </body> 674 </body>
632 <canvas id="canvas" class="fill"></canvas> 675 <canvas id="canvas" class="fill"></canvas>
633 <div id="element-title"> 676 <div id="element-title">
634 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> 677 <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> 678 <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> 679 </div>
680 <div id="editor" class="fill"></div>
637 <div id="log"></div> 681 <div id="log"></div>
638 </html> 682 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698