Web Inspector: Remove unused ruler in overlay code
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Apr 2014 20:57:42 +0000 (20:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Apr 2014 20:57:42 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131507

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-04-10
Reviewed by Timothy Hatcher.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForHighlight):
* inspector/InspectorOverlay.h:
(WebCore::Highlight::Highlight):
(WebCore::Highlight::setDataFromConfig):
* inspector/InspectorOverlayPage.js:
(_drawFragmentHighlight):
(_drawRegionNumber): Deleted.
(quadToPath): Deleted.
(drawOutlinedQuad): Deleted.
(pathCommand): Deleted.
(drawPath): Deleted.
(drawOutlinedQuadWithClip): Deleted.
(quadEquals): Deleted.
(drawGutter): Deleted.
(drawNodeHighlight): Deleted.
(drawQuadHighlight): Deleted.
(setPlatform): Deleted.
(dispatch): Deleted.
(log): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167086 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/inspector/InspectorOverlay.h
Source/WebCore/inspector/InspectorOverlayPage.js

index b915b73..058db51 100644 (file)
@@ -1,3 +1,33 @@
+2014-04-10  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Remove unused ruler in overlay code
+        https://bugs.webkit.org/show_bug.cgi?id=131507
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::buildObjectForHighlight):
+        * inspector/InspectorOverlay.h:
+        (WebCore::Highlight::Highlight):
+        (WebCore::Highlight::setDataFromConfig):
+        * inspector/InspectorOverlayPage.js:
+        (_drawFragmentHighlight):
+        (_drawRegionNumber): Deleted.
+        (quadToPath): Deleted.
+        (drawOutlinedQuad): Deleted.
+        (pathCommand): Deleted.
+        (drawPath): Deleted.
+        (drawOutlinedQuadWithClip): Deleted.
+        (quadEquals): Deleted.
+        (drawGutter): Deleted.
+        (drawNodeHighlight): Deleted.
+        (drawQuadHighlight): Deleted.
+        (setPlatform): Deleted.
+        (dispatch): Deleted.
+        (log): Deleted.
+
 2014-04-10  Brian J. Burg  <burg@cs.washington.edu>
 
         Web Replay: memoize plugin data for navigator.mimeTypes and navigator.plugins
index 703f14e..80e1212 100644 (file)
@@ -1043,9 +1043,6 @@ std::unique_ptr<HighlightConfig> InspectorDOMAgent::highlightConfigFromInspector
     bool showInfo = false; // Default: false (do not show a tooltip).
     highlightInspectorObject->getBoolean("showInfo", &showInfo);
     highlightConfig->showInfo = showInfo;
-    bool showRulers = false; // Default: false (do not show rulers).
-    highlightInspectorObject->getBoolean("showRulers", &showRulers);
-    highlightConfig->showRulers = showRulers;
     highlightConfig->content = parseConfigColor("contentColor", highlightInspectorObject);
     highlightConfig->contentOutline = parseConfigColor("contentOutlineColor", highlightInspectorObject);
     highlightConfig->padding = parseConfigColor("paddingColor", highlightInspectorObject);
index 8b790da..01d1671 100644 (file)
@@ -391,7 +391,6 @@ static PassRefPtr<InspectorObject> buildObjectForHighlight(const Highlight& high
     for (size_t i = 0; i < highlight.quads.size(); ++i)
         array->pushArray(buildArrayForQuad(highlight.quads[i]));
     object->setArray("quads", array.release());
-    object->setBoolean("showRulers", highlight.showRulers);
     object->setString("contentColor", highlight.contentColor.serialized());
     object->setString("contentOutlineColor", highlight.contentOutlineColor.serialized());
     object->setString("paddingColor", highlight.paddingColor.serialized());
index 755b0a5..3ec07df 100644 (file)
@@ -59,7 +59,6 @@ public:
     Color border;
     Color margin;
     bool showInfo;
-    bool showRulers;
     bool usePageCoordinates;
 };
 
