Diff
Modified: trunk/Source/WebCore/ChangeLog (273555 => 273556)
--- trunk/Source/WebCore/ChangeLog 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/ChangeLog 2021-02-26 14:48:57 UTC (rev 273556)
@@ -1,5 +1,32 @@
2021-02-26 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Inline boxes should not be referred as inline containers
+ https://bugs.webkit.org/show_bug.cgi?id=222455
+
+ Reviewed by Antti Koivisto.
+
+ Inline boxes used to be called inline containers (e.g <span> -> [inline container start] and </span> -> [inline container end]).
+
+ * layout/inlineformatting/InlineContentBreaker.cpp:
+ (WebCore::Layout::hasTextRun):
+ (WebCore::Layout::InlineContentBreaker::processOverflowingContentWithText const):
+ * layout/inlineformatting/InlineContentBreaker.h:
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::usedContentHeight const):
+ (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded):
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::appendInlineBoxStart):
+ (WebCore::Layout::Line::appendInlineBoxEnd):
+ (WebCore::Layout::Line::appendTextContent):
+ (WebCore::Layout::Line::TrimmableTrailingContent::remove):
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::isAtSoftWrapOpportunity):
+ (WebCore::Layout::LineBuilder::nextWrapOpportunity const):
+
+2021-02-26 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Include the inline box in the enclosing geometry only once
https://bugs.webkit.org/show_bug.cgi?id=222454
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp (273555 => 273556)
--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2021-02-26 14:48:57 UTC (rev 273556)
@@ -65,7 +65,7 @@
static inline bool hasTextRun(const InlineContentBreaker::ContinuousContent& continuousContent)
{
- // <span>text</span> is considered a text run even with the [container start][container end] inline items.
+ // <span>text</span> is considered a text run even with the [inline box start][inline box end] inline items.
// Based on standards commit boundary rules it would be enough to check the first inline item, but due to the table quirk, we can have
// image and text next to each other inside a continuous set of runs (see InlineFormattingContext::Quirks::hasSoftWrapOpportunityAtImage).
for (auto& run : continuousContent.runs()) {
@@ -269,8 +269,8 @@
auto isBreakableRun = [] (auto& run) {
ASSERT(run.inlineItem.isText() || run.inlineItem.isInlineBoxStart() || run.inlineItem.isInlineBoxEnd() || run.inlineItem.layoutBox().isImage());
if (!run.inlineItem.isText()) {
- // Can't break horizontal spacing -> e.g. <span style="padding-right: 100px;">textcontent</span>, if the [container end] is the overflown inline item
- // we need to check if there's another inline item beyond the [container end] to split.
+ // Can't break horizontal spacing -> e.g. <span style="padding-right: 100px;">textcontent</span>, if the [inline box end] is the overflown inline item
+ // we need to check if there's another inline item beyond the [inline box end] to split.
return false;
}
// Check if this text run needs to stay on the current line.
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h (273555 => 273556)
--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h 2021-02-26 14:48:57 UTC (rev 273556)
@@ -69,13 +69,13 @@
// This struct represents the amount of continuous content committed to content breaking at a time (no in-between wrap opportunities).
// e.g.
// <div>text content <span>span1</span>between<span>span2</span></div>
- // [text][ ][content][ ][container start][span1][container end][between][container start][span2][container end]
+ // [text][ ][content][ ][inline box start][span1][inline box end][between][inline box start][span2][inline box end]
// continuous candidate content at a time:
// 1. [text]
// 2. [ ]
// 3. [content]
// 4. [ ]
- // 5. [container start][span1][container end][between][container start][span2][container end]
+ // 5. [inline box start][span1][inline box end][between][inline box start][span2][inline box end]
// see https://drafts.csswg.org/css-text-3/#line-break-details
struct ContinuousContent {
InlineLayoutUnit logicalWidth() const { return m_logicalWidth; }
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (273555 => 273556)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2021-02-26 14:48:57 UTC (rev 273556)
@@ -159,7 +159,7 @@
// then the height is increased to include those edges. Only floats that participate in this block formatting context are taken
// into account, e.g., floats inside absolutely positioned descendants or other floats are not.
auto& lines = formattingState().lines();
- // Even empty containers generate one line.
+ // Even empty content generates a line.
ASSERT(!lines.isEmpty());
auto top = LayoutUnit { lines.first().lineBoxLogicalRect().top() };
auto bottom = LayoutUnit { lines.last().lineBoxLogicalRect().bottom() + formattingState().clearGapAfterLastLine() };
@@ -398,7 +398,7 @@
auto& formattingState = this->formattingState();
if (!formattingState.inlineItems().isEmpty())
return;
- // Traverse the tree and create inline items out of containers and leaf nodes. This essentially turns the tree inline structure into a flat one.
+ // Traverse the tree and create inline items out of inline boxes and leaf nodes. This essentially turns the tree inline structure into a flat one.
// <span>text<span></span><img></span> -> [InlineBoxStart][InlineLevelBox][InlineBoxStart][InlineBoxEnd][InlineLevelBox][InlineBoxEnd]
ASSERT(root().hasInFlowOrFloatingChild());
LayoutQueue layoutQueue;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (273555 => 273556)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-02-26 14:48:57 UTC (rev 273556)
@@ -227,11 +227,11 @@
// We need to make sure that there's an LineBox::InlineLevelBox for every inline box that's present on the current line.
// In nesting case we need to create LineBox::InlineLevelBoxes for the inline box ancestors.
// We only have to do it on the first run as any subsequent inline content is either at the same/higher nesting level or
- // nested with a [container start] run.
+ // nested with a [inline box start] run.
auto& firstRun = runs[0];
auto& firstRunParentLayoutBox = firstRun.layoutBox().parent();
// If the parent is the formatting root, we can stop here. This is root inline box content, there's no nesting inline box from the previous line(s)
- // unless the inline box closing (container end run) is forced over to the current line.
+ // unless the inline box closing is forced over to the current line.
// e.g.
// <span>normally the inline box closing forms a continuous content</span>
// <span>unless it's forced to the next line<br></span>
@@ -350,7 +350,7 @@
continue;
}
if (run.isInlineBoxEnd()) {
- // Adjust the logical width when the inline level container closes on this line.
+ // Adjust the logical width when the inline box closes on this line.
auto& inlineBox = lineBox.inlineLevelBoxForLayoutBox(layoutBox);
ASSERT(inlineBox.isInlineBox());
// Inline box run is based on margin box. Let's convert it to border box.
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (273555 => 273556)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2021-02-26 14:48:57 UTC (rev 273556)
@@ -199,7 +199,7 @@
void Line::appendInlineBoxStart(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
{
- // This is really just a placeholder to mark the start of the inline level container <span>.
+ // This is really just a placeholder to mark the start of the inline box <span>.
auto& boxGeometry = formattingContext().geometryForBox(inlineItem.layoutBox());
auto adjustedRunStart = contentLogicalRight() + std::min(boxGeometry.marginStart(), 0_lu);
appendNonBreakableSpace(inlineItem, adjustedRunStart, logicalWidth);
@@ -207,13 +207,13 @@
void Line::appendInlineBoxEnd(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
{
- // This is really just a placeholder to mark the end of the inline level container </span>.
+ // This is really just a placeholder to mark the end of the inline box </span>.
auto removeTrailingLetterSpacing = [&] {
if (!m_trimmableTrailingContent.isTrailingRunPartiallyTrimmable())
return;
m_contentLogicalWidth -= m_trimmableTrailingContent.removePartiallyTrimmableContent();
};
- // Prevent trailing letter-spacing from spilling out of the inline container.
+ // Prevent trailing letter-spacing from spilling out of the inline box.
// https://drafts.csswg.org/css-text-3/#letter-spacing-property See example 21.
removeTrailingLetterSpacing();
appendNonBreakableSpace(inlineItem, contentLogicalWidth(), logicalWidth);
@@ -237,7 +237,7 @@
// Any collapsible space immediately following another collapsible space—even one outside the boundary of the inline containing that space,
// provided both spaces are within the same inline formatting context—is collapsed to have zero advance width.
// : "<span> </span> " <- the trailing whitespace collapses completely.
- // Not that when the inline container has preserve whitespace style, "<span style="white-space: pre"> </span> " <- this whitespace stays around.
+ // Not that when the inline box has preserve whitespace style, "<span style="white-space: pre"> </span> " <- this whitespace stays around.
if (run.isText())
return run.hasCollapsibleTrailingWhitespace();
ASSERT(run.isInlineBoxStart() || run.isInlineBoxEnd() || run.isWordBreakOpportunity());
@@ -372,8 +372,8 @@
{
// Remove trimmable trailing content and move all the subsequent trailing runs.
// <span> </span><span></span>
- // [trailing whitespace][container end][container start][container end]
- // Trim the whitespace run and move the trailing inline container runs to the logical left.
+ // [trailing whitespace][inline box end][inline box start][inline box end]
+ // Trim the whitespace run and move the trailing inline box runs to the logical left.
ASSERT(!isEmpty());
auto& trimmableRun = m_runs[*m_firstTrimmableRunIndex];
ASSERT(trimmableRun.isText());
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (273555 => 273556)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2021-02-26 14:48:42 UTC (rev 273555)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2021-02-26 14:48:57 UTC (rev 273556)
@@ -70,12 +70,12 @@
static inline bool isAtSoftWrapOpportunity(const InlineFormattingContext& inlineFormattingContext, const InlineItem& current, const InlineItem& next)
{
// "is at" simple means that there's a soft wrap opportunity right after the [current].
- // [text][ ][text][container start]... (<div>text content<span>..</div>)
- // soft wrap indexes: 0 and 1 definitely, 2 depends on the content after the [container start].
+ // [text][ ][text][inline box start]... (<div>text content<span>..</div>)
+ // soft wrap indexes: 0 and 1 definitely, 2 depends on the content after the [inline box start].
// https://drafts.csswg.org/css-text-3/#line-break-details
// Figure out if the new incoming content puts the uncommitted content on a soft wrap opportunity.
- // e.g. [container start][prior_continuous_content][container end] (<span>prior_continuous_content</span>)
+ // e.g. [inline box start][prior_continuous_content][inline box end] (<span>prior_continuous_content</span>)
// An incoming <img> box would enable us to commit the "<span>prior_continuous_content</span>" content
// but an incoming text content would not necessarily.
ASSERT(current.isText() || current.isBox() || current.isFloat());
@@ -113,7 +113,7 @@
auto isImageContent = current.layoutBox().isImage() || next.layoutBox().isImage();
if (isImageContent)
return inlineFormattingContext.quirks().hasSoftWrapOpportunityAtImage();
- // [text][container start][container end][inline box] (text<span></span><img>) : there's a soft wrap opportunity between the [text] and [img].
+ // [text][inline box start][inline box end][inline box] (text<span></span><img>) : there's a soft wrap opportunity between the [text] and [img].
// The line breaking behavior of a replaced element or other atomic inline is equivalent to an ideographic character.
return true;
}
@@ -551,9 +551,9 @@
// 3. Check if there's a soft wrap opportunity between the 2 candidate inline items and repeat.
// 4. Any force line break/explicit wrap content inbetween is considered as wrap opportunity.
- // [ex-][container start][container end][float][ample] (ex-<span></span><div style="float:left"></div>ample). Wrap index is at [ex-].
- // [ex][container start][amp-][container start][le] (ex<span>amp-<span>ample). Wrap index is at [amp-].
- // [ex-][container start][line break][ample] (ex-<span><br>ample). Wrap index is after [br].
+ // [ex-][inline box start][inline box end][float][ample] (ex-<span></span><div style="float:left"></div>ample). Wrap index is at [ex-].
+ // [ex][inline box start][amp-][inline box start][le] (ex<span>amp-<span>ample). Wrap index is at [amp-].
+ // [ex-][inline box start][line break][ample] (ex-<span><br>ample). Wrap index is after [br].
auto previousInlineItemIndex = Optional<size_t> { };
for (auto index = startIndex; index < layoutRange.end; ++index) {
auto& inlineItem = m_inlineItems[index];
@@ -583,11 +583,11 @@
}
// There's a soft wrap opportunity between 'previousInlineItemIndex' and 'index'.
// Now forward-find from the start position to see where we can actually wrap.
- // [ex-][ample] vs. [ex-][container start][container end][ample]
+ // [ex-][ample] vs. [ex-][inline box start][inline box end][ample]
// where [ex-] is startContent and [ample] is the nextContent.
for (auto candidateIndex = *previousInlineItemIndex + 1; candidateIndex < index; ++candidateIndex) {
if (m_inlineItems[candidateIndex].isInlineBoxStart()) {
- // inline content and [container start] and [container end] form unbreakable content.
+ // inline content and [inline box start] and [inline box end] form unbreakable content.
// ex-<span></span>ample : wrap opportunity is after "ex-".
// ex-</span></span>ample : wrap opportunity is after "ex-</span></span>".
// ex-</span><span>ample</span> : wrap opportunity is after "ex-</span>".