Diff
Modified: trunk/Source/WebCore/ChangeLog (281799 => 281800)
--- trunk/Source/WebCore/ChangeLog 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/ChangeLog 2021-08-31 13:47:17 UTC (rev 281800)
@@ -1,3 +1,130 @@
+2021-08-31 Alan Bujtas <[email protected]>
+
+ [LFC][Integration] Make naming more consistent across Layout::Run and Integration::Run structs
+ https://bugs.webkit.org/show_bug.cgi?id=229693
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for merging these 2 structs.
+
+ * display/DisplayTreeBuilder.cpp:
+ (WebCore::Display::TreeBuilder::buildInlineDisplayTree):
+ * display/css/DisplayBoxFactory.cpp:
+ (WebCore::Display::BoxFactory::displayBoxForTextRun const):
+ * display/css/DisplayBoxFactory.h:
+ * display/css/DisplayTextBox.cpp:
+ (WebCore::Display::TextBox::TextBox):
+ * display/css/DisplayTextBox.h:
+ (WebCore::Display::TextBox::expansion const):
+ (WebCore::Display::TextBox::text const):
+ * layout/Verification.cpp:
+ (WebCore::Layout::checkForMatchingNonTextRuns):
+ (WebCore::Layout::checkForMatchingTextRuns):
+ (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
+ * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+ (WebCore::Layout::InlineDisplayContentBuilder::build):
+ (WebCore::Layout::InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineContent):
+ (WebCore::Layout::InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineSpanningInlineBoxes):
+ * layout/formattingContexts/inline/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::lineLayout):
+ (WebCore::Layout::InlineFormattingContext::computeStaticPositionForOutOfFlowContent):
+ * layout/formattingContexts/inline/InlineFormattingState.h:
+ (WebCore::Layout::InlineFormattingState::runs const):
+ (WebCore::Layout::InlineFormattingState::runs):
+ (WebCore::Layout::InlineFormattingState::addRun):
+ (WebCore::Layout::InlineFormattingState::clearLineAndRuns):
+ (WebCore::Layout::InlineFormattingState::shrinkToFit):
+ (WebCore::Layout::InlineFormattingState::lineRuns const): Deleted.
+ (WebCore::Layout::InlineFormattingState::lineRuns): Deleted.
+ (WebCore::Layout::InlineFormattingState::addLineRun): Deleted.
+ * layout/formattingContexts/inline/InlineLine.h:
+ (WebCore::Layout::Line::Run::expansion const):
+ (WebCore::Layout::Line::Run::setExpansion):
+ * layout/formattingContexts/inline/InlineLineRun.h:
+ (WebCore::Layout::Run::style const):
+ (WebCore::Layout::Run::Run):
+ (WebCore::Layout::Run::Text::Text):
+ (WebCore::Layout::LineRun::Text::start const): Deleted.
+ (WebCore::Layout::LineRun::Text::end const): Deleted.
+ (WebCore::Layout::LineRun::Text::length const): Deleted.
+ (WebCore::Layout::LineRun::Text::originalContent const): Deleted.
+ (WebCore::Layout::LineRun::Text::renderedContent const): Deleted.
+ (WebCore::Layout::LineRun::Text::hasHyphen const): Deleted.
+ (WebCore::Layout::LineRun::isText const): Deleted.
+ (WebCore::Layout::LineRun::isSoftLineBreak const): Deleted.
+ (WebCore::Layout::LineRun::isLineBreakBox const): Deleted.
+ (WebCore::Layout::LineRun::isLineBreak const): Deleted.
+ (WebCore::Layout::LineRun::isAtomicInlineLevelBox const): Deleted.
+ (WebCore::Layout::LineRun::isInlineBox const): Deleted.
+ (WebCore::Layout::LineRun::isNonRootInlineBox const): Deleted.
+ (WebCore::Layout::LineRun::isRootInlineBox const): Deleted.
+ (WebCore::Layout::LineRun::isGenericInlineLevelBox const): Deleted.
+ (WebCore::Layout::LineRun::isInlineLevelBox const): Deleted.
+ (WebCore::Layout::LineRun::isNonRootInlineLevelBox const): Deleted.
+ (WebCore::Layout::LineRun::type const): Deleted.
+ (WebCore::Layout::LineRun::hasContent const): Deleted.
+ (WebCore::Layout::LineRun::isLineSpanning const): Deleted.
+ (WebCore::Layout::LineRun::logicalRect const): Deleted.
+ (WebCore::Layout::LineRun::inkOverflow const): Deleted.
+ (WebCore::Layout::LineRun::logicalTop const): Deleted.
+ (WebCore::Layout::LineRun::logicalBottom const): Deleted.
+ (WebCore::Layout::LineRun::logicalLeft const): Deleted.
+ (WebCore::Layout::LineRun::logicalRight const): Deleted.
+ (WebCore::Layout::LineRun::logicalWidth const): Deleted.
+ (WebCore::Layout::LineRun::logicalHeight const): Deleted.
+ (WebCore::Layout::LineRun::moveVertically): Deleted.
+ (WebCore::Layout::LineRun::text): Deleted.
+ (WebCore::Layout::LineRun::text const): Deleted.
+ (WebCore::Layout::LineRun::expansion const): Deleted.
+ (WebCore::Layout::LineRun::layoutBox const): Deleted.
+ (WebCore::Layout::LineRun::lineIndex const): Deleted.
+ (WebCore::Layout::LineRun::LineRun): Deleted.
+ (WebCore::Layout::LineRun::Text::Text): Deleted.
+ * layout/formattingContexts/table/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
+ * layout/integration/LayoutIntegrationInlineContent.cpp:
+ (WebCore::LayoutIntegration::InlineContent::iteratorForTextRun const):
+ * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+ (WebCore::LayoutIntegration::InlineContentBuilder::build const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayRuns const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const): Deleted.
+ * layout/integration/LayoutIntegrationInlineContentBuilder.h:
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::paint):
+ (WebCore::LayoutIntegration::LineLayout::hitTest):
+ (WebCore::LayoutIntegration::LineLayout::paintTextRunUsingPhysicalCoordinates):
+ * layout/integration/LayoutIntegrationPagination.cpp:
+ (WebCore::LayoutIntegration::makeAdjustedContent):
+ * layout/integration/LayoutIntegrationRun.h:
+ (WebCore::LayoutIntegration::Run::logicalRect const):
+ (WebCore::LayoutIntegration::Run::text):
+ (WebCore::LayoutIntegration::Run::text const):
+ (WebCore::LayoutIntegration::Run::isLineBreak const):
+ (WebCore::LayoutIntegration::Run::Run):
+ (WebCore::LayoutIntegration::Run::Text::Text):
+ (WebCore::LayoutIntegration::Run::TextContent::start const): Deleted.
+ (WebCore::LayoutIntegration::Run::TextContent::end const): Deleted.
+ (WebCore::LayoutIntegration::Run::TextContent::length const): Deleted.
+ (WebCore::LayoutIntegration::Run::TextContent::originalContent const): Deleted.
+ (WebCore::LayoutIntegration::Run::TextContent::renderedContent const): Deleted.
+ (WebCore::LayoutIntegration::Run::TextContent::hasHyphen const): Deleted.
+ (WebCore::LayoutIntegration::Run::rect const): Deleted.
+ (WebCore::LayoutIntegration::Run::textContent): Deleted.
+ (WebCore::LayoutIntegration::Run::textContent const): Deleted.
+ (WebCore::LayoutIntegration::Run::TextContent::TextContent): Deleted.
+ * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
+ (WebCore::LayoutIntegration::RunIteratorModernPath::isText const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::rect const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::hasHyphen const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::text const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::start const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::end const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::length const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::traverseNextTextRun):
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::showInlineTreeAndRuns):
+
2021-08-31 Antti Koivisto <[email protected]>
[CSS Cascade Layers] Compute order correctly for late added sublayers
Modified: trunk/Source/WebCore/display/DisplayTreeBuilder.cpp (281799 => 281800)
--- trunk/Source/WebCore/display/DisplayTreeBuilder.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/display/DisplayTreeBuilder.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -305,7 +305,7 @@
{
auto& inlineFormattingState = layoutState.establishedInlineFormattingState(inlineFormattingRoot);
- for (auto& run : inlineFormattingState.lineRuns()) {
+ for (auto& run : inlineFormattingState.runs()) {
if (run.isRootInlineBox()) {
// Not supported yet.
continue;
Modified: trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp (281799 => 281800)
--- trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -143,7 +143,7 @@
return makeUnique<Box>(m_treeBuilder.tree(), pixelSnappedBorderBoxRect, WTFMove(style), flags);
}
-std::unique_ptr<Box> BoxFactory::displayBoxForTextRun(const Layout::LineRun& run, const Layout::LineGeometry& lineGeometry, const ContainingBlockContext& containingBlockContext) const
+std::unique_ptr<Box> BoxFactory::displayBoxForTextRun(const Layout::Run& run, const Layout::LineGeometry& lineGeometry, const ContainingBlockContext& containingBlockContext) const
{
UNUSED_PARAM(lineGeometry);
ASSERT(run.text());
Modified: trunk/Source/WebCore/display/css/DisplayBoxFactory.h (281799 => 281800)
--- trunk/Source/WebCore/display/css/DisplayBoxFactory.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/display/css/DisplayBoxFactory.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -41,7 +41,7 @@
class BoxGeometry;
class ContainerBox;
class LineGeometry;
-struct LineRun;
+struct Run;
}
namespace Display {
@@ -74,7 +74,7 @@
std::unique_ptr<Box> displayBoxForBodyBox(const Layout::Box&, const Layout::BoxGeometry&, const ContainingBlockContext&, RootBackgroundPropagation) const;
std::unique_ptr<Box> displayBoxForLayoutBox(const Layout::Box&, const Layout::BoxGeometry&, const ContainingBlockContext&) const;
- std::unique_ptr<Box> displayBoxForTextRun(const Layout::LineRun&, const Layout::LineGeometry&, const ContainingBlockContext&) const;
+ std::unique_ptr<Box> displayBoxForTextRun(const Layout::Run&, const Layout::LineGeometry&, const ContainingBlockContext&) const;
private:
std::unique_ptr<Box> displayBoxForLayoutBox(const Layout::Box&, const Layout::BoxGeometry&, const ContainingBlockContext&, const RenderStyle* styleForBackground, Style&&) const;
Modified: trunk/Source/WebCore/display/css/DisplayTextBox.cpp (281799 => 281800)
--- trunk/Source/WebCore/display/css/DisplayTextBox.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/display/css/DisplayTextBox.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -36,7 +36,7 @@
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(TextBox);
-TextBox::TextBox(Tree& tree, UnadjustedAbsoluteFloatRect borderBox, Style&& displayStyle, const Layout::LineRun& lineRun)
+TextBox::TextBox(Tree& tree, UnadjustedAbsoluteFloatRect borderBox, Style&& displayStyle, const Layout::Run& lineRun)
: Box(tree, borderBox, WTFMove(displayStyle), { TypeFlags::TextBox })
, m_expansion(lineRun.expansion())
, m_text(lineRun.text().value())
Modified: trunk/Source/WebCore/display/css/DisplayTextBox.h (281799 => 281800)
--- trunk/Source/WebCore/display/css/DisplayTextBox.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/display/css/DisplayTextBox.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -38,17 +38,17 @@
class TextBox : public Box {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(TextBox);
public:
- TextBox(Tree&, UnadjustedAbsoluteFloatRect borderBox, Style&&, const Layout::LineRun&);
+ TextBox(Tree&, UnadjustedAbsoluteFloatRect borderBox, Style&&, const Layout::Run&);
- Layout::LineRun::Expansion expansion() const { return m_expansion; }
- const Layout::LineRun::Text& text() const { return m_text; }
+ Layout::Run::Expansion expansion() const { return m_expansion; }
+ const Layout::Run::Text& text() const { return m_text; }
private:
const char* boxName() const final;
String debugDescription() const final;
- Layout::LineRun::Expansion m_expansion;
- Layout::LineRun::Text m_text;
+ Layout::Run::Expansion m_expansion;
+ Layout::Run::Text m_text;
};
} // namespace Display
Modified: trunk/Source/WebCore/layout/Verification.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/Verification.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/Verification.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -70,24 +70,24 @@
&& areEssentiallyEqual(a.height(), b.height());
}
-static bool checkForMatchingNonTextRuns(const LineRun& lineRun, const WebCore::LegacyInlineBox& inlineBox)
+static bool checkForMatchingNonTextRuns(const Run& run, const WebCore::LegacyInlineBox& inlineBox)
{
- return areEssentiallyEqual(inlineBox.left(), lineRun.logicalLeft())
- && areEssentiallyEqual(inlineBox.right(), lineRun.logicalRight())
- && areEssentiallyEqual(inlineBox.top(), lineRun.logicalTop())
- && areEssentiallyEqual(inlineBox.bottom(), lineRun.logicalBottom());
+ return areEssentiallyEqual(inlineBox.left(), run.logicalLeft())
+ && areEssentiallyEqual(inlineBox.right(), run.logicalRight())
+ && areEssentiallyEqual(inlineBox.top(), run.logicalTop())
+ && areEssentiallyEqual(inlineBox.bottom(), run.logicalBottom());
}
-static bool checkForMatchingTextRuns(const LineRun& lineRun, const WebCore::LegacyInlineTextBox& inlineTextBox)
+static bool checkForMatchingTextRuns(const Run& run, const WebCore::LegacyInlineTextBox& inlineTextBox)
{
- if (!lineRun.text())
+ if (!run.text())
return false;
- return areEssentiallyEqual(inlineTextBox.left(), lineRun.logicalLeft())
- && areEssentiallyEqual(inlineTextBox.right(), lineRun.logicalRight())
- && areEssentiallyEqual(inlineTextBox.top(), lineRun.logicalTop())
- && areEssentiallyEqual(inlineTextBox.bottom(), lineRun.logicalBottom())
- && (inlineTextBox.isLineBreak() || (inlineTextBox.start() == lineRun.text()->start() && inlineTextBox.end() == lineRun.text()->end()));
+ return areEssentiallyEqual(inlineTextBox.left(), run.logicalLeft())
+ && areEssentiallyEqual(inlineTextBox.right(), run.logicalRight())
+ && areEssentiallyEqual(inlineTextBox.top(), run.logicalTop())
+ && areEssentiallyEqual(inlineTextBox.bottom(), run.logicalBottom())
+ && (inlineTextBox.isLineBreak() || (inlineTextBox.start() == run.text()->start() && inlineTextBox.end() == run.text()->end()));
}
static void collectFlowBoxSubtree(const LegacyInlineFlowBox& flowbox, Vector<WebCore::LegacyInlineBox*>& inlineBoxes)
@@ -118,7 +118,7 @@
static bool outputMismatchingComplexLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const ContainerBox& inlineFormattingRoot)
{
auto& inlineFormattingState = layoutState.establishedFormattingState(inlineFormattingRoot);
- auto& lineRuns = downcast<InlineFormattingState>(inlineFormattingState).lineRuns();
+ auto& runs = downcast<InlineFormattingState>(inlineFormattingState).runs();
// Collect inlineboxes.
Vector<WebCore::LegacyInlineBox*> inlineBoxes;
collectInlineBoxes(blockFlow, inlineBoxes);
@@ -126,16 +126,16 @@
auto mismatched = false;
unsigned runIndex = 0;
- if (inlineBoxes.size() != lineRuns.size()) {
- stream << "Warning: mismatching number of runs: inlineboxes(" << inlineBoxes.size() << ") vs. inline runs(" << lineRuns.size() << ")";
+ if (inlineBoxes.size() != runs.size()) {
+ stream << "Warning: mismatching number of runs: inlineboxes(" << inlineBoxes.size() << ") vs. inline runs(" << runs.size() << ")";
stream.nextLine();
}
- for (unsigned inlineBoxIndex = 0; inlineBoxIndex < inlineBoxes.size() && runIndex < lineRuns.size(); ++inlineBoxIndex) {
- auto& lineRun = lineRuns[runIndex];
+ for (unsigned inlineBoxIndex = 0; inlineBoxIndex < inlineBoxes.size() && runIndex < runs.size(); ++inlineBoxIndex) {
+ auto& run = runs[runIndex];
auto* inlineBox = inlineBoxes[inlineBoxIndex];
auto* inlineTextBox = is<WebCore::LegacyInlineTextBox>(inlineBox) ? downcast<WebCore::LegacyInlineTextBox>(inlineBox) : nullptr;
- bool matchingRuns = inlineTextBox ? checkForMatchingTextRuns(lineRun, *inlineTextBox) : checkForMatchingNonTextRuns(lineRun, *inlineBox);
+ bool matchingRuns = inlineTextBox ? checkForMatchingTextRuns(run, *inlineTextBox) : checkForMatchingNonTextRuns(run, *inlineBox);
if (!matchingRuns) {
@@ -153,9 +153,9 @@
stream << " (" << inlineBox->logicalLeft() << ", " << inlineBox->logicalTop() << ") (" << inlineBox->logicalWidth() << "x" << inlineBox->logicalHeight() << ")";
stream << " inline run";
- if (lineRun.text())
- stream << " (" << lineRun.text()->start() << ", " << lineRun.text()->end() << ")";
- stream << " (" << lineRun.logicalLeft() << ", " << lineRun.logicalTop() << ") (" << lineRun.logicalWidth() << "x" << lineRun.logicalHeight() << ")";
+ if (run.text())
+ stream << " (" << run.text()->start() << ", " << run.text()->end() << ")";
+ stream << " (" << run.logicalLeft() << ", " << run.logicalTop() << ") (" << run.logicalWidth() << "x" << run.logicalHeight() << ")";
stream.nextLine();
mismatched = true;
}
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -50,10 +50,10 @@
// Every line starts with a root run, even the empty ones.
auto rootInlineBoxRect = lineBox.logicalRectForRootInlineBox();
rootInlineBoxRect.moveBy(lineBoxLogicalTopLeft);
- formattingState.addLineRun({ lineIndex, LineRun::Type::RootInlineBox, root(), rootInlineBoxRect, rootInlineBoxRect, { }, { }, lineBox.rootInlineBox().hasContent()});
+ formattingState.addRun({ lineIndex, Run::Type::RootInlineBox, root(), rootInlineBoxRect, rootInlineBoxRect, { }, { }, lineBox.rootInlineBox().hasContent()});
// Spanning inline boxes start at the very beginning of the line.
- auto lineSpanningInlineBoxIndex = formattingState.lineRuns().size();
+ auto lineSpanningInlineBoxIndex = formattingState.runs().size();
createRunsAndUpdateGeometryForLineContent(lineContent, lineBox, lineBoxLogicalTopLeft, lineIndex);
createRunsAndUpdateGeometryForLineSpanningInlineBoxes(lineBox, lineBoxLogicalTopLeft, lineIndex, lineSpanningInlineBoxIndex);
}
@@ -94,13 +94,13 @@
auto adjustedContentToRender = [&] {
return text->needsHyphen ? makeString(content.substring(text->start, text->length), style.hyphenString()) : String();
};
- formattingState.addLineRun({ lineIndex
- , LineRun::Type::Text
+ formattingState.addRun({ lineIndex
+ , Run::Type::Text
, layoutBox
, textRunRect
, inkOverflow()
, lineRun.expansion()
- , LineRun::Text { text->start, text->length, content, adjustedContentToRender(), text->needsHyphen } });
+ , Run::Text { text->start, text->length, content, adjustedContentToRender(), text->needsHyphen } });
break;
}
case InlineItem::Type::SoftLineBreak: {
@@ -109,13 +109,13 @@
ASSERT(lineRun.textContent() && is<InlineTextBox>(layoutBox));
auto& text = lineRun.textContent();
- formattingState.addLineRun({ lineIndex
- , LineRun::Type::SoftLineBreak
+ formattingState.addRun({ lineIndex
+ , Run::Type::SoftLineBreak
, layoutBox
, softLineBreakRunRect
, softLineBreakRunRect
, lineRun.expansion()
- , LineRun::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() } });
+ , Run::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() } });
break;
}
case InlineItem::Type::HardLineBreak: {
@@ -122,7 +122,7 @@
// Only hard linebreaks have associated layout boxes.
auto lineBreakBoxRect = lineBox.logicalRectForLineBreakBox(layoutBox);
lineBreakBoxRect.moveBy(lineBoxLogicalTopLeft);
- formattingState.addLineRun({ lineIndex, LineRun::Type::LineBreakBox, layoutBox, lineBreakBoxRect, lineBreakBoxRect, lineRun.expansion(), { } });
+ formattingState.addRun({ lineIndex, Run::Type::LineBreakBox, layoutBox, lineBreakBoxRect, lineBreakBoxRect, lineRun.expansion(), { } });
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
boxGeometry.setLogicalTopLeft(toLayoutPoint(lineBreakBoxRect.topLeft()));
@@ -136,7 +136,7 @@
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
auto logicalBorderBox = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, boxGeometry);
logicalBorderBox.moveBy(lineBoxLogicalTopLeft);
- formattingState.addLineRun({ lineIndex, LineRun::Type::AtomicInlineLevelBox, layoutBox, logicalBorderBox, logicalBorderBox, lineRun.expansion(), { } });
+ formattingState.addRun({ lineIndex, Run::Type::AtomicInlineLevelBox, layoutBox, logicalBorderBox, logicalBorderBox, lineRun.expansion(), { } });
auto borderBoxLogicalTopLeft = logicalBorderBox.topLeft();
// Note that inline boxes are relative to the line and their top position can be negative.
@@ -152,7 +152,7 @@
inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
if (lineBox.hasContent()) {
// FIXME: It's expected to not have any runs on empty lines. We should reconsider this.
- formattingState.addLineRun({ lineIndex, LineRun::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, lineBox.inlineLevelBoxForLayoutBox(layoutBox).hasContent() });
+ formattingState.addRun({ lineIndex, Run::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, lineBox.inlineLevelBoxForLayoutBox(layoutBox).hasContent() });
}
auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
@@ -202,7 +202,7 @@
auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
- formattingState.lineRuns().insert(lineSpanningInlineBoxIndex++, { lineIndex, LineRun::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, inlineLevelBox.hasContent(), true });
+ formattingState.runs().insert(lineSpanningInlineBoxIndex++, { lineIndex, Run::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, inlineLevelBox.hasContent(), true });
auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize };
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -181,7 +181,7 @@
void InlineFormattingContext::lineLayout(InlineItems& inlineItems, LineBuilder::InlineItemRange needsLayoutRange, const ConstraintsForInFlowContent& constraints)
{
auto& formattingState = this->formattingState();
- formattingState.lineRuns().reserveInitialCapacity(formattingState.inlineItems().size());
+ formattingState.runs().reserveInitialCapacity(formattingState.inlineItems().size());
InlineLayoutUnit lineLogicalTop = constraints.logicalTop();
struct PreviousLine {
LineBuilder::InlineItemRange range;
@@ -266,7 +266,7 @@
// place the out-of-flow box at the logical right position.
auto& formattingState = this->formattingState();
auto& lines = formattingState.lines();
- auto& lineRuns = formattingState.lineRuns();
+ auto& runs = formattingState.runs();
for (auto& outOfFlowBox : outOfFlowBoxes) {
auto& outOfFlowGeometry = formattingState.boxGeometry(*outOfFlowBox);
@@ -286,8 +286,8 @@
if (!previousContentSkippingFloats) {
// This is the first (non-float)child. Let's place it to the left of the first run.
// <div><img style="position: absolute">text content</div>
- ASSERT(lineRuns.size());
- outOfFlowGeometry.setLogicalTopLeft({ lineRuns[0].logicalLeft(), lines[0].lineBoxLogicalRect().top() });
+ ASSERT(runs.size());
+ outOfFlowGeometry.setLogicalTopLeft({ runs[0].logicalLeft(), lines[0].lineBoxLogicalRect().top() });
continue;
}
@@ -303,17 +303,17 @@
// The out-of-flow box should be placed after this inflow box.
// Skip to the last run of this layout box. The last run's geometry is used to compute the out-of-flow box's static position.
size_t lastRunIndexOnPreviousLayoutBox = 0;
- for (; lastRunIndexOnPreviousLayoutBox < lineRuns.size() && &lineRuns[lastRunIndexOnPreviousLayoutBox].layoutBox() != previousContentSkippingFloats; ++lastRunIndexOnPreviousLayoutBox) { }
- if (lastRunIndexOnPreviousLayoutBox == lineRuns.size()) {
+ for (; lastRunIndexOnPreviousLayoutBox < runs.size() && &runs[lastRunIndexOnPreviousLayoutBox].layoutBox() != previousContentSkippingFloats; ++lastRunIndexOnPreviousLayoutBox) { }
+ if (lastRunIndexOnPreviousLayoutBox == runs.size()) {
// FIXME: In very rare cases, the previous box's content might have been completely collapsed and left us with no run.
ASSERT_NOT_IMPLEMENTED_YET();
return;
}
- for (; lastRunIndexOnPreviousLayoutBox < lineRuns.size() && &lineRuns[lastRunIndexOnPreviousLayoutBox].layoutBox() == previousContentSkippingFloats; ++lastRunIndexOnPreviousLayoutBox) { }
+ for (; lastRunIndexOnPreviousLayoutBox < runs.size() && &runs[lastRunIndexOnPreviousLayoutBox].layoutBox() == previousContentSkippingFloats; ++lastRunIndexOnPreviousLayoutBox) { }
--lastRunIndexOnPreviousLayoutBox;
// Let's check if the previous run is the last run on the current line and use the next run's left instead.
- auto& previousRun = lineRuns[lastRunIndexOnPreviousLayoutBox];
- auto* nextRun = lastRunIndexOnPreviousLayoutBox + 1 < lineRuns.size() ? &lineRuns[lastRunIndexOnPreviousLayoutBox + 1] : nullptr;
+ auto& previousRun = runs[lastRunIndexOnPreviousLayoutBox];
+ auto* nextRun = lastRunIndexOnPreviousLayoutBox + 1 < runs.size() ? &runs[lastRunIndexOnPreviousLayoutBox + 1] : nullptr;
if (nextRun && nextRun->lineIndex() == previousRun.lineIndex()) {
// Previous and next runs are on the same line. The out-of-flow box is right at the previous run's logical right.
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingState.h (281799 => 281800)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingState.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingState.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -40,7 +40,7 @@
using InlineItems = Vector<InlineItem>;
using InlineLines = Vector<LineGeometry>;
using InlineLineBoxes = Vector<LineBox>;
-using InlineLineRuns = Vector<LineRun>;
+using InlineRuns = Vector<Run>;
// InlineFormattingState holds the state for a particular inline formatting context tree.
class InlineFormattingState : public FormattingState {
@@ -60,9 +60,9 @@
const InlineLineBoxes& lineBoxes() const { return m_lineBoxes; }
void addLineBox(LineBox&& lineBox) { m_lineBoxes.append(WTFMove(lineBox)); }
- const InlineLineRuns& lineRuns() const { return m_lineRuns; }
- InlineLineRuns& lineRuns() { return m_lineRuns; }
- void addLineRun(LineRun&& run) { m_lineRuns.append(WTFMove(run)); }
+ const InlineRuns& runs() const { return m_runs; }
+ InlineRuns& runs() { return m_runs; }
+ void addRun(Run&& run) { m_runs.append(WTFMove(run)); }
void setClearGapAfterLastLine(InlineLayoutUnit verticalGap);
InlineLayoutUnit clearGapAfterLastLine() const { return m_clearGapAfterLastLine; }
@@ -75,7 +75,7 @@
InlineItems m_inlineItems;
InlineLines m_lines;
InlineLineBoxes m_lineBoxes;
- InlineLineRuns m_lineRuns;
+ InlineRuns m_runs;
InlineLayoutUnit m_clearGapAfterLastLine { 0 };
};
@@ -89,7 +89,7 @@
{
m_lines.clear();
m_lineBoxes.clear();
- m_lineRuns.clear();
+ m_runs.clear();
m_clearGapAfterLastLine = { };
}
@@ -98,7 +98,7 @@
m_inlineItems.shrinkToFit();
m_lines.shrinkToFit();
m_lineBoxes.shrinkToFit();
- m_lineRuns.shrinkToFit();
+ m_runs.shrinkToFit();
}
}
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h (281799 => 281800)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -83,7 +83,7 @@
InlineLayoutUnit logicalLeft() const { return m_logicalLeft; }
InlineLayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
- const LineRun::Expansion& expansion() const { return m_expansion; }
+ const ::WebCore::Layout::Run::Expansion& expansion() const { return m_expansion; }
bool hasTrailingWhitespace() const { return m_trailingWhitespaceType != TrailingWhitespace::None; }
InlineLayoutUnit trailingWhitespaceWidth() const { return m_trailingWhitespaceWidth; }
@@ -98,7 +98,7 @@
void expand(const InlineTextItem&, InlineLayoutUnit logicalWidth);
void moveHorizontally(InlineLayoutUnit offset) { m_logicalLeft += offset; }
void shrinkHorizontally(InlineLayoutUnit width) { m_logicalWidth -= width; }
- void setExpansion(LineRun::Expansion expansion) { m_expansion = expansion; }
+ void setExpansion(::WebCore::Layout::Run::Expansion expansion) { m_expansion = expansion; }
void setNeedsHyphen(InlineLayoutUnit hyphenLogicalWidth);
enum class TrailingWhitespace {
@@ -124,7 +124,7 @@
TrailingWhitespace m_trailingWhitespaceType { TrailingWhitespace::None };
InlineLayoutUnit m_trailingWhitespaceWidth { 0 };
std::optional<Text> m_textContent;
- LineRun::Expansion m_expansion;
+ ::WebCore::Layout::Run::Expansion m_expansion;
};
using RunList = Vector<Run, 10>;
const RunList& runs() const { return m_runs; }
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h (281799 => 281800)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -34,7 +34,7 @@
namespace WebCore {
namespace Layout {
-struct LineRun {
+struct Run {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
struct Text {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
@@ -67,7 +67,7 @@
GenericInlineLevelBox
};
struct Expansion;
- LineRun(size_t lineIndex, Type, const Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, std::optional<Text> = std::nullopt, bool hasContent = true, bool isLineSpanning = false);
+ Run(size_t lineIndex, Type, const Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, std::optional<Text> = std::nullopt, bool hasContent = true, bool isLineSpanning = false);
bool isText() const { return m_type == Type::Text; }
bool isSoftLineBreak() const { return m_type == Type::SoftLineBreak; }
@@ -107,6 +107,8 @@
Expansion expansion() const { return m_expansion; }
const Box& layoutBox() const { return *m_layoutBox; }
+ const RenderStyle& style() const { return layoutBox().style(); }
+
size_t lineIndex() const { return m_lineIndex; }
private:
@@ -122,7 +124,7 @@
std::optional<Text> m_text;
};
-inline LineRun::LineRun(size_t lineIndex, Type type, const Layout::Box& layoutBox, const InlineRect& logicalRect, const InlineRect& inkOverflow, Expansion expansion, std::optional<Text> text, bool hasContent, bool isLineSpanning)
+inline Run::Run(size_t lineIndex, Type type, const Layout::Box& layoutBox, const InlineRect& logicalRect, const InlineRect& inkOverflow, Expansion expansion, std::optional<Text> text, bool hasContent, bool isLineSpanning)
: m_lineIndex(lineIndex)
, m_type(type)
, m_layoutBox(makeWeakPtr(layoutBox))
@@ -135,7 +137,7 @@
{
}
-inline LineRun::Text::Text(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
+inline Run::Text::Text(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
: m_start(start)
, m_length(length)
, m_hasHyphen(hasHyphen)
Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -164,7 +164,7 @@
}
if (cellBox.establishesInlineFormattingContext()) {
auto& inlineFormattingStatee = layoutState().establishedInlineFormattingState(cellBox);
- for (auto& run : inlineFormattingStatee.lineRuns())
+ for (auto& run : inlineFormattingStatee.runs())
run.moveVertically(intrinsicPaddingTop);
for (auto& line : inlineFormattingStatee.lines())
line.moveVertically(intrinsicPaddingTop);
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -79,7 +79,7 @@
TextRunIterator InlineContent::iteratorForTextRun(const Run& run) const
{
- ASSERT(run.textContent());
+ ASSERT(run.text());
return { RunIteratorModernPath { *this, static_cast<size_t>(&run - runs.begin()) } };
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -67,24 +67,24 @@
void InlineContentBuilder::build(const Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
{
- createDisplayLineRuns(inlineFormattingState.lines(), inlineFormattingState.lineRuns(), inlineContent);
+ createDisplayRuns(inlineFormattingState.lines(), inlineFormattingState.runs(), inlineContent);
createDisplayLines(inlineFormattingState.lines(), inlineContent);
}
-void InlineContentBuilder::createDisplayLineRuns(const Layout::InlineLines& lines, const Layout::InlineLineRuns& lineRuns, InlineContent& inlineContent) const
+void InlineContentBuilder::createDisplayRuns(const Layout::InlineLines& lines, const Layout::InlineRuns& runs, InlineContent& inlineContent) const
{
- if (lineRuns.isEmpty())
+ if (runs.isEmpty())
return;
- auto createDisplayBoxRun = [&](auto& lineRun) {
- if (lineRun.isRootInlineBox()) {
+ auto createDisplayBoxRun = [&](auto& run) {
+ if (run.isRootInlineBox()) {
// FIXME: Teach the run iterators to ignore the root inline box runs.
return;
}
- auto& layoutBox = lineRun.layoutBox();
- auto lineIndex = lineRun.lineIndex();
- auto runRect = FloatRect { lineRun.logicalRect() };
- auto inkOverflow = FloatRect { lineRun.inkOverflow() };
+ auto& layoutBox = run.layoutBox();
+ auto lineIndex = run.lineIndex();
+ auto runRect = FloatRect { run.logicalRect() };
+ auto inkOverflow = FloatRect { run.inkOverflow() };
auto& geometry = m_layoutState.geometryForBox(layoutBox);
runRect.setSize({ geometry.borderBoxWidth(), geometry.borderBoxHeight() });
if (lines[lineIndex].needsIntegralPosition()) {
@@ -91,14 +91,14 @@
runRect.setY(roundToInt(runRect.y()));
inkOverflow.setY(roundToInt(inkOverflow.y()));
}
- if (lineRun.isInlineBox()) {
- auto lineRunRect = lineRun.logicalRect();
+ if (run.isInlineBox()) {
+ auto runRect = run.logicalRect();
auto hasScrollableContent = [&] {
// In standards mode, inline boxes always start with an imaginary strut.
- return m_layoutState.inStandardsMode() || lineRun.hasContent() || geometry.horizontalBorder() || (geometry.horizontalPadding() && geometry.horizontalPadding().value());
+ return m_layoutState.inStandardsMode() || run.hasContent() || geometry.horizontalBorder() || (geometry.horizontalPadding() && geometry.horizontalPadding().value());
};
- inlineContent.nonRootInlineBoxes.append({ lineIndex, layoutBox, lineRunRect, hasScrollableContent() });
- if (!lineRun.isLineSpanning()) {
+ inlineContent.nonRootInlineBoxes.append({ lineIndex, layoutBox, runRect, hasScrollableContent() });
+ if (!run.isLineSpanning()) {
// FIXME: Run iterators with (text)runs spanning over multiple lines expect no "in-between" runs (e.g. line spanning or root inline boxes).
inlineContent.runs.append({ lineIndex, layoutBox, runRect, inkOverflow, { }, { } });
}
@@ -106,31 +106,31 @@
inlineContent.runs.append({ lineIndex, layoutBox, runRect, inkOverflow, { }, { } });
};
- auto createDisplayTextRun = [&](auto& lineRun) {
- auto& layoutBox = lineRun.layoutBox();
- auto lineIndex = lineRun.lineIndex();
- auto runRect = FloatRect { lineRun.logicalRect() };
- auto inkOverflow = FloatRect { lineRun.inkOverflow() };
+ auto createDisplayTextRun = [&](auto& run) {
+ auto& layoutBox = run.layoutBox();
+ auto lineIndex = run.lineIndex();
+ auto runRect = FloatRect { run.logicalRect() };
+ auto inkOverflow = FloatRect { run.inkOverflow() };
if (lines[lineIndex].needsIntegralPosition()) {
runRect.setY(roundToInt(runRect.y()));
inkOverflow.setY(roundToInt(inkOverflow.y()));
}
- auto text = lineRun.text();
+ auto text = run.text();
inlineContent.runs.append({ lineIndex
, layoutBox
, runRect
, inkOverflow
- , Run::Expansion { lineRun.expansion().behavior, lineRun.expansion().horizontalExpansion }
- , Run::TextContent { text->start(), text->length(), text->originalContent(), text->renderedContent(), text->hasHyphen() } });
+ , Run::Expansion { run.expansion().behavior, run.expansion().horizontalExpansion }
+ , Run::Text { text->start(), text->length(), text->originalContent(), text->renderedContent(), text->hasHyphen() } });
};
- inlineContent.runs.reserveInitialCapacity(lineRuns.size());
- for (auto& lineRun : lineRuns) {
- if (lineRun.text())
- createDisplayTextRun(lineRun);
+ inlineContent.runs.reserveInitialCapacity(runs.size());
+ for (auto& run : runs) {
+ if (run.text())
+ createDisplayTextRun(run);
else
- createDisplayBoxRun(lineRun);
+ createDisplayBoxRun(run);
}
}
@@ -160,13 +160,14 @@
// Similar to LegacyInlineFlowBox::addReplacedChildOverflow.
auto& box = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
+ auto runLogicalRect = run.logicalRect();
if (!box.hasSelfPaintingLayer()) {
auto childInkOverflow = box.logicalVisualOverflowRectForPropagation(&box.parent()->style());
- childInkOverflow.move(run.rect().x(), run.rect().y());
+ childInkOverflow.move(runLogicalRect.x(), runLogicalRect.y());
lineInkOverflowRect.unite(childInkOverflow);
}
auto childScrollableOverflow = box.logicalLayoutOverflowRectForPropagation(&box.parent()->style());
- childScrollableOverflow.move(run.rect().x(), run.rect().y());
+ childScrollableOverflow.move(runLogicalRect.x(), runLogicalRect.y());
scrollableOverflowRect.unite(childScrollableOverflow);
}
// Collect scrollable overflow from inline boxes. All other inline level boxes (e.g atomic inline level boxes) stretch the line.
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -46,7 +46,7 @@
void build(const Layout::InlineFormattingState&, InlineContent&) const;
private:
- void createDisplayLineRuns(const Layout::InlineLines&, const Layout::InlineLineRuns&, InlineContent&) const;
+ void createDisplayRuns(const Layout::InlineLines&, const Layout::InlineRuns&, InlineContent&) const;
void createDisplayLines(const Layout::InlineLines&, InlineContent&) const;
const Layout::LayoutState& m_layoutState;
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -455,7 +455,7 @@
paintRect.moveBy(-paintOffset);
for (auto& run : m_inlineContent->runsForRect(paintRect)) {
- if (run.textContent())
+ if (run.text())
paintTextRunUsingPhysicalCoordinates(paintInfo, paintOffset, m_inlineContent->lineForRun(run), run);
else if (auto& renderer = m_boxTree.rendererForLayoutBox(run.layoutBox()); is<RenderBox>(renderer) && renderer.isReplaced()) {
auto& renderBox = downcast<RenderBox>(renderer);
@@ -480,7 +480,7 @@
auto& renderer = m_boxTree.rendererForLayoutBox(run.layoutBox());
if (is<RenderText>(renderer)) {
- auto runRect = Layout::toLayoutRect(run.rect());
+ auto runRect = Layout::toLayoutRect(run.logicalRect());
runRect.moveBy(accumulatedOffset);
if (!locationInContainer.intersects(runRect))
@@ -551,7 +551,7 @@
if (run.style().visibility() != Visibility::Visible)
return;
- auto& textContent = *run.textContent();
+ auto& textContent = *run.text();
if (!textContent.length())
return;
@@ -560,7 +560,7 @@
auto physicalPaintOffset = paintOffset;
if (!blockIsHorizontalWriting) {
// FIXME: Figure out why this translate is required.
- physicalPaintOffset.move({ 0, -run.rect().height() });
+ physicalPaintOffset.move({ 0, -run.logicalRect().height() });
}
auto physicalRect = [&](const auto& rect) {
@@ -592,7 +592,7 @@
// TextRun expects the xPos to be adjusted with the aligment offset (e.g. when the line is center aligned
// and the run starts at 100px, due to the horizontal aligment, the xpos is supposed to be at 0px).
auto& fontCascade = style.fontCascade();
- auto xPos = run.rect().x() - (line.lineBoxLeft() + line.contentLeft());
+ auto xPos = run.logicalRect().x() - (line.lineBoxLeft() + line.contentLeft());
auto textRun = WebCore::TextRun { textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
@@ -603,7 +603,7 @@
// Painting uses only physical coordinates.
{
- auto runRect = physicalRect(run.rect());
+ auto runRect = physicalRect(run.logicalRect());
auto boxRect = FloatRect { FloatPoint { physicalPaintOffset.x() + runRect.x(), physicalPaintOffset.y() + runRect.y() }, runRect.size() };
auto textOrigin = FloatPoint { boxRect.x(), roundToDevicePixel(boxRect.y() + fontCascade.fontMetrics().ascent(), formattingContextRoot.document().deviceScaleFactor()) };
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -145,10 +145,10 @@
return Run {
run.lineIndex(),
run.layoutBox(),
- moveVertically(run.rect(), offset),
+ moveVertically(run.logicalRect(), offset),
moveVertically(run.inkOverflow(), offset),
run.expansion(),
- run.textContent()
+ run.text()
};
};
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRun.h (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRun.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRun.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -40,10 +40,10 @@
struct Run {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
- struct TextContent {
+ struct Text {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
public:
- TextContent(size_t position, size_t length, const String&, String adjustedContentToRender, bool hasHyphen);
+ Text(size_t position, size_t length, const String&, String adjustedContentToRender, bool hasHyphen);
size_t start() const { return m_start; }
size_t end() const { return start() + length(); }
@@ -61,15 +61,15 @@
};
struct Expansion;
- Run(size_t lineIndex, const Layout::Box&, const FloatRect&, const FloatRect& inkOverflow, Expansion, std::optional<TextContent> = std::nullopt);
+ Run(size_t lineIndex, const Layout::Box&, const FloatRect&, const FloatRect& inkOverflow, Expansion, std::optional<Text> = std::nullopt);
- const FloatRect& rect() const { return m_rect; }
+ const FloatRect& logicalRect() const { return m_rect; }
const FloatRect& inkOverflow() const { return m_inkOverflow; }
- std::optional<TextContent>& textContent() { return m_textContent; }
- const std::optional<TextContent>& textContent() const { return m_textContent; }
+ std::optional<Text>& text() { return m_text; }
+ const std::optional<Text>& text() const { return m_text; }
// FIXME: This information should be preserved at Run construction time.
- bool isLineBreak() const { return layoutBox().isLineBreakBox() || (textContent() && textContent()->originalContent() == "\n" && style().preserveNewline()); }
+ bool isLineBreak() const { return layoutBox().isLineBreakBox() || (text() && text()->originalContent() == "\n" && style().preserveNewline()); }
struct Expansion {
ExpansionBehavior behavior { DefaultExpansion };
@@ -94,20 +94,20 @@
FloatRect m_rect;
FloatRect m_inkOverflow;
Expansion m_expansion;
- std::optional<TextContent> m_textContent;
+ std::optional<Text> m_text;
};
-inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const FloatRect& rect, const FloatRect& inkOverflow, Expansion expansion, std::optional<TextContent> textContent)
+inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const FloatRect& rect, const FloatRect& inkOverflow, Expansion expansion, std::optional<Text> text)
: m_lineIndex(lineIndex)
, m_layoutBox(makeWeakPtr(layoutBox))
, m_rect(rect)
, m_inkOverflow(inkOverflow)
, m_expansion(expansion)
- , m_textContent(textContent)
+ , m_text(text)
{
}
-inline Run::TextContent::TextContent(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
+inline Run::Text::Text(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
: m_start(start)
, m_length(length)
, m_hasHyphen(hasHyphen)
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h (281799 => 281800)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h 2021-08-31 13:47:17 UTC (rev 281800)
@@ -48,9 +48,9 @@
{
}
- bool isText() const { return !!run().textContent(); }
+ bool isText() const { return !!run().text(); }
- FloatRect rect() const { return run().rect(); }
+ FloatRect rect() const { return run().logicalRect(); }
bool isHorizontal() const { return true; }
bool dirOverride() const { return false; }
@@ -61,11 +61,11 @@
unsigned char bidiLevel() const { return 0; }
- bool hasHyphen() const { return run().textContent()->hasHyphen(); }
- StringView text() const { return run().textContent()->originalContent(); }
- unsigned start() const { return run().textContent()->start(); }
- unsigned end() const { return run().textContent()->end(); }
- unsigned length() const { return run().textContent()->length(); }
+ bool hasHyphen() const { return run().text()->hasHyphen(); }
+ StringView text() const { return run().text()->originalContent(); }
+ unsigned start() const { return run().text()->start(); }
+ unsigned end() const { return run().text()->end(); }
+ unsigned length() const { return run().text()->length(); }
// FIXME: Make a shared generic version of this.
inline unsigned offsetForPosition(float x) const
@@ -137,7 +137,7 @@
void traverseNextTextRun()
{
ASSERT(!atEnd());
- ASSERT(run().textContent());
+ ASSERT(run().text());
auto& layoutBox = run().layoutBox();
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (281799 => 281800)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-08-31 12:48:14 UTC (rev 281799)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-08-31 13:47:17 UTC (rev 281800)
@@ -387,7 +387,7 @@
{
auto& inlineFormattingState = layoutState.establishedInlineFormattingState(inlineFormattingRoot);
auto& lines = inlineFormattingState.lines();
- auto& lineRuns = inlineFormattingState.lineRuns();
+ auto& runs = inlineFormattingState.runs();
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
auto addSpacing = [&] {
@@ -426,7 +426,7 @@
<< " size (" << logicalRect.width() << "x" << logicalRect.height() << ")";
stream.nextLine();
};
- for (auto& run : lineRuns) {
+ for (auto& run : runs) {
if (run.lineIndex() != lineIndex)
continue;
if (!run.layoutBox().isInlineLevelBox())
@@ -437,7 +437,7 @@
addSpacing();
stream << " Runs:";
stream.nextLine();
- for (auto& run : lineRuns) {
+ for (auto& run : runs) {
if (run.lineIndex() != lineIndex)
continue;
addSpacing();