@@ -71,7 +70,6 @@ enum HighlightType {
 struct Highlight {
     Highlight()
         : type(HighlightTypeNode)
-        , showRulers(false)
     {
     }
 
@@ -82,7 +80,6 @@ struct Highlight {
         paddingColor = highlightConfig.padding;
         borderColor = highlightConfig.border;
         marginColor = highlightConfig.margin;
-        showRulers = highlightConfig.showRulers;
         usePageCoordinates = highlightConfig.usePageCoordinates;
     }
 
@@ -96,7 +93,6 @@ struct Highlight {
     // When the type is Rects, this is just a list of quads.
     HighlightType type;
     Vector<FloatQuad> quads;
-    bool showRulers;
     bool usePageCoordinates;
 };
 
index 71bd358..bd98505 100644 (file)
@@ -30,124 +30,6 @@ function drawPausedInDebuggerMessage(message)
     document.body.classList.add("dimmed");
 }
 
-function _drawGrid(highlight, rulerAtRight, rulerAtBottom)
-{
-    if (!highlight.showRulers)
-        return;
-    context.save();
-
-    var width = canvas.width;
-    var height = canvas.height;
-
-    const gridSubStep = 5;
-    const gridStep = 50;
-
-    {
-        // Draw X grid background
-        context.save();
-        context.fillStyle = gridBackgroundColor;
-        if (rulerAtBottom)
-            context.fillRect(0, height - 15, width, height);
-        else
-            context.fillRect(0, 0, width, 15);
-
-        // Clip out backgrounds intersection
-        context.globalCompositeOperation = "destination-out";
-        context.fillStyle = "red";
-        if (rulerAtRight)
-            context.fillRect(width - 15, 0, width, height);
-        else
-            context.fillRect(0, 0, 15, height);
-        context.restore();
-
-        // Draw Y grid background
-        context.fillStyle = gridBackgroundColor;
-        if (rulerAtRight)
-            context.fillRect(width - 15, 0, width, height);
-        else
-            context.fillRect(0, 0, 15, height);
-    }
-
-    context.lineWidth = 1;
-    context.strokeStyle = darkGridColor;
-    context.fillStyle = darkGridColor;
-    {
-        // Draw labels.
-        context.save();
-        context.translate(-highlight.scrollX, 0.5 - highlight.scrollY);
-        for (var y = 2 * gridStep; y < height + highlight.scrollY; y += 2 * gridStep) {
-            context.save();
-            context.translate(highlight.scrollX, y);
-            context.rotate(-Math.PI / 2);
-            context.fillText(y, 2, rulerAtRight ? width - 7 : 13);
-            context.restore();
-        }
-        context.translate(0.5, -0.5);
-        for (var x = 2 * gridStep; x < width + highlight.scrollX; x += 2 * gridStep) {
-            context.save();
-            context.fillText(x, x + 2, rulerAtBottom ? highlight.scrollY + height - 7 : highlight.scrollY + 13);
-            context.restore();
-        }
-        context.restore();
-    }
-
-    {
-        // Draw vertical grid
-        context.save();
-        if (rulerAtRight) {
-            context.translate(width, 0);
-            context.scale(-1, 1);
-        }
-        context.translate(-highlight.scrollX, 0.5 - highlight.scrollY);
-        for (var y = gridStep; y < height + highlight.scrollY; y += gridStep) {
-            context.beginPath();
-            context.moveTo(highlight.scrollX, y);
-            var markLength = (y % (gridStep * 2)) ? 5 : 8;
-            context.lineTo(highlight.scrollX + markLength, y);
-            context.stroke();
-        }
-        context.strokeStyle = lightGridColor;
-        for (var y = gridSubStep; y < highlight.scrollY + height; y += gridSubStep) {
-            if (!(y % gridStep))
-                continue;
-            context.beginPath();
-            context.moveTo(highlight.scrollX, y);
-            context.lineTo(highlight.scrollX + gridSubStep, y);
-            context.stroke();
-        }
-        context.restore();
-    }
-
-    {
-        // Draw horizontal grid
-        context.save();
-        if (rulerAtBottom) {
-            context.translate(0, height);
-            context.scale(1, -1);
-        }
-        context.translate(0.5 - highlight.scrollX, -highlight.scrollY);
-        for (var x = gridStep; x < width + highlight.scrollX; x += gridStep) {
-            context.beginPath();
-            context.moveTo(x, highlight.scrollY);
-            var markLength = (x % (gridStep * 2)) ? 5 : 8;
-            context.lineTo(x, highlight.scrollY + markLength);
-            context.stroke();
-        }
-        context.strokeStyle = lightGridColor;
-        for (var x = gridSubStep; x < highlight.scrollX + width; x += gridSubStep) {
-            if (!(x % gridStep))
-                continue;
-            context.beginPath();
-            context.moveTo(x, highlight.scrollY);
-            context.lineTo(x, highlight.scrollY + gridSubStep);
-            context.stroke();
-        }
-        context.restore();
-    }
-
-    context.restore();
-}
-
 function _drawRegionNumber(quad, number)
 {
     context.save();
@@ -458,68 +340,6 @@ function _drawElementTitle(elementInfo, fragmentHighlight, scroll)
     elementTitle.style.left = (boxX + 3) + "px";
 }
 
-function _drawRulers(highlight, rulerAtRight, rulerAtBottom)
-{
-    if (!highlight.showRulers)
-        return;
-    context.save();
-    var width = canvas.width;
-    var height = canvas.height;
-    context.strokeStyle = "rgba(128, 128, 128, 0.3)";
-    context.lineWidth = 1;
-    context.translate(0.5, 0.5);
-    var leftmostXForY = {};
-    var rightmostXForY = {};
-    var topmostYForX = {};
-    var bottommostYForX = {};
-
-    for (var i = 0; i < highlight.quads.length; ++i) {
-        var quad = highlight.quads[i];
-        for (var j = 0; j < quad.length; ++j) {
-            var x = quad[j].x;
-            var y = quad[j].y;
-            leftmostXForY[Math.round(y)] = Math.min(leftmostXForY[y] || Number.MAX_VALUE, Math.round(quad[j].x));
-            rightmostXForY[Math.round(y)] = Math.max(rightmostXForY[y] || Number.MIN_VALUE, Math.round(quad[j].x));
-            topmostYForX[Math.round(x)] = Math.min(topmostYForX[x] || Number.MAX_VALUE, Math.round(quad[j].y));
-            bottommostYForX[Math.round(x)] = Math.max(bottommostYForX[x] || Number.MIN_VALUE, Math.round(quad[j].y));
-        }
-    }
-
-    if (rulerAtRight) {
-        for (var y in rightmostXForY) {
-            context.beginPath();
-            context.moveTo(width, y);
-            context.lineTo(rightmostXForY[y], y);
-            context.stroke();
-        }
-    } else {
-        for (var y in leftmostXForY) {
-            context.beginPath();
-            context.moveTo(0, y);
-            context.lineTo(leftmostXForY[y], y);
-            context.stroke();
-        }
-    }
-
-    if (rulerAtBottom) {
-        for (var x in bottommostYForX) {
-            context.beginPath();
-            context.moveTo(x, height);
-            context.lineTo(x, topmostYForX[x]);
-            context.stroke();
-        }
-    } else {
-        for (var x in topmostYForX) {
-            context.beginPath();
-            context.moveTo(x, 0);
-            context.lineTo(x, topmostYForX[x]);
-            context.stroke();
-        }
-    }
-
-    context.restore();
-}
-
 function _quadMidPoint(quad)
 {
     return {
@@ -576,10 +396,8 @@ function _drawShapeHighlight(shapeInfo) {
 
 function _drawFragmentHighlight(highlight)
 {
-    if (!highlight.quads.length) {
-        _drawGrid(highlight, false, false);
+    if (!highlight.quads.length)
         return;
-    }
 
     context.save();
 
@@ -629,12 +447,6 @@ function _drawFragmentHighlight(highlight)
     }
 
     context.restore();
-
-    var rulerAtRight = minX < 20 && maxX + 20 < width;
-    var rulerAtBottom = minY < 20 && maxY + 20 < height;
-
-    _drawGrid(highlight, rulerAtRight, rulerAtBottom);
-    _drawRulers(highlight, rulerAtRight, rulerAtBottom);
 }
 
 function showPageIndication()