[webkit-changes] [WebKit/WebKit] be3537: [leading-trim][IFC] Add support for nested block c...
Alan Baradlay
noreply at github.com
Wed Dec 7 17:23:57 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: be3537314eb4f62969a1c8af4d11e193a572cfe3
https://github.com/WebKit/WebKit/commit/be3537314eb4f62969a1c8af4d11e193a572cfe3
Author: Alan Baradlay <zalan at apple.com>
Date: 2022-12-07 (Wed, 07 Dec 2022)
Changed paths:
M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
M Source/WebCore/rendering/RenderBlockFlow.cpp
M Source/WebCore/rendering/RenderBlockFlow.h
M Source/WebCore/rendering/RenderElement.h
M Source/WebCore/rendering/RenderLayoutState.cpp
M Source/WebCore/rendering/RenderLayoutState.h
Log Message:
-----------
[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
More information about the webkit-changes
mailing list