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

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

Issue 237313003: CSS shapes support in Web Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review comments Created 6 years, 7 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
Index: Source/core/inspector/InspectorOverlayPage.html
diff --git a/Source/core/inspector/InspectorOverlayPage.html b/Source/core/inspector/InspectorOverlayPage.html
index d36839592656bb4ae242f14e3b91ca88ba86d1b4..882502abca4884e747edd4601f26313881c56b44 100644
--- a/Source/core/inspector/InspectorOverlayPage.html
+++ b/Source/core/inspector/InspectorOverlayPage.html
@@ -156,6 +156,9 @@ const lightGridColor = "rgba(0,0,0,0.2)";
const darkGridColor = "rgba(0,0,0,0.7)";
const transparentColor = "rgba(0, 0, 0, 0)";
const gridBackgroundColor = "rgba(255, 255, 255, 0.8)";
+// CSS shapes
+const shapeHighlightColor = "rgba(96, 82, 127, 0.8)";
+const shapeMarginHighlightColor = "rgba(96, 82, 127, 0.6)";
function drawPausedInDebuggerMessage(message)
{
@@ -543,6 +546,54 @@ function _drawRulers(highlight, rulerAtRight, rulerAtBottom)
context.restore();
}
+// CSS shapes
+function drawPath(commands, fillColor)
+{
+ context.save();
+ context.beginPath();
+
+ var commandsIndex = 0;
+ var commandsLength = commands.length;
+ while (commandsIndex < commandsLength) {
+ switch (commands[commandsIndex++]) {
+ case "M":
+ context.moveTo(commands[commandsIndex++], commands[commandsIndex++]);
+ break;
+ case "L":
+ context.lineTo(commands[commandsIndex++], commands[commandsIndex++]);
+ break;
+ case "C":
+ context.bezierCurveTo(commands[commandsIndex++], commands[commandsIndex++], commands[commandsIndex++],
+ commands[commandsIndex++], commands[commandsIndex++], commands[commandsIndex++]);
+ break;
+ case "Q":
+ context.quadraticCurveTo(commands[commandsIndex++], commands[commandsIndex++], commands[commandsIndex++],
+ commands[commandsIndex++]);
+ break;
+ case "Z":
+ context.closePath();
+ break;
+ }
+ }
+ context.closePath();
+ context.fillStyle = fillColor;
+ context.fill();
+
+ context.restore();
+}
+
+function drawShapeHighlight(shapeInfo)
+{
+ if (shapeInfo.marginShape)
+ drawPath(shapeInfo.marginShape, shapeMarginHighlightColor);
+ else
+ drawOutlinedQuad(shapeInfo.bounds, shapeHighlightColor, shapeHighlightColor);
+
+ if (shapeInfo.shape)
+ drawPath(shapeInfo.shape, shapeHighlightColor);
+ else
+ drawOutlinedQuad(shapeInfo.bounds, shapeHighlightColor, shapeHighlightColor);
+}
function drawNodeHighlight(highlight)
{
@@ -615,6 +666,8 @@ function drawNodeHighlight(highlight)
_drawGrid(rulerAtRight, rulerAtBottom);
_drawRulers(highlight, rulerAtRight, rulerAtBottom);
}
+ if (highlight.elementInfo && highlight.elementInfo.shapeOutsideInfo)
+ drawShapeHighlight(highlight.elementInfo.shapeOutsideInfo);
_drawElementTitle(highlight);
context.restore();

Powered by Google App Engine
This is Rietveld 408576698