Diff
Modified: trunk/Source/WebCore/ChangeLog (269221 => 269222)
--- trunk/Source/WebCore/ChangeLog 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/ChangeLog 2020-10-31 12:18:33 UTC (rev 269222)
@@ -1,3 +1,50 @@
+2020-10-31 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Rename ContainerStart/End to InlineBoxStart/End
+ https://bugs.webkit.org/show_bug.cgi?id=218410
+
+ Reviewed by Antti Koivisto.
+
+ ContainerStart/End inline items are triggered by inline boxes.
+
+ "An inline box is one that is both inline-level and whose contents participate in its containing inline formatting context."
+
+ * layout/inlineformatting/InlineContentBreaker.cpp:
+ (WebCore::Layout::isTextContent):
+ (WebCore::Layout::isVisuallyEmptyWhitespaceContent):
+ (WebCore::Layout::isNonContentRunsOnly):
+ (WebCore::Layout::InlineContentBreaker::processOverflowingTextContent const):
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded):
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::collectHangingTrailingWhitespaceContent):
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ * layout/inlineformatting/InlineItem.h:
+ (WebCore::Layout::InlineItem::isInlineBoxStart const):
+ (WebCore::Layout::InlineItem::isInlineBoxEnd const):
+ (WebCore::Layout::InlineItem::isContainerStart const): Deleted.
+ (WebCore::Layout::InlineItem::isContainerEnd const): Deleted.
+ * layout/inlineformatting/InlineLine.cpp:
+ (WebCore::Layout::Line::visuallyCollapsePreWrapOverflowContent):
+ (WebCore::Layout::Line::append):
+ (WebCore::Layout::Line::appendInlineBoxStart):
+ (WebCore::Layout::Line::appendInlineBoxEnd):
+ (WebCore::Layout::Line::appendTextContent):
+ (WebCore::Layout::Line::isRunVisuallyNonEmpty const):
+ (WebCore::Layout::Line::TrimmableTrailingContent::remove):
+ (WebCore::Layout::Line::appendInlineContainerStart): Deleted.
+ (WebCore::Layout::Line::appendInlineContainerEnd): Deleted.
+ * layout/inlineformatting/InlineLine.h:
+ (WebCore::Layout::Line::Run::isInlineBoxStart const):
+ (WebCore::Layout::Line::Run::isInlineBoxEnd const):
+ (WebCore::Layout::Line::Run::isContainerStart const): Deleted.
+ (WebCore::Layout::Line::Run::isContainerEnd const): Deleted.
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineCandidate::InlineContent::appendInlineItem):
+ (WebCore::Layout::LineBuilder::inlineItemWidth const):
+ (WebCore::Layout::LineBuilder::nextContentForLine):
+ (WebCore::Layout::LineBuilder::nextWrapOpportunity const):
+
2020-10-30 Chris Dumez <[email protected]>
Usage of allWorkletGlobalScopesSet() in WorkletGlobalScope is not thread-safe
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2020-10-31 12:18:33 UTC (rev 269222)
@@ -43,7 +43,7 @@
// Due to commit boundary rules, we just need to check the first non-typeless inline item (can't have both [img] and [text])
for (auto& run : continuousContent.runs()) {
auto& inlineItem = run.inlineItem;
- if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
+ if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd())
continue;
return inlineItem.isText();
}
@@ -58,7 +58,7 @@
for (auto& run : continuousContent.runs()) {
auto& inlineItem = run.inlineItem;
// FIXME: check for padding border etc.
- if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
+ if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd())
continue;
return inlineItem.isText() && downcast<InlineTextItem>(inlineItem).isWhitespace();
}
@@ -70,7 +70,7 @@
// <span></span> <- non content runs.
for (auto& run : continuousContent.runs()) {
auto& inlineItem = run.inlineItem;
- if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
+ if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd())
continue;
return false;
}
@@ -252,7 +252,7 @@
Optional<TrailingTextContent> InlineContentBreaker::processOverflowingTextContent(const ContinuousContent& continuousContent, const LineStatus& lineStatus) const
{
auto isBreakableRun = [] (auto& run) {
- ASSERT(run.inlineItem.isText() || run.inlineItem.isContainerStart() || run.inlineItem.isContainerEnd());
+ ASSERT(run.inlineItem.isText() || run.inlineItem.isInlineBoxStart() || run.inlineItem.isInlineBoxEnd());
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.
@@ -269,7 +269,7 @@
size_t index = 0;
while (index < runs.size()) {
auto& run = runs[index];
- ASSERT(run.inlineItem.isText() || run.inlineItem.isContainerStart() || run.inlineItem.isContainerEnd());
+ ASSERT(run.inlineItem.isText() || run.inlineItem.isInlineBoxStart() || run.inlineItem.isInlineBoxEnd());
if (accumulatedRunWidth + run.logicalWidth > lineStatus.availableWidth && isBreakableRun(run)) {
// At this point the available width can very well be negative e.g. when some part of the continuous text content can not be broken into parts ->
// <span style="word-break: keep-all">textcontentwithnobreak</span><span>textcontentwithyesbreak</span>
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2020-10-31 12:18:33 UTC (rev 269222)
@@ -361,7 +361,7 @@
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.
- // <span>text<span></span><img></span> -> [ContainerStart][InlineBox][ContainerStart][ContainerEnd][InlineBox][ContainerEnd]
+ // <span>text<span></span><img></span> -> [InlineBoxStart][InlineLevelBox][InlineBoxStart][InlineBoxEnd][InlineLevelBox][InlineBoxEnd]
ASSERT(root().hasInFlowOrFloatingChild());
LayoutQueue layoutQueue;
layoutQueue.append(root().firstInFlowOrFloatingChild());
@@ -372,7 +372,7 @@
if (!isBoxWithInlineContent)
break;
// This is the start of an inline box (e.g. <span>).
- formattingState.addInlineItem({ layoutBox, InlineItem::Type::ContainerStart });
+ formattingState.addInlineItem({ layoutBox, InlineItem::Type::InlineBoxStart });
auto& inlineBoxWithInlineContent = downcast<ContainerBox>(layoutBox);
if (!inlineBoxWithInlineContent.hasInFlowOrFloatingChild())
break;
@@ -391,7 +391,7 @@
else if (layoutBox.isInlineTextBox()) {
InlineTextItem::createAndAppendTextItems(formattingState.inlineItems(), downcast<InlineTextBox>(layoutBox));
} else if (layoutBox.isInlineBox())
- formattingState.addInlineItem({ layoutBox, InlineItem::Type::ContainerEnd });
+ formattingState.addInlineItem({ layoutBox, InlineItem::Type::InlineBoxEnd });
else
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2020-10-31 12:18:33 UTC (rev 269222)
@@ -87,7 +87,7 @@
if (isLastLineWithInlineContent)
hangingContent.setIsConditional();
for (auto& run : WTF::makeReversedRange(runs)) {
- if (run.isContainerStart() || run.isContainerEnd())
+ if (run.isInlineBoxStart() || run.isInlineBoxEnd())
continue;
if (run.isLineBreak()) {
hangingContent.setIsConditional();
@@ -234,7 +234,7 @@
// e.g.
// <span>normally the inline box closing forms a continuous content</span>
// <span>unless it's forced to the next line<br></span>
- if (isRootBox(firstRunParentLayoutBox) && !firstRun.isContainerEnd())
+ if (isRootBox(firstRunParentLayoutBox) && !firstRun.isInlineBoxEnd())
return;
auto* ancestor = &firstRunParentLayoutBox;
Vector<const Box*> ancestorsWithoutInlineBoxes;
@@ -270,13 +270,13 @@
if (logicalHeight)
atomicInlineLevelBox->setIsNonEmpty();
lineBox.addInlineLevelBox(WTFMove(atomicInlineLevelBox));
- } else if (run.isContainerStart()) {
+ } else if (run.isInlineBoxStart()) {
auto initialLogicalWidth = lineBox.logicalWidth() - run.logicalLeft();
ASSERT(initialLogicalWidth >= 0);
auto inlineBox = LineBox::InlineLevelBox::createInlineBox(layoutBox, logicalLeft, initialLogicalWidth);
setVerticalGeometryForInlineBox(*inlineBox);
lineBox.addInlineLevelBox(WTFMove(inlineBox));
- } else if (run.isContainerEnd()) {
+ } else if (run.isInlineBoxEnd()) {
// Adjust the logical width when the inline level container closes on this line.
auto& inlineBox = lineBox.inlineLevelBoxForLayoutBox(layoutBox);
ASSERT(inlineBox.isInlineBox());
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineItem.h (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineItem.h 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineItem.h 2020-10-31 12:18:33 UTC (rev 269222)
@@ -35,7 +35,7 @@
class InlineItem {
public:
- enum class Type : uint8_t { Text, HardLineBreak, SoftLineBreak, WordBreakOpportunity, Box, Float, ContainerStart, ContainerEnd };
+ enum class Type : uint8_t { Text, HardLineBreak, SoftLineBreak, WordBreakOpportunity, Box, Float, InlineBoxStart, InlineBoxEnd };
InlineItem(const Box& layoutBox, Type);
Type type() const { return m_type; }
@@ -49,8 +49,8 @@
bool isWordBreakOpportunity() const { return type() == Type::WordBreakOpportunity; }
bool isSoftLineBreak() const { return type() == Type::SoftLineBreak; }
bool isHardLineBreak() const { return type() == Type::HardLineBreak; }
- bool isContainerStart() const { return type() == Type::ContainerStart; }
- bool isContainerEnd() const { return type() == Type::ContainerEnd; }
+ bool isInlineBoxStart() const { return type() == Type::InlineBoxStart; }
+ bool isInlineBoxEnd() const { return type() == Type::InlineBoxEnd; }
private:
const Box* m_layoutBox { nullptr };
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2020-10-31 12:18:33 UTC (rev 269222)
@@ -174,7 +174,7 @@
// We are only interested in pre-wrap trailing content.
break;
}
- auto preWrapVisuallyCollapsibleInlineItem = run.isContainerStart() || run.isContainerEnd() || run.hasTrailingWhitespace();
+ auto preWrapVisuallyCollapsibleInlineItem = run.isInlineBoxStart() || run.isInlineBoxEnd() || run.hasTrailingWhitespace();
if (!preWrapVisuallyCollapsibleInlineItem)
break;
ASSERT(!run.hasCollapsibleTrailingWhitespace());
@@ -219,10 +219,10 @@
appendLineBreak(inlineItem);
else if (inlineItem.isWordBreakOpportunity())
appendWordBreakOpportunity(inlineItem);
- else if (inlineItem.isContainerStart())
- appendInlineContainerStart(inlineItem, logicalWidth);
- else if (inlineItem.isContainerEnd())
- appendInlineContainerEnd(inlineItem, logicalWidth);
+ else if (inlineItem.isInlineBoxStart())
+ appendInlineBoxStart(inlineItem, logicalWidth);
+ else if (inlineItem.isInlineBoxEnd())
+ appendInlineBoxEnd(inlineItem, logicalWidth);
else if (inlineItem.layoutBox().isReplacedBox())
appendReplacedInlineBox(inlineItem, logicalWidth);
else if (inlineItem.isBox())
@@ -241,7 +241,7 @@
m_contentLogicalWidth += logicalWidth;
}
-void Line::appendInlineContainerStart(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
+void Line::appendInlineBoxStart(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
{
// This is really just a placeholder to mark the start of the inline level container <span>.
auto& boxGeometry = formattingContext().geometryForBox(inlineItem.layoutBox());
@@ -249,7 +249,7 @@
appendNonBreakableSpace(inlineItem, adjustedRunStart, logicalWidth);
}
-void Line::appendInlineContainerEnd(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
+void Line::appendInlineBoxEnd(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
{
// This is really just a placeholder to mark the end of the inline level container </span>.
auto removeTrailingLetterSpacing = [&] {
@@ -282,7 +282,7 @@
// Not that when the inline container has preserve whitespace style, "<span style="white-space: pre"> </span> " <- this whitespace stays around.
if (run.isText())
return run.hasCollapsibleTrailingWhitespace();
- ASSERT(run.isContainerStart() || run.isContainerEnd() || run.isWordBreakOpportunity());
+ ASSERT(run.isInlineBoxStart() || run.isInlineBoxEnd() || run.isWordBreakOpportunity());
}
// Leading whitespace.
return !isWhitespacePreserved(style);
@@ -358,12 +358,12 @@
return false;
// Note that this does not check whether the inline container has content. It simply checks if the container itself is considered non-empty.
- if (run.isContainerStart() || run.isContainerEnd()) {
+ if (run.isInlineBoxStart() || run.isInlineBoxEnd()) {
if (!run.logicalWidth())
return false;
// Margin does not make the container visually non-empty. Check if it has border or padding.
auto& boxGeometry = formattingContext().geometryForBox(run.layoutBox());
- if (run.isContainerStart())
+ if (run.isInlineBoxStart())
return boxGeometry.borderLeft() || (boxGeometry.paddingLeft() && boxGeometry.paddingLeft().value());
return boxGeometry.borderRight() || (boxGeometry.paddingRight() && boxGeometry.paddingRight().value());
}
@@ -445,7 +445,7 @@
// not produce a run since in ::appendText() we see it as a fully collapsible run.
for (auto index = *m_firstTrimmableRunIndex + 1; index < m_runs.size(); ++index) {
auto& run = m_runs[index];
- ASSERT(run.isContainerStart() || run.isContainerEnd() || run.isLineBreak());
+ ASSERT(run.isInlineBoxStart() || run.isInlineBoxEnd() || run.isLineBreak());
run.moveHorizontally(-trimmableWidth);
}
if (!trimmableRun.textContent()->length()) {
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h 2020-10-31 12:18:33 UTC (rev 269222)
@@ -71,8 +71,8 @@
bool isSoftLineBreak() const { return m_type == InlineItem::Type::SoftLineBreak; }
bool isHardLineBreak() const { return m_type == InlineItem::Type::HardLineBreak; }
bool isWordBreakOpportunity() const { return m_type == InlineItem::Type::WordBreakOpportunity; }
- bool isContainerStart() const { return m_type == InlineItem::Type::ContainerStart; }
- bool isContainerEnd() const { return m_type == InlineItem::Type::ContainerEnd; }
+ bool isInlineBoxStart() const { return m_type == InlineItem::Type::InlineBoxStart; }
+ bool isInlineBoxEnd() const { return m_type == InlineItem::Type::InlineBoxEnd; }
const Box& layoutBox() const { return *m_layoutBox; }
const RenderStyle& style() const { return m_layoutBox->style(); }
@@ -140,8 +140,8 @@
void appendTextContent(const InlineTextItem&, InlineLayoutUnit logicalWidth);
void appendNonReplacedInlineBox(const InlineItem&, InlineLayoutUnit logicalWidth);
void appendReplacedInlineBox(const InlineItem&, InlineLayoutUnit logicalWidth);
- void appendInlineContainerStart(const InlineItem&, InlineLayoutUnit logicalWidth);
- void appendInlineContainerEnd(const InlineItem&, InlineLayoutUnit logicalWidth);
+ void appendInlineBoxStart(const InlineItem&, InlineLayoutUnit logicalWidth);
+ void appendInlineBoxEnd(const InlineItem&, InlineLayoutUnit logicalWidth);
void appendLineBreak(const InlineItem&);
void appendWordBreakOpportunity(const InlineItem&);
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (269221 => 269222)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-10-31 06:52:36 UTC (rev 269221)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-10-31 12:18:33 UTC (rev 269222)
@@ -174,7 +174,7 @@
inline void LineCandidate::InlineContent::appendInlineItem(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
{
- ASSERT(inlineItem.isText() || inlineItem.isBox() || inlineItem.isContainerStart() || inlineItem.isContainerEnd());
+ ASSERT(inlineItem.isText() || inlineItem.isBox() || inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd());
auto collapsibleWidth = [&]() -> Optional<InlineLayoutUnit> {
if (!inlineItem.isText())
return { };
@@ -243,10 +243,10 @@
if (layoutBox.isReplacedBox())
return boxGeometry.marginBoxWidth();
- if (inlineItem.isContainerStart())
+ if (inlineItem.isInlineBoxStart())
return boxGeometry.marginStart() + boxGeometry.borderLeft() + boxGeometry.paddingLeft().valueOr(0);
- if (inlineItem.isContainerEnd())
+ if (inlineItem.isInlineBoxEnd())
return boxGeometry.marginEnd() + boxGeometry.borderRight() + boxGeometry.paddingRight().valueOr(0);
// Non-replaced inline box (e.g. inline-block)
@@ -474,7 +474,7 @@
accumulatedWidth += floatWidth;
continue;
}
- if (inlineItem.isText() || inlineItem.isContainerStart() || inlineItem.isContainerEnd() || inlineItem.isBox()) {
+ if (inlineItem.isText() || inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd() || inlineItem.isBox()) {
auto logicalWidth = inlineItemWidth(inlineItem, currentLogicalRight);
lineCandidate.inlineContent.appendInlineItem(inlineItem, logicalWidth);
currentLogicalRight += logicalWidth;
@@ -519,7 +519,7 @@
// [text][float box][text] is essentially just [text][text]
continue;
}
- if (inlineItem.isContainerStart() || inlineItem.isContainerEnd()) {
+ if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd()) {
// There's no wrapping opportunity between <span>text, <span></span> or </span>text.
continue;
}
@@ -534,7 +534,7 @@
// [ex-][ample] vs. [ex-][container start][container end][ample]
// where [ex-] is startContent and [ample] is the nextContent.
for (auto candidateIndex = *previousInlineItemIndex + 1; candidateIndex < index; ++candidateIndex) {
- if (m_inlineItems[candidateIndex].isContainerStart()) {
+ if (m_inlineItems[candidateIndex].isInlineBoxStart()) {
// inline content and [container start] and [container end] form unbreakable content.
// ex-<span></span>ample : wrap opportunity is after "ex-".
// ex-</span></span>ample : wrap opportunity is after "ex-</span></span>".