[webkit-changes] [WebKit/WebKit] b603ea: Enable the ability to override available width for...
Commit Queue
noreply at github.com
Tue Aug 15 12:08:37 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b603ea06b45a819fb8f33abae2f011b83d84e1ac
https://github.com/WebKit/WebKit/commit/b603ea06b45a819fb8f33abae2f011b83d84e1ac
Author: David Choi <david_choi5 at apple.com>
Date: 2023-08-15 (Tue, 15 Aug 2023)
Changed paths:
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/layout/formattingContexts/inline/AvailableLineWidthOverride.h
M Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h
M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
Log Message:
-----------
Enable the ability to override available width for line boxes
https://bugs.webkit.org/show_bug.cgi?id=259937
rdar://113575336
Reviewed by Alan Baradlay.
The available width for a line box is originally determined by the
HorizontalConstraints struct. However, it is sometimes desirable to
override that width constraint. One potential reason to override that
width constraint is to force line breaks at particular inline items.
(Currently, there is no way to specify to the LineBuilder to break at
certain InlineItems, and the only way to do so is to modify the available
space on the line.) This is useful for CSS properties such as text-wrap,
which need to make line-breaking decisions that do not follow the current
greedy approach of filling up the entire available width.
This patch introduces a new class (AvailableLineWidthOverride) that overrides
either a global width constraint (applies to all line boxes) or individual
width constraints (applied to each line box individually). If a global
override is specified, then that will always take precedence over any
individual overrides.
AvailableLineWidthOverride objects are placed in InlineLayoutState, and are used
in the LineBuilder to override the available logical width for inline content.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/inline/AvailableLineWidthOverride.h: Added.
(WebCore::Layout::AvailableLineWidthOverride::AvailableLineWidthOverride):
(WebCore::Layout::AvailableLineWidthOverride::availableLineWidthOverrideForLine const):
* Source/WebCore/layout/formattingContexts/inline/InlineLayoutState.h:
(WebCore::Layout::InlineLayoutState::setAvailableLineWidthOverride):
(WebCore::Layout::InlineLayoutState::availableLineWidthOverride const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::handleInlineContent):
Canonical link: https://commits.webkit.org/266921@main
More information about the webkit-changes
mailing list