-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[masonry] Expose grid items positions and sizes to Web Inspector #22941
Conversation
EWS run on previous version of this PR (hash 3e8749c) |
Simple way to grab data on the Inspector Overlay side:
|
3e8749c
to
f7419da
Compare
EWS run on current version of this PR (hash f7419da) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very neat!
These metrics will be helpful in
std::optional<InspectorOverlay::Highlight::GridHighlightOverlay> InspectorOverlay::buildGridOverlay(const InspectorOverlay::Grid& gridOverlay, bool offsetBoundsByScroll) |
to follow-up on Bug 265381 by improving the drawing for items in a masonry layout.
Thank you!
@@ -128,6 +128,7 @@ class RenderGrid final : public RenderBlock { | |||
LayoutUnit gridGap(GridTrackSizingDirection, std::optional<LayoutUnit> availableSize) const; | |||
|
|||
LayoutUnit masonryContentSize() const; | |||
Vector<LayoutRect> gridItemsLayoutRects(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this a const function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discuss with Sammy.
This will require changing the orderiterator to support const better.
@@ -1022,6 +1022,16 @@ LayoutUnit RenderGrid::masonryContentSize() const | |||
return m_masonryLayout.gridContentSize(); | |||
} | |||
|
|||
Vector<LayoutRect> RenderGrid::gridItemsLayoutRects() | |||
{ | |||
Vector<LayoutRect> items; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we assert here to make sure the caller does not call this function on a grid that needs to go through layout? Otherwise they would be getting stale geometry for the renderers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with Sammy about the assert.
This is somewhat more of a discussion who owns the responsibility of ensuring that the data is not stale.
Will handle this in a future patch.
https://bugs.webkit.org/show_bug.cgi?id=267736 rdar://problem/121219933 Reviewed by Sammy Gill. Masonry differs from Grid in only having one axis. This does not allow simple drawing straight lines. The Web Inspector can instead draw boxes around each item, which this patch is exposing in a simpler format. This patch is not exclusive to masonry and can be used for all returning all grid items layout rects. * Source/WebCore/rendering/RenderGrid.cpp: (WebCore::RenderGrid::gridItemsLayoutRects): * Source/WebCore/rendering/RenderGrid.h: Canonical link: https://commits.webkit.org/273232@main
f7419da
to
3816458
Compare
Committed 273232@main (3816458): https://commits.webkit.org/273232@main Reviewed commits have been landed. Closing PR #22941 and removing active labels. |
3816458
f7419da