WebKit Bugzilla
Attachment 373592 Details for
Bug 199558
: [LFC][IFC] Introduce splitPosition to LineLayout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199558-20190706214037.patch (text/plain), 8.95 KB, created by
zalan
on 2019-07-06 21:40:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-07-06 21:40:44 PDT
Size:
8.95 KB
patch
obsolete
>Subversion Revision: 247168 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 497e1747ddce598d263292b4e14382e3ddd0f7b0..48a1585293350d54e6b920f542a53e31bbdd5fe6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-07-06 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][IFC] Introduce splitPosition to LineLayout >+ https://bugs.webkit.org/show_bug.cgi?id=199558 >+ <rdar://problem/52737649> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is in preparation for breaking runs at line end. >+ >+ * layout/inlineformatting/InlineFormattingContext.h: >+ * layout/inlineformatting/InlineFormattingContextLineLayout.cpp: >+ (WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::LineInput): >+ (WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const): >+ (WebCore::Layout::InlineFormattingContext::LineLayout::layout const): >+ (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const): >+ > 2019-07-06 Zalan Bujtas <zalan@apple.com> > > [LFC] Fix formatting context root for inflow positioned inline containers >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >index 240d1629539282ebebc326664a028712ded26c2b..30c5a845aa5b6118933070d4c8d7e131a61fc6e9 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >@@ -59,14 +59,13 @@ private: > private: > LayoutState& layoutState() const { return m_formattingContext.layoutState(); } > >- struct LineContent { >- Optional<unsigned> lastInlineItemIndex; >- Vector<WeakPtr<InlineItem>> floats; >- std::unique_ptr<Line::Content> runs; >+ struct InlineIndexAndSplitPosition { >+ unsigned index { 0 }; >+ Optional<unsigned> splitPosition; > }; > > struct LineInput { >- LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment, unsigned firstInlineItemIndex, const InlineItems&); >+ LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment, InlineIndexAndSplitPosition firstToProcess, const InlineItems&); > struct HorizontalConstraint { > HorizontalConstraint(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth); > >@@ -76,10 +75,16 @@ private: > HorizontalConstraint horizontalConstraint; > // FIXME Alternatively we could just have a second pass with vertical positioning (preferred width computation opts out) > Line::SkipVerticalAligment skipVerticalAligment; >- unsigned firstInlineItemIndex { 0 }; >+ InlineIndexAndSplitPosition firstInlineItem; > const InlineItems& inlineItems; > Optional<LayoutUnit> floatMinimumLogicalBottom; > }; >+ >+ struct LineContent { >+ Optional<InlineIndexAndSplitPosition> lastCommitted; >+ Vector<WeakPtr<InlineItem>> floats; >+ std::unique_ptr<Line::Content> runs; >+ }; > LineContent placeInlineItems(const LineInput&) const; > void createDisplayRuns(const Line::Content&, const Vector<WeakPtr<InlineItem>>& floats, LayoutUnit widthConstraint) const; > void alignRuns(TextAlignMode, unsigned firstRunIndex, LayoutUnit availableWidth) const; >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp >index 1dc3c067adf437609a3cb74e26c65b9680bedd5c..c0ffa16a510f98a959b4aab7fff32506f7b2dc94 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp >@@ -78,10 +78,10 @@ InlineFormattingContext::LineLayout::LineInput::HorizontalConstraint::Horizontal > { > } > >-InlineFormattingContext::LineLayout::LineInput::LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment skipVerticalAligment, unsigned firstInlineItemIndex, const InlineItems& inlineItems) >+InlineFormattingContext::LineLayout::LineInput::LineInput(LayoutPoint logicalTopLeft, LayoutUnit availableLogicalWidth, Line::SkipVerticalAligment skipVerticalAligment, InlineIndexAndSplitPosition firstToProcess, const InlineItems& inlineItems) > : horizontalConstraint(logicalTopLeft, availableLogicalWidth) > , skipVerticalAligment(skipVerticalAligment) >- , firstInlineItemIndex(firstInlineItemIndex) >+ , firstInlineItem(firstToProcess) > , inlineItems(inlineItems) > { > } >@@ -136,6 +136,7 @@ InlineFormattingContext::LineLayout::LineContent InlineFormattingContext::LineLa > > Vector<WeakPtr<InlineItem>> floats; > unsigned committedInlineItemCount = 0; >+ Optional<unsigned> splitPosition; > > UncommittedContent uncommittedContent; > auto commitPendingContent = [&] { >@@ -150,12 +151,14 @@ InlineFormattingContext::LineLayout::LineContent InlineFormattingContext::LineLa > auto lineHasFloatBox = lineInput.floatMinimumLogicalBottom.hasValue(); > auto closeLine = [&] { > ASSERT(committedInlineItemCount || lineHasFloatBox); >- auto lastCommittedIndex = committedInlineItemCount ? Optional<unsigned> { lineInput.firstInlineItemIndex + (committedInlineItemCount - 1) } : WTF::nullopt; >- return LineContent { lastCommittedIndex, WTFMove(floats), line.close() }; >+ if (!committedInlineItemCount) >+ return LineContent { WTF::nullopt, WTFMove(floats), line.close() }; >+ auto lastCommitedItem = InlineIndexAndSplitPosition { lineInput.firstInlineItem.index + (committedInlineItemCount - 1), splitPosition }; >+ return LineContent { lastCommitedItem, WTFMove(floats), line.close() }; > }; > LineBreaker lineBreaker; > // Iterate through the inline content and place the inline boxes on the current line. >- for (auto inlineItemIndex = lineInput.firstInlineItemIndex; inlineItemIndex < lineInput.inlineItems.size(); ++inlineItemIndex) { >+ for (auto inlineItemIndex = lineInput.firstInlineItem.index; inlineItemIndex < lineInput.inlineItems.size(); ++inlineItemIndex) { > auto availableWidth = line.availableWidth() - uncommittedContent.width(); > auto currentLogicalRight = line.contentLogicalRight() + uncommittedContent.width(); > auto& inlineItem = lineInput.inlineItems[inlineItemIndex]; >@@ -248,19 +251,19 @@ void InlineFormattingContext::LineLayout::layout(LayoutUnit widthConstraint) con > }; > > auto& inlineItems = m_formattingState.inlineItems(); >- unsigned currentInlineItemIndex = 0; >- while (currentInlineItemIndex < inlineItems.size()) { >- auto lineInput = LineInput { { lineLogicalLeft, lineLogicalTop }, widthConstraint, Line::SkipVerticalAligment::No, currentInlineItemIndex, inlineItems }; >+ InlineIndexAndSplitPosition currentInlineItem; >+ while (currentInlineItem.index < inlineItems.size()) { >+ auto lineInput = LineInput { { lineLogicalLeft, lineLogicalTop }, widthConstraint, Line::SkipVerticalAligment::No, currentInlineItem, inlineItems }; > applyFloatConstraint(lineInput); > auto lineContent = placeInlineItems(lineInput); > createDisplayRuns(*lineContent.runs, lineContent.floats, widthConstraint); >- if (!lineContent.lastInlineItemIndex) { >+ if (!lineContent.lastCommitted) { > // Floats prevented us putting any content on the line. > ASSERT(lineInput.floatMinimumLogicalBottom); > ASSERT(lineContent.runs->isEmpty()); > lineLogicalTop = *lineInput.floatMinimumLogicalBottom; > } else { >- currentInlineItemIndex = *lineContent.lastInlineItemIndex + 1; >+ currentInlineItem = { lineContent.lastCommitted->index + 1, WTF::nullopt }; > lineLogicalTop = lineContent.runs->logicalBottom(); > } > } >@@ -270,10 +273,10 @@ LayoutUnit InlineFormattingContext::LineLayout::computedIntrinsicWidth(LayoutUni > { > LayoutUnit maximumLineWidth; > auto& inlineItems = m_formattingState.inlineItems(); >- unsigned currentInlineItemIndex = 0; >- while (currentInlineItemIndex < inlineItems.size()) { >- auto lineContent = placeInlineItems({ { }, widthConstraint, Line::SkipVerticalAligment::Yes, currentInlineItemIndex, inlineItems }); >- currentInlineItemIndex = *lineContent.lastInlineItemIndex + 1; >+ InlineIndexAndSplitPosition currentInlineItem; >+ while (currentInlineItem.index < inlineItems.size()) { >+ auto lineContent = placeInlineItems({ { }, widthConstraint, Line::SkipVerticalAligment::Yes, currentInlineItem, inlineItems }); >+ currentInlineItem = { lineContent.lastCommitted->index + 1, WTF::nullopt }; > LayoutUnit floatsWidth; > for (auto& floatItem : lineContent.floats) > floatsWidth += layoutState().displayBoxForLayoutBox(floatItem->layoutBox()).marginBoxWidth();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199558
: 373592