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

Unified Diff: Source/core/inspector/InspectorOverlayPage.html

Issue 1311783003: Devtools[LayoutEditor]: Rework layout-editor workflow (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@resize
Patch Set: Address comments Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorOverlayHost.idl ('k') | Source/core/inspector/LayoutEditor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorOverlayPage.html
diff --git a/Source/core/inspector/InspectorOverlayPage.html b/Source/core/inspector/InspectorOverlayPage.html
index 52fc463cf6e9023fce988a3f5b48beda9333133f..1ffa734b05b15182925ff12e3e58e639d2167124 100644
--- a/Source/core/inspector/InspectorOverlayPage.html
+++ b/Source/core/inspector/InspectorOverlayPage.html
@@ -447,7 +447,12 @@ function reset(resetData)
editor.style.visibility = "hidden";
editor.textContent = "";
document.body.classList.remove("dimmed");
- document.removeEventListener("mousemove", onGlobalMouseMove);
+ document.removeEventListener("mousedown", consumeEvent);
+ document.removeEventListener("mousemove", onLayoutEditorMouseMove);
+ document.removeEventListener("mouseup", consumeEvent);
+ document.removeEventListener("click", onLayoutEditorClick);
+ document.removeEventListener("keydown", onLayoutEditorKeyDown);
+
delete window.hoverableAreas;
delete window.anchorsByType;
window._gridPainted = false;
@@ -810,7 +815,11 @@ function showLayoutEditor(info)
if (selectedAnchorInfo)
showLabels(selectedAnchorInfo.type, selectedAnchorInfo.propertyName);
- document.addEventListener("mousemove", onGlobalMouseMove);
+ document.addEventListener("mousedown", consumeEvent);
+ document.addEventListener("mousemove", onLayoutEditorMouseMove);
+ document.addEventListener("mouseup", consumeEvent);
+ document.addEventListener("click", onLayoutEditorClick);
+ document.addEventListener("keydown", onLayoutEditorKeyDown);
}
function createAnchor(anchorInfo)
@@ -1020,8 +1029,9 @@ function anchorColorForProperty(anchorInfo)
return "rgb(107, 213, 0)";
}
-function onGlobalMouseMove(event)
+function onLayoutEditorMouseMove(event)
{
+ event.preventDefault();
if (!window.hoverableAreas)
return;
var types = ["padding", "margin"];
@@ -1029,9 +1039,33 @@ function onGlobalMouseMove(event)
var path = hoverableAreas.get(type);
if (path && context.isPointInPath(path, deviceScaleFactor * event.x, deviceScaleFactor * event.y)) {
showLabels(type);
- break;
+ return;
}
}
+ resetLabelCanvas();
+}
+
+function onLayoutEditorClick(event)
+{
+ event.preventDefault();
+ InspectorOverlayHost.clearSelection(true);
+}
+
+function onLayoutEditorKeyDown(event)
+{
+ if (window.draggedPropertyName)
+ return;
+
+ // Clear selection on Esc.
+ if (event.keyIdentifier === "U+001B") {
+ event.preventDefault();
+ InspectorOverlayHost.clearSelection(false);
+ }
+}
+
+function consumeEvent(event)
+{
+ event.preventDefault();
}
function resetLabelCanvas()
« no previous file with comments | « Source/core/inspector/InspectorOverlayHost.idl ('k') | Source/core/inspector/LayoutEditor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698