[webkit-changes] [WebKit/WebKit] 9c0b2b: Refactor content distribution functions in Grid
fantasai
noreply at github.com
Tue Jan 2 19:23:37 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9c0b2b0c72a40ec9e1c7db4f2ff5adcdaa9a7e19
https://github.com/WebKit/WebKit/commit/9c0b2b0c72a40ec9e1c7db4f2ff5adcdaa9a7e19
Author: Elika Etemad <fantasai.bugs at inkedblade.net>
Date: 2024-01-02 (Tue, 02 Jan 2024)
Changed paths:
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderGrid.cpp
M Source/WebCore/rendering/RenderGrid.h
Log Message:
-----------
Refactor content distribution functions in Grid
https://bugs.webkit.org/show_bug.cgi?id=266838
rdar://problem/120064485
Reviewed by Sammy Gill.
Improves clarity of content alignment in RenderGrid by:
- Inlines the single-use contentDistributionOffset function into its caller
to make the logic flow in computeContentPositionAndDistributionOffset more
straightforward--and to avoid doing a weird thing with an otherwise-
nonsensical .isValid() that pretends negative numbers are special, but only
for this one function (because they are otherwise valid in these offsets).
- Reorganizes the logic flow in computeContentPositionAndDistributionOffset
to start by initializing to zero, and then adjusting where it's not zero,
instead of setting things to zero right before every possible return.
- Sets the offsets directly instead of indirectly, now that the control flow
is simplified.
- Makes it obvious that the offsets are always set, never left uninitialized.
Also fixes a typo in RenderFlexible Box.
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::styleDidChange): Fix typo.
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeContentPositionAndDistributionOffset): Restructure.
(WebCore::contentDistributionOffset): Deleted (folded into computeContentPositionAndDistributionOffset).
* Source/WebCore/rendering/RenderGrid.h:
(WebCore::ContentAlignmentData::isValid const): Deleted.
Canonical link: https://commits.webkit.org/272591@main
More information about the webkit-changes
mailing list