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

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

Issue 1153503010: Devtools: Margin resizer in overlay 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 #step-over-button .glyph { 120 #step-over-button .glyph {
121 -webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAA AKCAYAAAC5Sw6hAAAAAXNSR0IArs4c6QAAAOFJREFUKM+N0j8rhXEUB/DPcxW35CqhvIBrtqibkklhV8 qkTHe4ZbdblcXgPVhuMdqUTUl5A2KRRCF5LGc4PT1P7qnfcr5/zu/8KdTHLFaxjHnc4RZXKI0QYxjgLQ TVd42l/0wmg5iFX3iq5H6w22RS4DyRH7CB8cAXcBTGJT6xUmd0mEwuMdFQcA3fwXvGTAan8BrgPabTL9 fRRyfx91PRMwyjGwcJ2EyCfsrfpPw2Pipz24NT/MZciiQYVshzOKnZ5Hturxt3k2MnCpS4SPkeHpPR8S h3tYgttBoW9II2/AHiaEqvD2Fc0wAAAABJRU5ErkJggg==); 121 -webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAA AKCAYAAAC5Sw6hAAAAAXNSR0IArs4c6QAAAOFJREFUKM+N0j8rhXEUB/DPcxW35CqhvIBrtqibkklhV8 qkTHe4ZbdblcXgPVhuMdqUTUl5A2KRRCF5LGc4PT1P7qnfcr5/zu/8KdTHLFaxjHnc4RZXKI0QYxjgLQ TVd42l/0wmg5iFX3iq5H6w22RS4DyRH7CB8cAXcBTGJT6xUmd0mEwuMdFQcA3fwXvGTAan8BrgPabTL9 fRRyfx91PRMwyjGwcJ2EyCfsrfpPw2Pipz24NT/MZciiQYVshzOKnZ5Hturxt3k2MnCpS4SPkeHpPR8S h3tYgttBoW9II2/AHiaEqvD2Fc0wAAAABJRU5ErkJggg==);
122 -webkit-mask-size: 18px 10px; 122 -webkit-mask-size: 18px 10px;
123 } 123 }
124 124
125 .px { 125 .px {
126 color: rgb(128, 128, 128); 126 color: rgb(128, 128, 128);
127 } 127 }
128 128
129 #element-title { 129 #element-title {
130 background-color: #ffff00;
130 position: absolute; 131 position: absolute;
131 z-index: 10; 132 z-index: 10;
132 } 133 }
133 134
134 #tag-name { 135 #tag-name {
135 /* Keep this in sync with view-source.css (.html-tag) */ 136 /* Keep this in sync with view-source.css (.html-tag) */
136 color: rgb(136, 18, 128); 137 color: rgb(136, 18, 128);
137 } 138 }
138 139
139 #node-id { 140 #node-id {
140 /* Keep this in sync with view-source.css (.html-attribute-value) */ 141 /* Keep this in sync with view-source.css (.html-attribute-value) */
141 color: rgb(26, 26, 166); 142 color: rgb(26, 26, 166);
142 } 143 }
143 144
144 #class-name { 145 #class-name {
145 /* Keep this in sync with view-source.css (.html-attribute-name) */ 146 /* Keep this in sync with view-source.css (.html-attribute-name) */
146 color: rgb(153, 69, 0); 147 color: rgb(153, 69, 0);
147 } 148 }
148 149
150 #margin-resizer {
151 background-color: red;
152 width: 20px;
153 height: 20px;
154 position: absolute;
155 z-index: 20;
156 }
157
149 </style> 158 </style>
150 <script> 159 <script>
151 const lightGridColor = "rgba(0,0,0,0.2)"; 160 const lightGridColor = "rgba(0,0,0,0.2)";
152 const darkGridColor = "rgba(0,0,0,0.7)"; 161 const darkGridColor = "rgba(0,0,0,0.7)";
153 const transparentColor = "rgba(0, 0, 0, 0)"; 162 const transparentColor = "rgba(0, 0, 0, 0)";
154 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)"; 163 const gridBackgroundColor = "rgba(255, 255, 255, 0.8)";
155 164
156 function drawPausedInDebuggerMessage(message) 165 function drawPausedInDebuggerMessage(message)
157 { 166 {
158 window._controlsVisible = true; 167 window._controlsVisible = true;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 canvas.height = deviceScaleFactor * viewportSize.height; 342 canvas.height = deviceScaleFactor * viewportSize.height;
334 canvas.style.width = viewportSize.width + "px"; 343 canvas.style.width = viewportSize.width + "px";
335 canvas.style.height = viewportSize.height + "px"; 344 canvas.style.height = viewportSize.height + "px";
336 context.scale(deviceScaleFactor, deviceScaleFactor); 345 context.scale(deviceScaleFactor, deviceScaleFactor);
337 window.canvasWidth = viewportSize.width; 346 window.canvasWidth = viewportSize.width;
338 window.canvasHeight = viewportSize.height; 347 window.canvasHeight = viewportSize.height;
339 348
340 window._controlsVisible = false; 349 window._controlsVisible = false;
341 document.querySelector(".controls-line").style.visibility = "hidden"; 350 document.querySelector(".controls-line").style.visibility = "hidden";
342 document.getElementById("element-title").style.visibility = "hidden"; 351 document.getElementById("element-title").style.visibility = "hidden";
352 document.getElementById("margin-resizer").style.visibility = "hidden";
343 document.body.classList.remove("dimmed"); 353 document.body.classList.remove("dimmed");
344 window._gridPainted = false; 354 window._gridPainted = false;
345 } 355 }
346 356
347 function _drawElementTitle(elementInfo, bounds) 357 function _drawElementTitle(elementInfo, bounds)
348 { 358 {
349 document.getElementById("tag-name").textContent = elementInfo.tagName; 359 document.getElementById("tag-name").textContent = elementInfo.tagName;
350 document.getElementById("node-id").textContent = elementInfo.idValue ? "#" + elementInfo.idValue : ""; 360 document.getElementById("node-id").textContent = elementInfo.idValue ? "#" + elementInfo.idValue : "";
351 var className = elementInfo.className; 361 var className = elementInfo.className;
352 if (className && className.length > 50) 362 if (className && className.length > 50)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 context.fillStyle = "rgb(255, 255, 194)"; 418 context.fillStyle = "rgb(255, 255, 194)";
409 context.fill(); 419 context.fill();
410 context.strokeStyle = "rgb(128, 128, 128)"; 420 context.strokeStyle = "rgb(128, 128, 128)";
411 context.stroke(); 421 context.stroke();
412 422
413 context.restore(); 423 context.restore();
414 424
415 elementTitle.style.visibility = "visible"; 425 elementTitle.style.visibility = "visible";
416 elementTitle.style.top = (boxY + 3) + "px"; 426 elementTitle.style.top = (boxY + 3) + "px";
417 elementTitle.style.left = (boxX + 3) + "px"; 427 elementTitle.style.left = (boxX + 3) + "px";
428 _drawMarginResizer(elementInfo, bounds);
418 } 429 }
419 430
431 function _drawMarginResizer(elementInfo, bounds)
432 {
433 var resizerElement = document.getElementById("margin-resizer");
434 resizerElement.style.left = bounds.minX + parseInt(elementInfo.marginLeft, 1 0) - 10 + "px";
435 resizerElement.style.top = bounds.minY + (bounds.maxY - bounds.minY) / 2 - 1 0 + "px";
436 resizerElement.style.visibility = "visible";
437 }
438
439
440
420 function _drawRulers(bounds, rulerAtRight, rulerAtBottom) 441 function _drawRulers(bounds, rulerAtRight, rulerAtBottom)
421 { 442 {
422 context.save(); 443 context.save();
423 var width = canvasWidth; 444 var width = canvasWidth;
424 var height = canvasHeight; 445 var height = canvasHeight;
425 context.strokeStyle = "rgba(128, 128, 128, 0.3)"; 446 context.strokeStyle = "rgba(128, 128, 128, 0.3)";
426 context.lineWidth = 1; 447 context.lineWidth = 1;
427 context.translate(0.5, 0.5); 448 context.translate(0.5, 0.5);
428 449
429 if (rulerAtRight) { 450 if (rulerAtRight) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 function onResumeClick() 610 function onResumeClick()
590 { 611 {
591 InspectorOverlayHost.resume(); 612 InspectorOverlayHost.resume();
592 } 613 }
593 614
594 function onStepOverClick() 615 function onStepOverClick()
595 { 616 {
596 InspectorOverlayHost.stepOver(); 617 InspectorOverlayHost.stepOver();
597 } 618 }
598 619
620 function onResizerDown(event)
621 {
622 window.resizerDownX = event.clientX;
623 window.resizerDownY = event.clientY;
624
625 document.addEventListener("mousemove", onResizerMove, true);
626 document.addEventListener("mouseup", onResizerUp, true);
627 document.addEventListener("mouseout", onResizerOut, true);
628 }
629
630 function onResizerMove(event)
631 {
632 // console.log("bbb " + (event.clientX - resizerDownX));
633 InspectorOverlayHost.updateCSSProperty(event.clientX - resizerDownX);
634 }
635
636 function onResizerUp(event)
637 {
638 delete window.resizerDownX;
639 delete window.resizerDownY;
640 document.removeEventListener("mousemove", onResizerMove, true);
641 document.removeEventListener("mouseup", onResizerUp, true);
642 document.removeEventListener("mouseout", onResizerOut, true);
643 }
644
645 function onResizerOut(event)
646 {
647
648 }
649
599 function onLoaded() 650 function onLoaded()
600 { 651 {
601 document.getElementById("resume-button").addEventListener("click", onResumeC lick); 652 document.getElementById("resume-button").addEventListener("click", onResumeC lick);
602 document.getElementById("step-over-button").addEventListener("click", onStep OverClick); 653 document.getElementById("step-over-button").addEventListener("click", onStep OverClick);
654 document.getElementById("margin-resizer").addEventListener("mousedown", onRe sizerDown);
603 } 655 }
604 656
605 function eventHasCtrlOrMeta(event) 657 function eventHasCtrlOrMeta(event)
606 { 658 {
607 return window.platform == "mac" ? (event.metaKey && !event.ctrlKey) : (event .ctrlKey && !event.metaKey); 659 return window.platform == "mac" ? (event.metaKey && !event.ctrlKey) : (event .ctrlKey && !event.metaKey);
608 } 660 }
609 661
610 function onDocumentKeyDown(event) 662 function onDocumentKeyDown(event)
611 { 663 {
612 if (!window._controlsVisible) 664 if (!window._controlsVisible)
(...skipping 14 matching lines...) Expand all
627 <div class="message-box"><div id="paused-in-debugger"></div></div> 679 <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> 680 <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> 681 <div class="button" id="step-over-button" title="Step over next function cal l (F10)."><div class="glyph"></div></div>
630 </div> 682 </div>
631 </body> 683 </body>
632 <canvas id="canvas" class="fill"></canvas> 684 <canvas id="canvas" class="fill"></canvas>
633 <div id="element-title"> 685 <div id="element-title">
634 <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></s pan> 686 <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> 687 <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> 688 </div>
689 <div id="margin-resizer">
690 </div>
637 <div id="log"></div> 691 <div id="log"></div>
638 </html> 692 </html>
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorOverlayHost.idl ('k') | Source/devtools/front_end/sdk/CSSStyleModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698