- Revision
- 253708
- Author
- [email protected]
- Date
- 2019-12-18 12:28:18 -0800 (Wed, 18 Dec 2019)
Log Message
[LFC][IFC] LineBreaker::lastSoftWrapOpportunity should take a list of runs
https://bugs.webkit.org/show_bug.cgi?id=205402
<rdar://problem/58048310>
Reviewed by Antti Koivisto.
LineBreaker::Content is supposed to hold a continuous set of runs and the input to lastSoftWrapOpportunity is not
necessarily continuous (most of the time it is though).
* layout/inlineformatting/InlineLineBreaker.cpp:
(WebCore::Layout::isContentSplitAllowed):
(WebCore::Layout::LineBreaker::wrapTextContent const):
(WebCore::Layout::LineBreaker::tryBreakingTextRun const):
(WebCore::Layout::LineBreaker::lastSoftWrapOpportunity):
(WebCore::Layout::LineBreaker::Content::lastSoftWrapOpportunity): Deleted.
* layout/inlineformatting/InlineLineBreaker.h:
* layout/inlineformatting/LineLayoutContext.cpp:
(WebCore::Layout::LineLayoutContext::placeInlineItem):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253707 => 253708)
--- trunk/Source/WebCore/ChangeLog 2019-12-18 20:17:03 UTC (rev 253707)
+++ trunk/Source/WebCore/ChangeLog 2019-12-18 20:28:18 UTC (rev 253708)
@@ -1,3 +1,24 @@
+2019-12-18 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] LineBreaker::lastSoftWrapOpportunity should take a list of runs
+ https://bugs.webkit.org/show_bug.cgi?id=205402
+ <rdar://problem/58048310>
+
+ Reviewed by Antti Koivisto.
+
+ LineBreaker::Content is supposed to hold a continuous set of runs and the input to lastSoftWrapOpportunity is not
+ necessarily continuous (most of the time it is though).
+
+ * layout/inlineformatting/InlineLineBreaker.cpp:
+ (WebCore::Layout::isContentSplitAllowed):
+ (WebCore::Layout::LineBreaker::wrapTextContent const):
+ (WebCore::Layout::LineBreaker::tryBreakingTextRun const):
+ (WebCore::Layout::LineBreaker::lastSoftWrapOpportunity):
+ (WebCore::Layout::LineBreaker::Content::lastSoftWrapOpportunity): Deleted.
+ * layout/inlineformatting/InlineLineBreaker.h:
+ * layout/inlineformatting/LineLayoutContext.cpp:
+ (WebCore::Layout::LineLayoutContext::placeInlineItem):
+
2019-12-18 youenn fablet <[email protected]>
AppCache should request certificate info when loading resources
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (253707 => 253708)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp 2019-12-18 20:17:03 UTC (rev 253707)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp 2019-12-18 20:28:18 UTC (rev 253708)
@@ -43,7 +43,7 @@
return style.whiteSpace() != WhiteSpace::Pre && style.whiteSpace() != WhiteSpace::NoWrap;
}
-static inline bool isContentSplitAllowed(const LineBreaker::Content::Run& run)
+static inline bool isContentSplitAllowed(const LineBreaker::Run& run)
{
ASSERT(run.inlineItem.isText() || run.inlineItem.isContainerStart() || run.inlineItem.isContainerEnd());
if (!run.inlineItem.isText()) {
@@ -124,7 +124,7 @@
return !lineIsEmpty && floatLogicalWidth > availableWidth;
}
-Optional<LineBreaker::WrappedTextContent> LineBreaker::wrapTextContent(const Content::RunList& runs, const LineStatus& lineStatus) const
+Optional<LineBreaker::WrappedTextContent> LineBreaker::wrapTextContent(const RunList& runs, const LineStatus& lineStatus) const
{
// Check where the overflow occurs and use the corresponding style to figure out the breaking behaviour.
// <span style="word-break: normal">first</span><span style="word-break: break-all">second</span><span style="word-break: normal">third</span>
@@ -196,7 +196,7 @@
return WordBreakRule::NoBreak;
}
-Optional<LineBreaker::PartialRun> LineBreaker::tryBreakingTextRun(const Content::Run& overflowRun, InlineLayoutUnit availableWidth, bool lineIsEmpty) const
+Optional<LineBreaker::PartialRun> LineBreaker::tryBreakingTextRun(const Run& overflowRun, InlineLayoutUnit availableWidth, bool lineIsEmpty) const
{
ASSERT(overflowRun.inlineItem.isText());
auto& inlineTextItem = downcast<InlineTextItem>(overflowRun.inlineItem);
@@ -280,7 +280,7 @@
return !TextUtil::findNextBreakablePosition(lineBreakIterator, 0, nextInlineTextItem.style());
}
-Optional<unsigned> LineBreaker::Content::lastSoftWrapOpportunity(const InlineItem& inlineItem, const Content& priorContent)
+Optional<size_t> LineBreaker::lastSoftWrapOpportunity(const InlineItem& inlineItem, const RunList& priorContent)
{
// https://drafts.csswg.org/css-text-3/#line-break-details
// Figure out if the new incoming content puts the uncommitted content on a soft wrap opportunity.
@@ -294,7 +294,7 @@
}
auto lastInlineItemWithContent = [&] () -> const InlineItem* {
- for (auto& previousRun : WTF::makeReversedRange(priorContent.runs())) {
+ for (auto& previousRun : WTF::makeReversedRange(priorContent)) {
auto& previousInlineItem = previousRun.inlineItem;
if (previousInlineItem.isText() || previousInlineItem.isBox())
return &previousInlineItem;
@@ -303,7 +303,7 @@
return nullptr;
};
- auto* lastUncomittedContent = &priorContent.runs().last().inlineItem;
+ auto* lastUncomittedContent = &priorContent.last().inlineItem;
if (inlineItem.isText()) {
if (inlineItem.style().lineBreak() == LineBreak::Anywhere) {
// There is a soft wrap opportunity around every typographic character unit, including around any punctuation character
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h (253707 => 253708)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h 2019-12-18 20:17:03 UTC (rev 253707)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h 2019-12-18 20:28:18 UTC (rev 253708)
@@ -56,6 +56,13 @@
Optional<PartialTrailingContent> partialTrailingContent;
};
+ struct Run {
+ const InlineItem& inlineItem;
+ InlineLayoutUnit logicalWidth { 0 };
+ };
+ using RunList = Vector<Run, 30>;
+ static Optional<size_t> lastSoftWrapOpportunity(const InlineItem&, const RunList& priorContent);
+
// This struct represents the amount of content committed to line breaking at a time e.g.
// text content <span>span1</span>between<span>span2</span>
// [text][ ][content][ ][container start][span1][container end][between][container start][span2][container end]
@@ -70,14 +77,6 @@
void reset();
void shrink(unsigned newSize);
- static Optional<unsigned> lastSoftWrapOpportunity(const InlineItem&, const Content& priorContent);
-
- struct Run {
- const InlineItem& inlineItem;
- InlineLayoutUnit logicalWidth { 0 };
- };
- using RunList = Vector<Run, 30>;
-
RunList& runs() { return m_continousRuns; }
const RunList& runs() const { return m_continousRuns; }
bool isEmpty() const { return m_continousRuns.isEmpty(); }
@@ -122,8 +121,8 @@
bool contentOverflows { false };
Optional<PartialRun> partialTrailingRun;
};
- Optional<WrappedTextContent> wrapTextContent(const Content::RunList&, const LineStatus&) const;
- Optional<PartialRun> tryBreakingTextRun(const Content::Run& overflowRun, InlineLayoutUnit availableWidth, bool lineIsEmpty) const;
+ Optional<WrappedTextContent> wrapTextContent(const RunList&, const LineStatus&) const;
+ Optional<PartialRun> tryBreakingTextRun(const Run& overflowRun, InlineLayoutUnit availableWidth, bool lineIsEmpty) const;
enum class WordBreakRule {
NoBreak,
Modified: trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp (253707 => 253708)
--- trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp 2019-12-18 20:17:03 UTC (rev 253707)
+++ trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp 2019-12-18 20:28:18 UTC (rev 253708)
@@ -186,7 +186,7 @@
}
auto isEndOfLine = IsEndOfLine::No;
// Can we commit the pending content already?
- if (LineBreaker::Content::lastSoftWrapOpportunity(inlineItem, m_uncommittedContent))
+ if (LineBreaker::lastSoftWrapOpportunity(inlineItem, m_uncommittedContent.runs()))
isEndOfLine = processUncommittedContent(line);
// The current item might fit as well.
if (isEndOfLine == IsEndOfLine::No)