RESOLVED FIXED 221972
Web Inspector: Grid layout labels can be drawn outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=221972
Summary Web Inspector: Grid layout labels can be drawn outside the viewport
Patrick Angle
Reported 2021-02-16 10:19:04 PST
Steps to reproduce: 1. Navigate to https://labs.jensimmons.com/2017/03-008.html. 2. Open the web inspector and enable the grid overlay for `main`. 3. Disable the authored margin on the `body` element. Expected Results: Labels would reposition to not be drawn outside the page. Actual Results: Labels are drawn outside the bounds of the page.
Attachments
Screenshot of Issue (3.30 MB, image/png)
2021-02-16 10:19 PST, Patrick Angle
no flags
Patch v1.0 (40.74 KB, patch)
2021-03-23 18:54 PDT, Patrick Angle
no flags
Screenshot of Patch v1.0 (704.79 KB, image/png)
2021-03-23 18:56 PDT, Patrick Angle
no flags
Patch v1.1 - Added `USE(CG)` check (41.00 KB, patch)
2021-03-24 09:54 PDT, Patrick Angle
no flags
Patch v1.2 - Review notes (41.01 KB, patch)
2021-03-26 11:01 PDT, Patrick Angle
ews-feeder: commit-queue-
Patch v1.3 - Fix typo (41.00 KB, patch)
2021-03-26 11:06 PDT, Patrick Angle
no flags
Patch v1.4 - Added reviewer to changelogs (40.99 KB, patch)
2021-03-26 19:56 PDT, Patrick Angle
no flags
Patrick Angle
Comment 1 2021-02-16 10:19:15 PST
Created attachment 420491 [details] Screenshot of Issue
Radar WebKit Bug Importer
Comment 2 2021-02-23 10:20:15 PST
Patrick Angle
Comment 3 2021-03-23 18:54:25 PDT
Created attachment 424086 [details] Patch v1.0
Patrick Angle
Comment 4 2021-03-23 18:56:11 PDT
Comment on attachment 424086 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=424086&action=review > Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm:340 > + CGPath* labelPath = labelWebCorePath.ensurePlatformPath(); I missed a `#if USE(CG)` here... And these two lines should move down to where they are used below the `textPosition` calculations.
Patrick Angle
Comment 5 2021-03-23 18:56:42 PDT
Created attachment 424088 [details] Screenshot of Patch v1.0
Patrick Angle
Comment 6 2021-03-24 09:54:48 PDT
Created attachment 424146 [details] Patch v1.1 - Added `USE(CG)` check
Blaze Burg
Comment 7 2021-03-24 11:43:28 PDT
Comment on attachment 424146 [details] Patch v1.1 - Added `USE(CG)` check View in context: https://bugs.webkit.org/attachment.cgi?id=424146&action=review r=me, great stuff! > Source/WebKit/ChangeLog:8 > + Add support the new `WebCore::InspectorOverlay::LabelArrowEdgePosition` property to grid overlays on iOS. Nit: add support *for* > Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm:411 > + auto labelWebCorePath = WebCore::InspectorOverlay::backgroundPathForLayoutLabel(textWidth + (padding * 2), textHeight + (padding * 2), arrowDirection, arrowEdgePosition, arrowSize); I would name this labelPath, and the existing labelPath as platformLabelPath
Patrick Angle
Comment 8 2021-03-26 11:01:47 PDT
Created attachment 424374 [details] Patch v1.2 - Review notes
Patrick Angle
Comment 9 2021-03-26 11:06:11 PDT
Created attachment 424376 [details] Patch v1.3 - Fix typo
EWS
Comment 10 2021-03-26 15:06:52 PDT
ChangeLog entry in Source/WebCore/ChangeLog contains OOPS!.
Patrick Angle
Comment 11 2021-03-26 19:56:51 PDT
Created attachment 424436 [details] Patch v1.4 - Added reviewer to changelogs
EWS
Comment 12 2021-03-26 20:27:32 PDT
Committed r275128: <https://commits.webkit.org/r275128> All reviewed patches have been landed. Closing bug and clearing flags on attachment 424436 [details].
Michael Catanzaro
Comment 13 2021-04-19 06:43:04 PDT
This introduced an unused variable warning: In file included from WebCore/DerivedSources/unified-sources/UnifiedSource-84c9f43f-3.cpp:4: ../../Source/WebCore/inspector/InspectorOverlay.cpp: In member function ‘WTF::Optional<WebCore::InspectorOverlay::Highlight::GridHighlightOverlay> WebCore::InspectorOverlay::buildGridOverlay(const WebCore::InspectorOverlay::Grid&, bool)’: ../../Source/WebCore/inspector/InspectorOverlay.cpp:1768:23: warning: variable ‘lineBetweenColumnBottoms’ set but not used [-Wunused-but-set-variable] 1768 | FloatLine lineBetweenColumnBottoms = { columnStartLine.end(), previousColumnEndLine.end() }; | It looks like a copy/paste error: FloatLine lineBetweenColumnTops = { columnStartLine.start(), previousColumnEndLine.start() }; FloatLine lineBetweenColumnBottoms = { columnStartLine.end(), previousColumnEndLine.end() }; gapLabelLine = { lineBetweenColumnTops.pointAtRelativeDistance(0.5), lineBetweenColumnTops.pointAtRelativeDistance(0.5) }; Patrick, can you look at it please?
Michael Catanzaro
Comment 14 2021-04-19 06:46:00 PDT
There's also a new -Wreturn-type warning: ../../Source/WebCore/inspector/InspectorOverlay.cpp: In function ‘WebCore::FloatSize WebCore::expectedSizeForLayoutLabel(WTF::String, WebCore::InspectorOverlay::LabelArrowDirection, float)’: ../../Source/WebCore/inspector/InspectorOverlay.cpp:1349:54: warning: control reaches end of non-void function [-Wreturn-type] 1349 | auto font = InspectorOverlay::fontForLayoutLabel(); | ^ This is very common since clang doesn't warn when all enum values are covered by the switch, but GCC does. I'll add a RELEASE_ASSERT_NOT_REACHED().
Patrick Angle
Comment 15 2021-04-19 07:30:23 PDT
> Patrick, can you look at it please? Yep, I’ll take a look and get these fixed today; thank you for bringing these to my attention!
Michael Catanzaro
Comment 16 2021-04-19 09:19:24 PDT
I handled the -Wreturn-type in bug #224756, so that just leaves the copy/paste issue for you to handle.
Note You need to log in before you can comment on or make changes to this bug.