You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[leading-trim][IFC] Add support for nested block containers with leading-trim: end
https://bugs.webkit.org/show_bug.cgi?id=248854
Reviewed by Antti Koivisto.
This patch adds multi-pass inline layout to support last formatted line trimming.
"leading-trim: end" trims the last line of the last inline formatting context.
While this property is not inherited, it is propagated through nested block containers.
With nested block containers, we can end up with multiple inline formatting contexts e.g.
<div style="leading-trim: end">
<div>
<div>first line</div>
</div>
<div> last line</div>
</div>
The last formatted line can not be identified until after finishing the layout process on the entire
subtree where the property is set.
In this patch, we run an additional inline layout on the last formatting context with the leading trim (end) set.
1. set "trim start" (when applicable) on the layout state.
2. reset the "trim start" state after trimming the first line (so that subsequent IFCs don't apply "trim start")
3. when the entire subtree is laid out, check if we need to apply "trim end'.
4. find the last formatting context
5. set "trim end" on the layout state and run layout on the last IFC.
(Fast path for the simple case when the leading trim block container is also an IFC root.)
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::leadingTrim):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::firstInlineFormattingContextRoot):
(WebCore::lastInlineFormattingContextRoot):
(WebCore::RenderBlockFlow::setLeadingTrimForSubtree):
(WebCore::RenderBlockFlow::adjustLeadingTrimAfterLayout):
(WebCore::RenderBlockFlow::layoutInFlowChildren):
(WebCore::RenderBlockFlow::resetLeadingTrim): Deleted.
* Source/WebCore/rendering/RenderBlockFlow.h:
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderLayoutState.cpp:
(WebCore::RenderLayoutState::RenderLayoutState):
* Source/WebCore/rendering/RenderLayoutState.h:
(WebCore::RenderLayoutState::leadingTrim):
(WebCore::RenderLayoutState::hasLeadingTrimStart const):
(WebCore::RenderLayoutState::hasLeadingTrimEnd const):
(WebCore::RenderLayoutState::addLeadingTrimStart):
(WebCore::RenderLayoutState::removeLeadingTrimStart):
(WebCore::RenderLayoutState::addLeadingTrimEnd):
(WebCore::RenderLayoutState::hasLeadingTrim const): Deleted.
(WebCore::RenderLayoutState::leadingTrim const): Deleted.
(WebCore::RenderLayoutState::addLeadingTrim): Deleted.
(WebCore::RenderLayoutState::removeLeadingTrim): Deleted.
Canonical link: https://commits.webkit.org/257526@main
0 commit comments