Changeset 256437 in webkit
- Timestamp:
- Feb 12, 2020 7:53:36 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r256436 r256437 1 2020-02-12 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Rename Display::Run::TextContext to TextContent 4 https://bugs.webkit.org/show_bug.cgi?id=207611 5 <rdar://problem/59374523> 6 7 Reviewed by Antti Koivisto. 8 9 * layout/Verification.cpp: 10 (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded): 11 (WebCore::Layout::checkForMatchingTextRuns): 12 (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded): 13 * layout/displaytree/DisplayPainter.cpp: 14 (WebCore::Display::paintInlineContent): 15 * layout/displaytree/DisplayRun.h: 16 (WebCore::Display::Run::setTextContent): 17 (WebCore::Display::Run::textContent const): 18 (WebCore::Display::Run::textContent): 19 (WebCore::Display::Run::isLineBreak const): 20 (WebCore::Display::Run::Run): 21 (WebCore::Display::Run::TextContent::TextContent): 22 (WebCore::Display::Run::TextContext::start const): Deleted. 23 (WebCore::Display::Run::TextContext::end const): Deleted. 24 (WebCore::Display::Run::TextContext::length const): Deleted. 25 (WebCore::Display::Run::TextContext::content const): Deleted. 26 (WebCore::Display::Run::TextContext::needsHyphen const): Deleted. 27 (WebCore::Display::Run::TextContext::setNeedsHyphen): Deleted. 28 (WebCore::Display::Run::TextContext::expand): Deleted. 29 (WebCore::Display::Run::setTextContext): Deleted. 30 (WebCore::Display::Run::textContext const): Deleted. 31 (WebCore::Display::Run::textContext): Deleted. 32 (WebCore::Display::Run::TextContext::TextContext): Deleted. 33 * layout/inlineformatting/InlineFormattingContext.cpp: 34 (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine): 35 * layout/inlineformatting/InlineLineBuilder.cpp: 36 (WebCore::Layout::m_textContent): 37 (WebCore::Layout::LineBuilder::Run::expand): 38 (WebCore::Layout::LineBuilder::Run::removeTrailingWhitespace): 39 (WebCore::Layout::m_textContext): Deleted. 40 * layout/inlineformatting/InlineLineBuilder.h: 41 (WebCore::Layout::LineBuilder::Run::textContent const): 42 (WebCore::Layout::LineBuilder::Run::textContext const): Deleted. 43 * layout/integration/LayoutIntegrationLineLayout.cpp: 44 (WebCore::LayoutIntegration::LineLayout::paint): 45 * layout/layouttree/LayoutTreeBuilder.cpp: 46 (WebCore::Layout::outputInlineRuns): 47 * rendering/line/LineLayoutTraversalDisplayRunPath.h: 48 (WebCore::LineLayoutTraversal::DisplayRunPath::hasHyphen const): 49 (WebCore::LineLayoutTraversal::DisplayRunPath::text const): 50 (WebCore::LineLayoutTraversal::DisplayRunPath::localStartOffset const): 51 (WebCore::LineLayoutTraversal::DisplayRunPath::localEndOffset const): 52 (WebCore::LineLayoutTraversal::DisplayRunPath::length const): 53 1 54 2020-02-12 Charles Turner <cturner@igalia.com> 2 55 -
trunk/Source/WebCore/layout/Verification.cpp
r256417 r256437 97 97 98 98 auto matchingRuns = areEssentiallyEqual(simpleRun.logicalLeft, displayRun.left()) && areEssentiallyEqual(simpleRun.logicalRight, displayRun.right()); 99 if (matchingRuns && displayRun.textConte xt()) {100 matchingRuns = simpleRun.start == displayRun.textConte xt()->start() && simpleRun.end == displayRun.textContext()->end();99 if (matchingRuns && displayRun.textContent()) { 100 matchingRuns = simpleRun.start == displayRun.textContent()->start() && simpleRun.end == displayRun.textContent()->end(); 101 101 // SLL handles strings in a more concatenated format <div>foo<br>bar</div> -> foo -> 0,3 bar -> 3,6 vs. 0,3 and 0,3 102 102 if (!matchingRuns) 103 matchingRuns = (simpleRun.end - simpleRun.start) == (displayRun.textConte xt()->end() - displayRun.textContext()->start());103 matchingRuns = (simpleRun.end - simpleRun.start) == (displayRun.textContent()->end() - displayRun.textContent()->start()); 104 104 } 105 105 if (matchingRuns) … … 108 108 stream << "Mismatching: simple run(" << simpleRun.start << ", " << simpleRun.end << ") (" << simpleRun.logicalLeft << ", " << simpleRun.logicalRight << ")"; 109 109 stream << " inline run"; 110 if (displayRun.textConte xt())111 stream << " (" << displayRun.textConte xt()->start() << ", " << displayRun.textContext()->end() << ")";110 if (displayRun.textContent()) 111 stream << " (" << displayRun.textContent()->start() << ", " << displayRun.textContent()->end() << ")"; 112 112 stream << " (" << displayRun.left() << ", " << displayRun.top() << ") (" << displayRun.width() << "x" << displayRun.height() << ")"; 113 113 stream.nextLine(); … … 132 132 && areEssentiallyEqual(inlineTextBox.top(), inlineRun.top()) 133 133 && areEssentiallyEqual(inlineTextBox.bottom(), inlineRun.bottom()) 134 && (inlineTextBox.isLineBreak() || (inlineTextBox.start() == inlineRun.textConte xt()->start() && inlineTextBox.end() == inlineRun.textContext()->end()));134 && (inlineTextBox.isLineBreak() || (inlineTextBox.start() == inlineRun.textContent()->start() && inlineTextBox.end() == inlineRun.textContent()->end())); 135 135 } 136 136 … … 205 205 206 206 stream << " inline run"; 207 if (displayRun.textConte xt())208 stream << " (" << displayRun.textConte xt()->start() << ", " << displayRun.textContext()->end() << ")";207 if (displayRun.textContent()) 208 stream << " (" << displayRun.textContent()->start() << ", " << displayRun.textContent()->end() << ")"; 209 209 stream << " (" << displayRun.left() << ", " << displayRun.top() << ") (" << displayRun.width() << "x" << displayRun.height() << ")"; 210 210 stream.nextLine(); -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp
r256431 r256437 122 122 123 123 for (auto& run : displayRuns) { 124 if (auto& textConte xt = run.textContext()) {124 if (auto& textContent = run.textContent()) { 125 125 auto& style = run.style(); 126 126 context.setStrokeColor(style.color()); … … 132 132 auto baselineOffset = absoluteOffset.y() + lineBox.top() + lineBox.baselineOffset(); 133 133 auto expansion = run.expansion(); 134 auto textRun = TextRun { textConte xt->content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };134 auto textRun = TextRun { textContent->content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior }; 135 135 textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); 136 136 context.drawText(style.fontCascade(), textRun, { absoluteLeft, baselineOffset }); -
trunk/Source/WebCore/layout/displaytree/DisplayRun.h
r256431 r256437 41 41 struct Run { 42 42 WTF_MAKE_STRUCT_FAST_ALLOCATED; 43 struct TextConte xt {43 struct TextContent { 44 44 WTF_MAKE_STRUCT_FAST_ALLOCATED; 45 45 public: 46 struct ExpansionContext; 47 TextContext(unsigned position, unsigned length, const String&); 46 TextContent(unsigned position, unsigned length, const String&); 48 47 49 48 unsigned start() const { return m_start; } … … 65 64 66 65 struct Expansion; 67 Run(size_t lineIndex, const Layout::Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, Optional<TextConte xt> = WTF::nullopt);66 Run(size_t lineIndex, const Layout::Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, Optional<TextContent> = WTF::nullopt); 68 67 69 68 size_t lineIndex() const { return m_lineIndex; } … … 89 88 void expandHorizontally(InlineLayoutUnit delta) { m_rect.expandHorizontally(delta); } 90 89 91 void setTextConte xt(const TextContext&& textContext) { m_textContext.emplace(textContext); }92 const Optional<TextConte xt>& textContext() const { return m_textContext; }93 Optional<TextConte xt>& textContext() { return m_textContext; }90 void setTextContent(const TextContent&& textContent) { m_textContent.emplace(textContent); } 91 const Optional<TextContent>& textContent() const { return m_textContent; } 92 Optional<TextContent>& textContent() { return m_textContent; } 94 93 95 94 struct Expansion { … … 103 102 CachedImage* image() const { return m_cachedImage; } 104 103 105 bool isLineBreak() const { return layoutBox().isLineBreakBox() || (textContext() && textContext()->content() == "\n" && style().preserveNewline()); } 104 // FIXME: This information should be preserved at Run construction time. 105 bool isLineBreak() const { return layoutBox().isLineBreakBox() || (textContent() && textContent()->content() == "\n" && style().preserveNewline()); } 106 106 107 107 const Layout::Box& layoutBox() const { return *m_layoutBox; } … … 116 116 InlineRect m_inkOverflow; 117 117 Expansion m_expansion; 118 Optional<TextConte xt> m_textContext;118 Optional<TextContent> m_textContent; 119 119 }; 120 120 121 inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const InlineRect& rect, const InlineRect& inkOverflow, Expansion expansion, Optional<TextConte xt> textContext)121 inline Run::Run(size_t lineIndex, const Layout::Box& layoutBox, const InlineRect& rect, const InlineRect& inkOverflow, Expansion expansion, Optional<TextContent> textContent) 122 122 : m_lineIndex(lineIndex) 123 123 , m_layoutBox(makeWeakPtr(layoutBox)) … … 125 125 , m_inkOverflow(inkOverflow) 126 126 , m_expansion(expansion) 127 , m_textConte xt(textContext)127 , m_textContent(textContent) 128 128 { 129 129 } 130 130 131 inline Run::TextConte xt::TextContext(unsigned start, unsigned length, const String& contentString)131 inline Run::TextContent::TextContent(unsigned start, unsigned length, const String& contentString) 132 132 : m_start(start) 133 133 , m_length(length) -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r256431 r256437 486 486 auto inkOverflow = computedInkOverflow(); 487 487 lineInkOverflow.expandToContain(inkOverflow); 488 inlineContent.runs.append({ lineIndex, lineRun.layoutBox(), logicalRect, inkOverflow, lineRun.expansion(), lineRun.textConte xt() });488 inlineContent.runs.append({ lineIndex, lineRun.layoutBox(), logicalRect, inkOverflow, lineRun.expansion(), lineRun.textContent() }); 489 489 } 490 490 … … 544 544 // Make sure the trailing text run gets a hyphen when it needs one. 545 545 if (lineContent.partialContent && lineContent.partialContent->trailingContentNeedsHyphen) 546 inlineContent.runs[*lastTextItemIndex].textConte xt()->setNeedsHyphen();546 inlineContent.runs[*lastTextItemIndex].textContent()->setNeedsHyphen(); 547 547 // FIXME: This is where the logical to physical translate should happen. 548 548 auto& baseline = lineBox.baseline(); -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r256431 r256437 751 751 , m_layoutBox(&softLineBreakItem.layoutBox()) 752 752 , m_logicalRect({ 0, logicalLeft, 0, 0 }) 753 , m_textConte xt({ softLineBreakItem.position(), 1, softLineBreakItem.inlineTextBox().content() })753 , m_textContent({ softLineBreakItem.position(), 1, softLineBreakItem.inlineTextBox().content() }) 754 754 { 755 755 } … … 760 760 , m_logicalRect({ 0, logicalLeft, logicalWidth, 0 }) 761 761 , m_trailingWhitespaceType(trailingWhitespaceType(inlineTextItem)) 762 , m_textConte xt({ inlineTextItem.start(), m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length(), inlineTextItem.inlineTextBox().content() })762 , m_textContent({ inlineTextItem.start(), m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length(), inlineTextItem.inlineTextBox().content() }) 763 763 { 764 764 if (m_trailingWhitespaceType != TrailingWhitespace::None) { … … 782 782 m_trailingWhitespaceWidth = { }; 783 783 setExpansionBehavior(AllowLeadingExpansion | AllowTrailingExpansion); 784 m_textConte xt->expand(inlineTextItem.length());784 m_textContent->expand(inlineTextItem.length()); 785 785 return; 786 786 } … … 789 789 ++m_expansionOpportunityCount; 790 790 setExpansionBehavior(DefaultExpansion); 791 m_textConte xt->expand(m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length());791 m_textContent->expand(m_trailingWhitespaceType == TrailingWhitespace::Collapsed ? 1 : inlineTextItem.length()); 792 792 } 793 793 … … 818 818 // According to https://www.w3.org/TR/css-text-3/#white-space-property matrix 819 819 // Trimmable whitespace is always collapsable so the length of the trailing trimmable whitespace is always 1 (or non-existent). 820 ASSERT(m_textConte xt->length());821 m_textConte xt->expand(-1);820 ASSERT(m_textContent->length()); 821 m_textContent->expand(-1); 822 822 visuallyCollapseTrailingWhitespace(); 823 823 } -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h
r256431 r256437 86 86 const Display::InlineRect& logicalRect() const { return m_logicalRect; } 87 87 Display::Run::Expansion expansion() const { return m_expansion; } 88 const Optional<Display::Run::TextConte xt>& textContext() const { return m_textContext; }88 const Optional<Display::Run::TextContent>& textContent() const { return m_textContent; } 89 89 90 90 Run(Run&&) = default; … … 138 138 TrailingWhitespace m_trailingWhitespaceType { TrailingWhitespace::None }; 139 139 InlineLayoutUnit m_trailingWhitespaceWidth { 0 }; 140 Optional<Display::Run::TextConte xt> m_textContext;140 Optional<Display::Run::TextContent> m_textContent; 141 141 Display::Run::Expansion m_expansion; 142 142 unsigned m_expansionOpportunityCount { 0 }; -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r256431 r256437 268 268 269 269 for (auto& run : inlineContent.runsForRect(paintRect)) { 270 if (!run.textConte xt())271 continue; 272 273 auto& textConte xt = *run.textContext();274 if (!textConte xt.length())270 if (!run.textContent()) 271 continue; 272 273 auto& textContent = *run.textContent(); 274 if (!textContent.length()) 275 275 continue; 276 276 … … 295 295 296 296 String textWithHyphen; 297 if (textConte xt.needsHyphen())298 textWithHyphen = makeString(textConte xt.content(), style.hyphenString());299 TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textConte xt.content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };297 if (textContent.needsHyphen()) 298 textWithHyphen = makeString(textContent.content(), style.hyphenString()); 299 TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior }; 300 300 textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); 301 301 FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baselineOffset, deviceScaleFactor) }; -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r256417 r256437 342 342 stream << " "; 343 343 stream << " "; 344 if (displayRun.textConte xt())344 if (displayRun.textContent()) 345 345 stream << "inline text box"; 346 346 else 347 347 stream << "inline box"; 348 348 stream << " at (" << displayRun.left() << "," << displayRun.top() << ") size " << displayRun.width() << "x" << displayRun.height(); 349 if (displayRun.textConte xt())350 stream << " run(" << displayRun.textConte xt()->start() << ", " << displayRun.textContext()->end() << ")";349 if (displayRun.textContent()) 350 stream << " run(" << displayRun.textContent()->start() << ", " << displayRun.textContent()->end() << ")"; 351 351 stream.nextLine(); 352 352 } -
trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h
r255143 r256437 68 68 } 69 69 70 bool hasHyphen() const { return run().textConte xt()->needsHyphen(); }71 StringView text() const { return run().textConte xt()->content(); }72 unsigned localStartOffset() const { return run().textConte xt()->start(); }73 unsigned localEndOffset() const { return run().textConte xt()->end(); }74 unsigned length() const { return run().textConte xt()->length(); }70 bool hasHyphen() const { return run().textContent()->needsHyphen(); } 71 StringView text() const { return run().textContent()->content(); } 72 unsigned localStartOffset() const { return run().textContent()->start(); } 73 unsigned localEndOffset() const { return run().textContent()->end(); } 74 unsigned length() const { return run().textContent()->length(); } 75 75 76 76 bool isLastOnLine() const
Note: See TracChangeset
for help on using the changeset viewer.