Title: [276941] trunk/Source/WebKit
Revision
276941
Author
pan...@apple.com
Date
2021-05-03 19:03:04 -0700 (Mon, 03 May 2021)

Log Message

Web Inspector: [Cocoa] Grid overlay area names aren't centered within areas.
https://bugs.webkit.org/show_bug.cgi?id=225176

Reviewed by Devin Rousso.

Grid area names were changed to be centered in their area in r275519. On iOS, the label was changed to treat the
provided point as the center, but the label was still being anchored in the top-left corner. This patch corrects
that by using the center of the area as the anchor point for the label.

* UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(-[WKInspectorHighlightView _createGridOverlayLayer:scale:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (276940 => 276941)


--- trunk/Source/WebKit/ChangeLog	2021-05-04 01:12:16 UTC (rev 276940)
+++ trunk/Source/WebKit/ChangeLog	2021-05-04 02:03:04 UTC (rev 276941)
@@ -1,3 +1,17 @@
+2021-05-03  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: [Cocoa] Grid overlay area names aren't centered within areas.
+        https://bugs.webkit.org/show_bug.cgi?id=225176
+
+        Reviewed by Devin Rousso.
+
+        Grid area names were changed to be centered in their area in r275519. On iOS, the label was changed to treat the
+        provided point as the center, but the label was still being anchored in the top-left corner. This patch corrects
+        that by using the center of the area as the anchor point for the label.
+
+        * UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
+        (-[WKInspectorHighlightView _createGridOverlayLayer:scale:]):
+
 2021-05-03  Zhenchao Li  <zhenchao...@apple.com>
 
         Add macOS Safari sandbox exception for com.apple.CFNetwork preferences

Modified: trunk/Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm (276940 => 276941)


--- trunk/Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm	2021-05-04 01:12:16 UTC (rev 276940)
+++ trunk/Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm	2021-05-04 02:03:04 UTC (rev 276941)
@@ -435,7 +435,7 @@
 
 - (CALayer *)_createGridOverlayLayer:(const WebCore::InspectorOverlay::Highlight::GridHighlightOverlay&)overlay scale:(double)scale
 {
-    // Keep implementation roughly equivilent to `WebCore::InspectorOverlay::drawGridOverlay`.
+    // Keep implementation roughly equivalent to `WebCore::InspectorOverlay::drawGridOverlay`.
     CALayer *layer = [CALayer layer];
 
     auto gridLinesPath = adoptCF(CGPathCreateMutable());
@@ -464,7 +464,7 @@
     constexpr auto translucentLabelBackgroundColor = WebCore::Color::white.colorWithAlphaByte(230);
 
     for (auto area : overlay.areas)
-        [layer addSublayer:createLayoutLabelLayer(area.name, area.quad.p1(), WebCore::InspectorOverlay::LabelArrowDirection::None, WebCore::InspectorOverlay::LabelArrowEdgePosition::None, translucentLabelBackgroundColor, overlay.color, scale, area.quad.boundingBox().width())];
+        [layer addSublayer:createLayoutLabelLayer(area.name, area.quad.center(), WebCore::InspectorOverlay::LabelArrowDirection::None, WebCore::InspectorOverlay::LabelArrowEdgePosition::None, translucentLabelBackgroundColor, overlay.color, scale, area.quad.boundingBox().width())];
 
     for (auto label : overlay.labels)
         [layer addSublayer:createLayoutLabelLayer(label.text, label.location, label.arrowDirection, label.arrowEdgePosition, label.backgroundColor, overlay.color, scale)];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to