Diff
Modified: trunk/Source/WebCore/ChangeLog (281904 => 281905)
--- trunk/Source/WebCore/ChangeLog 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/ChangeLog 2021-09-02 01:33:01 UTC (rev 281905)
@@ -1,3 +1,37 @@
+2021-09-01 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Do not generate integration runs out of IFC's display runs
+ https://bugs.webkit.org/show_bug.cgi?id=229719
+
+ Reviewed by Antti Koivisto.
+
+ Integration runs and IFC display runs hold the exact same set of data, so let's not duplicate then for the integration layer.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * display/css/DisplayTextBox.cpp:
+ (WebCore::Display::TextBox::debugDescription const):
+ * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+ (WebCore::Layout::InlineDisplayContentBuilder::build):
+ (WebCore::Layout::InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineSpanningInlineBoxes):
+ * layout/formattingContexts/inline/InlineLineRun.h:
+ (WebCore::Layout::Run::Text::originalContent const):
+ (WebCore::Layout::Run::Text::renderedContent const):
+ (WebCore::Layout::Run::setVerticalPositionIntegral):
+ * layout/formattingContexts/inline/InlineRect.h:
+ (WebCore::Layout::InlineRect::InlineRect):
+ * layout/integration/LayoutIntegrationInlineContent.h:
+ * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+ (WebCore::LayoutIntegration::InlineContentBuilder::build const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayRuns const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+ * layout/integration/LayoutIntegrationInlineContentBuilder.h:
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::paintTextRunUsingPhysicalCoordinates):
+ * layout/integration/LayoutIntegrationPagination.cpp:
+ (WebCore::LayoutIntegration::makeAdjustedContent):
+ * layout/integration/LayoutIntegrationRun.h: Removed.
+ * rendering/TextPainter.cpp:
+
2021-09-01 Marcos Caceres <[email protected]>
Add "payment" permissions policy
Modified: trunk/Source/WebCore/Headers.cmake (281904 => 281905)
--- trunk/Source/WebCore/Headers.cmake 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/Headers.cmake 2021-09-02 01:33:01 UTC (rev 281905)
@@ -768,6 +768,7 @@
layout/LayoutUnits.h
layout/MarginTypes.h
+ layout/formattingContexts/inline/InlineLineRun.h
layout/formattingContexts/inline/InlineRect.h
layout/integration/LayoutIntegrationInlineContent.h
@@ -775,7 +776,6 @@
layout/integration/LayoutIntegrationLineIterator.h
layout/integration/LayoutIntegrationLineIteratorLegacyPath.h
layout/integration/LayoutIntegrationLineIteratorModernPath.h
- layout/integration/LayoutIntegrationRun.h
layout/integration/LayoutIntegrationRunIterator.h
layout/integration/LayoutIntegrationRunIteratorLegacyPath.h
layout/integration/LayoutIntegrationRunIteratorModernPath.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (281904 => 281905)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-02 01:33:01 UTC (rev 281905)
@@ -2176,7 +2176,6 @@
6FB7D2DE250FD82E000207AA /* FlexFormattingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB7D2DA250FD7FC000207AA /* FlexFormattingState.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FC3F9472516756700A49BEA /* InlineLineRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FC3F9452516756600A49BEA /* InlineLineRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FCBDB97265DF2C80021EA7B /* LayoutContainingBlockChainIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FCBDB95265DF2C70021EA7B /* LayoutContainingBlockChainIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 6FCE1A1A22618ABD004F0343 /* LayoutIntegrationRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FCE1A1822618AB3004F0343 /* LayoutIntegrationRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FD09543251115220098877D /* LayoutGeometryRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FD09541251115220098877D /* LayoutGeometryRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FE198172178397C00446F08 /* InlineContentBreaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE198152178397C00446F08 /* InlineContentBreaker.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FE636E82647962900F0951E /* InlineFormattingQuirks.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE636E72647962900F0951E /* InlineFormattingQuirks.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10060,7 +10059,6 @@
6FC5CA9522E3599400B13E11 /* TableFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableFormattingContext.h; sourceTree = "<group>"; };
6FC5CA9622E3599500B13E11 /* TableFormattingState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableFormattingState.h; sourceTree = "<group>"; };
6FCBDB95265DF2C70021EA7B /* LayoutContainingBlockChainIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutContainingBlockChainIterator.h; sourceTree = "<group>"; };
- 6FCE1A1822618AB3004F0343 /* LayoutIntegrationRun.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationRun.h; sourceTree = "<group>"; };
6FD09541251115220098877D /* LayoutGeometryRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutGeometryRect.h; sourceTree = "<group>"; };
6FE198132178397B00446F08 /* InlineContentBreaker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineContentBreaker.cpp; sourceTree = "<group>"; };
6FE198152178397C00446F08 /* InlineContentBreaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineContentBreaker.h; sourceTree = "<group>"; };
@@ -29070,7 +29068,6 @@
E4ABABDB236088FD00FA4345 /* LayoutIntegrationLineLayout.h */,
E4312AB524B3265600678349 /* LayoutIntegrationPagination.cpp */,
E4312AB724B3265600678349 /* LayoutIntegrationPagination.h */,
- 6FCE1A1822618AB3004F0343 /* LayoutIntegrationRun.h */,
E4A664C72521B779007081DC /* LayoutIntegrationRunIterator.cpp */,
E4A664C62521B778007081DC /* LayoutIntegrationRunIterator.h */,
E4A664C52521B778007081DC /* LayoutIntegrationRunIteratorLegacyPath.h */,
@@ -33521,7 +33518,6 @@
E4D33F46252C50FC00837D05 /* LayoutIntegrationLineIteratorModernPath.h in Headers */,
E4ABABDD236088FE00FA4345 /* LayoutIntegrationLineLayout.h in Headers */,
E403B7A3251B11C10019E800 /* LayoutIntegrationPagination.h in Headers */,
- 6FCE1A1A22618ABD004F0343 /* LayoutIntegrationRun.h in Headers */,
E4A664CC2521D4AF007081DC /* LayoutIntegrationRunIterator.h in Headers */,
E4A664CF2521D4E2007081DC /* LayoutIntegrationRunIteratorLegacyPath.h in Headers */,
E4A664CE2521D4C9007081DC /* LayoutIntegrationRunIteratorModernPath.h in Headers */,
Modified: trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp (281904 => 281905)
--- trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -80,7 +80,7 @@
auto baseline = textRect.y() + style.fontMetrics().ascent();
auto expansion = textBox.expansion();
- auto textRun = TextRun { textBox.text().originalContent().substring(textBox.text().start(), textBox.text().length()), textRect.x(), expansion.horizontalExpansion, expansion.behavior };
+ auto textRun = TextRun { textBox.text().originalContent(), textRect.x(), expansion.horizontalExpansion, expansion.behavior };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
paintingContext.context.drawText(style.fontCascade(), textRun, { textRect.x(), baseline });
return;
Modified: trunk/Source/WebCore/display/css/DisplayTextBox.cpp (281904 => 281905)
--- trunk/Source/WebCore/display/css/DisplayTextBox.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/display/css/DisplayTextBox.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -53,7 +53,7 @@
TextStream stream;
stream << boxName() << " " << absoluteBoxRect() << " (" << this << ")";
- auto textContent = text().originalContent().substring(text().start(), text().length());
+ auto textContent = text().originalContent().substring(text().start(), text().length()).toString();
textContent.replaceWithLiteral('\\', "\\\\");
textContent.replaceWithLiteral('\n', "\\n");
const size_t maxPrintedLength = 80;
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (281904 => 281905)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -36,6 +36,7 @@
namespace WebCore {
namespace Layout {
+#define ALLOW_ROOT_AND_LINE_SPANNING_INLINE_BOX 0
InlineDisplayContentBuilder::InlineDisplayContentBuilder(const ContainerBox& formattingContextRoot, InlineFormattingState& formattingState)
: m_formattingContextRoot(formattingContextRoot)
@@ -47,11 +48,12 @@
void InlineDisplayContentBuilder::build(const LineBuilder::LineContent& lineContent, const LineBox& lineBox, const InlineLayoutPoint& lineBoxLogicalTopLeft, const size_t lineIndex)
{
auto& formattingState = this->formattingState();
+#if ALLOW_ROOT_AND_LINE_SPANNING_INLINE_BOX
// Every line starts with a root run, even the empty ones.
auto rootInlineBoxRect = lineBox.logicalRectForRootInlineBox();
rootInlineBoxRect.moveBy(lineBoxLogicalTopLeft);
formattingState.addRun({ lineIndex, Run::Type::RootInlineBox, root(), rootInlineBoxRect, rootInlineBoxRect, { }, { }, lineBox.rootInlineBox().hasContent()});
-
+#endif
// Spanning inline boxes start at the very beginning of the line.
auto lineSpanningInlineBoxIndex = formattingState.runs().size();
createRunsAndUpdateGeometryForLineContent(lineContent, lineBox, lineBoxLogicalTopLeft, lineIndex);
@@ -181,7 +183,7 @@
formattingState.lines().last().setNeedsIntegralPosition(lineNeedIntegralPosition);
}
-void InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineSpanningInlineBoxes(const LineBox& lineBox, const InlineLayoutPoint& lineBoxLogicalTopLeft, const size_t lineIndex, size_t lineSpanningInlineBoxIndex)
+void InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineSpanningInlineBoxes(const LineBox& lineBox, const InlineLayoutPoint& lineBoxLogicalTopLeft, const size_t /*lineIndex*/, size_t /*lineSpanningInlineBoxIndex*/)
{
if (!lineBox.hasContent()) {
// When a spanning inline box (e.g. <div>text<span><br></span></div>) lands on an empty line
@@ -202,8 +204,9 @@
auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
+#if ALLOW_ROOT_AND_LINE_SPANNING_INLINE_BOX
formattingState.runs().insert(lineSpanningInlineBoxIndex++, { lineIndex, Run::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, inlineLevelBox.hasContent(), true });
-
+#endif
auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize };
// Middle or end of the inline box. Let's stretch the box as needed.
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h (281904 => 281905)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-09-02 01:33:01 UTC (rev 281905)
@@ -44,8 +44,8 @@
size_t start() const { return m_start; }
size_t end() const { return start() + length(); }
size_t length() const { return m_length; }
- String originalContent() const { return m_originalContent; }
- String renderedContent() const { return m_adjustedContentToRender; }
+ StringView originalContent() const { return StringView(m_originalContent).substring(m_start, m_length); }
+ StringView renderedContent() const { return m_adjustedContentToRender.isNull() ? originalContent() : m_adjustedContentToRender; }
bool hasHyphen() const { return m_hasHyphen; }
@@ -111,6 +111,8 @@
size_t lineIndex() const { return m_lineIndex; }
+ void setVerticalPositionIntegral();
+
private:
const size_t m_lineIndex;
const Type m_type;
@@ -146,6 +148,12 @@
{
}
+inline void Run::setVerticalPositionIntegral()
+{
+ m_logicalRect.setTop(roundToInt(m_logicalRect.top()));
+ m_inkOverflow.setTop(roundToInt(m_inkOverflow.top()));
}
+
}
+}
#endif
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineRect.h (281904 => 281905)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineRect.h 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineRect.h 2021-09-02 01:33:01 UTC (rev 281905)
@@ -38,6 +38,7 @@
InlineRect(InlineLayoutUnit top, InlineLayoutUnit left, InlineLayoutUnit width, InlineLayoutUnit height);
InlineRect(const InlineLayoutPoint& topLeft, InlineLayoutUnit width, InlineLayoutUnit height);
InlineRect(const InlineLayoutPoint& topLeft, const InlineLayoutSize&);
+ InlineRect(const FloatRect&);
InlineLayoutUnit top() const;
InlineLayoutUnit left() const;
@@ -114,6 +115,11 @@
{
}
+inline InlineRect::InlineRect(const FloatRect& rect)
+ : InlineRect(rect.y(), rect.x(), rect.width(), rect.height())
+{
+}
+
#if ASSERT_ENABLED
inline void InlineRect::invalidatePosition()
{
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h (281904 => 281905)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h 2021-09-02 01:33:01 UTC (rev 281905)
@@ -27,8 +27,8 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "InlineLineRun.h"
#include "LayoutIntegrationLine.h"
-#include "LayoutIntegrationRun.h"
#include <wtf/IteratorRange.h>
#include <wtf/Vector.h>
#include <wtf/WeakPtr.h>
@@ -48,6 +48,8 @@
class RunIterator;
class TextRunIterator;
+using Run = Layout::Run;
+
struct InlineContent : public RefCounted<InlineContent> {
static Ref<InlineContent> create(const LineLayout& lineLayout) { return adoptRef(*new InlineContent(lineLayout)); }
~InlineContent();
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (281904 => 281905)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -29,10 +29,10 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "InlineFormattingState.h"
+#include "InlineLineRun.h"
#include "LayoutBoxGeometry.h"
#include "LayoutIntegrationBoxTree.h"
#include "LayoutIntegrationInlineContent.h"
-#include "LayoutIntegrationRun.h"
#include "LayoutReplacedBox.h"
#include "LayoutState.h"
#include "RenderBlockFlow.h"
@@ -65,38 +65,36 @@
{
}
-void InlineContentBuilder::build(const Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
+void InlineContentBuilder::build(Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
{
- createDisplayRuns(inlineFormattingState.runs(), inlineContent);
+ createDisplayRuns(inlineFormattingState, inlineContent);
createDisplayLines(inlineFormattingState.lines(), inlineContent);
}
-void InlineContentBuilder::createDisplayRuns(const Layout::InlineRuns& runs, InlineContent& inlineContent) const
+void InlineContentBuilder::createDisplayRuns(Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
{
- if (runs.isEmpty())
- return;
-
- inlineContent.runs.reserveInitialCapacity(runs.size());
- for (auto& run : runs) {
- if (auto text = run.text()) {
- inlineContent.runs.append({ run.lineIndex(), run.layoutBox(), run.logicalRect(), run.inkOverflow(), Run::Expansion { run.expansion().behavior, run.expansion().horizontalExpansion }
- , Run::Text { text->start(), text->length(), text->originalContent(), text->renderedContent(), text->hasHyphen() } });
- } else if (!run.isRootInlineBox()) {
- // FIXME: Teach the run iterators to ignore the root inline box runs.
- auto& geometry = m_layoutState.geometryForBox(run.layoutBox());
- if (!run.isInlineBox() || !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({ run.lineIndex(), run.layoutBox(), run.logicalRect(), run.inkOverflow(), { }, { } });
- }
- if (run.isInlineBox()) {
- auto hasScrollableContent = [&] {
- // In standards mode, inline boxes always start with an imaginary strut.
- return m_layoutState.inStandardsMode() || run.hasContent() || geometry.horizontalBorder() || (geometry.horizontalPadding() && geometry.horizontalPadding().value());
- };
- inlineContent.nonRootInlineBoxes.append({ run.lineIndex(), run.layoutBox(), run.logicalRect(), hasScrollableContent() });
- }
+ // FIXME: Remove this loop when we transitioned to the "run only" setup (i.e. each inline box is represented as a run as well)
+ auto& lineBoxes = const_cast<Layout::InlineFormattingState&>(inlineFormattingState).lineBoxes();
+ for (size_t lineIndex = 0; lineIndex < lineBoxes.size(); ++lineIndex) {
+ auto& lineBox = lineBoxes[lineIndex];
+ auto lineBoxLogicalTopLeft = inlineFormattingState.lines()[lineIndex].lineBoxLogicalRect().topLeft();
+ for (auto& nonRootInlineLevelBox : lineBox.nonRootInlineLevelBoxes()) {
+ if (!nonRootInlineLevelBox.isInlineBox())
+ continue;
+ auto& layoutBox = nonRootInlineLevelBox.layoutBox();
+ auto& boxGeometry = inlineFormattingState.boxGeometry(layoutBox);
+ auto hasScrollableContent = [&] {
+ // In standards mode, inline boxes always start with an imaginary strut.
+ return m_layoutState.inStandardsMode() || nonRootInlineLevelBox.hasContent() || boxGeometry.horizontalBorder() || (boxGeometry.horizontalPadding() && boxGeometry.horizontalPadding().value());
+ };
+ // Inline boxes may or may not be wrapped and have runs on multiple lines (e.g. <span>first line<br>second line<br>third line</span>)
+ auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
+ inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
+ inlineContent.nonRootInlineBoxes.append({ lineIndex, layoutBox, inlineBoxBorderBox, hasScrollableContent() });
}
}
+ // FIXME: This might need a different approach with partial layout where the layout code needs to know about the runs.
+ inlineContent.runs = WTFMove(inlineFormattingState.runs());
}
void InlineContentBuilder::createDisplayLines(const Layout::InlineLines& lines, InlineContent& inlineContent) const
@@ -131,11 +129,11 @@
auto runLogicalRect = run.logicalRect();
if (!box.hasSelfPaintingLayer()) {
auto childInkOverflow = box.logicalVisualOverflowRectForPropagation(&box.parent()->style());
- childInkOverflow.move(runLogicalRect.x(), runLogicalRect.y());
+ childInkOverflow.move(runLogicalRect.left(), runLogicalRect.top());
lineInkOverflowRect.unite(childInkOverflow);
}
auto childScrollableOverflow = box.logicalLayoutOverflowRectForPropagation(&box.parent()->style());
- childScrollableOverflow.move(runLogicalRect.x(), runLogicalRect.y());
+ childScrollableOverflow.move(runLogicalRect.left(), runLogicalRect.top());
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 (281904 => 281905)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-09-02 01:33:01 UTC (rev 281905)
@@ -43,10 +43,10 @@
public:
InlineContentBuilder(const Layout::LayoutState&, const RenderBlockFlow&, const BoxTree&);
- void build(const Layout::InlineFormattingState&, InlineContent&) const;
+ void build(Layout::InlineFormattingState&, InlineContent&) const;
private:
- void createDisplayRuns(const Layout::InlineRuns&, InlineContent&) const;
+ void createDisplayRuns(Layout::InlineFormattingState&, InlineContent&) const;
void createDisplayLines(const Layout::InlineLines&, InlineContent&) const;
const Layout::LayoutState& m_layoutState;
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (281904 => 281905)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -563,11 +563,11 @@
physicalPaintOffset.move({ 0, -run.logicalRect().height() });
}
- auto physicalRect = [&](const auto& rect) {
+ auto physicalRect = [&](const auto& rect) -> FloatRect {
if (!style.isFlippedBlocksWritingMode())
return rect;
if (!blockIsHorizontalWriting)
- return FloatRect { formattingContextRoot.width() - rect.maxY(), rect.x() , rect.width(), rect.height() };
+ return FloatRect { formattingContextRoot.width() - rect.bottom(), rect.left() , rect.width(), rect.height() };
ASSERT_NOT_IMPLEMENTED_YET();
return 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.logicalRect().x() - (line.lineBoxLeft() + line.contentLeft());
+ auto xPos = run.logicalRect().left() - (line.lineBoxLeft() + line.contentLeft());
auto textRun = WebCore::TextRun { textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp (281904 => 281905)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -144,6 +144,7 @@
{
return Run {
run.lineIndex(),
+ run.type(),
run.layoutBox(),
moveVertically(run.logicalRect(), offset),
moveVertically(run.inkOverflow(), offset),
Deleted: trunk/Source/WebCore/layout/integration/LayoutIntegrationRun.h (281904 => 281905)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRun.h 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRun.h 2021-09-02 01:33:01 UTC (rev 281905)
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "InlineRect.h"
-#include "LayoutBox.h"
-#include "RenderStyle.h"
-#include "TextFlags.h"
-
-namespace WebCore {
-
-class CachedImage;
-
-namespace LayoutIntegration {
-
-struct Run {
- WTF_MAKE_STRUCT_FAST_ALLOCATED;
- struct Text {
- WTF_MAKE_STRUCT_FAST_ALLOCATED;
- public:
- 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(); }
- size_t length() const { return m_length; }
- StringView originalContent() const { return StringView(m_originalContent).substring(m_start, m_length); }
- StringView renderedContent() const { return m_adjustedContentToRender.isNull() ? originalContent() : m_adjustedContentToRender; }
- bool hasHyphen() const { return m_hasHyphen; }
-
- private:
- size_t m_start { 0 };
- size_t m_length { 0 };
- bool m_hasHyphen { false };
- String m_originalContent;
- String m_adjustedContentToRender;
- };
-
- struct Expansion;
- Run(size_t lineIndex, const Layout::Box&, const FloatRect&, const FloatRect& inkOverflow, Expansion, std::optional<Text> = std::nullopt);
-
- const FloatRect& logicalRect() const { return m_rect; }
- const FloatRect& inkOverflow() const { return m_inkOverflow; }
-
- void setVerticalPositionIntegral();
-
- 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() || (text() && text()->originalContent() == "\n" && style().preserveNewline()); }
-
- struct Expansion {
- ExpansionBehavior behavior { DefaultExpansion };
- Layout::InlineLayoutUnit horizontalExpansion { 0 };
- };
- Expansion expansion() const { return m_expansion; }
-
- const Layout::Box& layoutBox() const { return *m_layoutBox; }
- const RenderStyle& style() const { return m_layoutBox->style(); }
-
- size_t lineIndex() const { return m_lineIndex; }
-
-private:
- // FIXME: Find out the Display::Run <-> paint style setup.
- const size_t m_lineIndex;
- WeakPtr<const Layout::Box> m_layoutBox;
- FloatRect m_rect;
- FloatRect m_inkOverflow;
- Expansion m_expansion;
- 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<Text> text)
- : m_lineIndex(lineIndex)
- , m_layoutBox(makeWeakPtr(layoutBox))
- , m_rect(rect)
- , m_inkOverflow(inkOverflow)
- , m_expansion(expansion)
- , m_text(text)
-{
-}
-
-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)
- , m_originalContent(originalContent)
- , m_adjustedContentToRender(adjustedContentToRender)
-{
-}
-
-inline void Run::setVerticalPositionIntegral()
-{
- m_rect.setY(roundToInt(m_rect.y()));
- m_inkOverflow.setY(roundToInt(m_inkOverflow.y()));
-}
-
-}
-}
-#endif
Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (281904 => 281905)
--- trunk/Source/WebCore/rendering/TextPainter.cpp 2021-09-02 01:05:35 UTC (rev 281904)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp 2021-09-02 01:33:01 UTC (rev 281905)
@@ -27,7 +27,6 @@
#include "FilterOperations.h"
#include "GraphicsContext.h"
#include "HTMLParserIdioms.h"
-#include "LayoutIntegrationRun.h"
#include "LegacyInlineTextBox.h"
#include "RenderCombineText.h"
#include "RenderLayer.h"