Changeset 252816 in webkit
- Timestamp:
- Nov 22, 2019 4:38:04 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252813 r252816 1 2019-11-22 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Text content is not exactly rare data. 4 https://bugs.webkit.org/show_bug.cgi?id=204539 5 <rdar://problem/57442263> 6 7 Reviewed by Antti Koivisto. 8 9 If it turns out to be a memory consumption issue, we can always subclass Layout::Box. Let's go with the m_textContext member for now. 10 11 * layout/inlineformatting/InlineLine.cpp: 12 (WebCore::Layout::ContinousContent::close): 13 (WebCore::Layout::Line::appendTextContent): 14 * layout/inlineformatting/InlineTextItem.cpp: 15 (WebCore::Layout::InlineTextItem::createAndAppendTextItems): 16 * layout/inlineformatting/text/TextUtil.cpp: 17 (WebCore::Layout::TextUtil::width): 18 * layout/layouttree/LayoutBox.cpp: 19 (WebCore::Layout::Box::setTextContext): Deleted. 20 (WebCore::Layout::Box::hasTextContent const): Deleted. 21 (WebCore::Layout::Box::textContext const): Deleted. 22 * layout/layouttree/LayoutBox.h: 23 (WebCore::Layout::Box::hasTextContent const): 24 (WebCore::Layout::Box::textContext const): 25 * layout/layouttree/LayoutTreeBuilder.cpp: 26 (WebCore::Layout::outputLayoutBox): 27 1 28 2019-11-22 Chris Dumez <cdumez@apple.com> 2 29 -
trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp
r252807 r252816 146 146 auto textContext = *m_initialInlineRun.textContext(); 147 147 auto length = textContext.length() + m_expandedLength; 148 textContext.expand(m_initialInlineRun.layoutBox().textContext() .content.substring(textContext.start(), length), length);148 textContext.expand(m_initialInlineRun.layoutBox().textContext()->content.substring(textContext.start(), length), length); 149 149 150 150 if (m_textIsAlignJustify) { … … 566 566 auto contentStart = inlineItem.start(); 567 567 auto contentLength = collapsedRun ? 1 : inlineItem.length(); 568 auto lineRun = makeUnique<InlineItemRun>(inlineItem, logicalRect, Display::Run::TextContext { contentStart, contentLength, inlineItem.layoutBox().textContext() .content.substring(contentStart, contentLength) });568 auto lineRun = makeUnique<InlineItemRun>(inlineItem, logicalRect, Display::Run::TextContext { contentStart, contentLength, inlineItem.layoutBox().textContext()->content.substring(contentStart, contentLength) }); 569 569 570 570 auto collapsesToZeroAdvanceWidth = willCollapseCompletely(); -
trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp
r252696 r252816 83 83 void InlineTextItem::createAndAppendTextItems(InlineItems& inlineContent, const Box& inlineBox) 84 84 { 85 auto text = inlineBox.textContext() .content;85 auto text = inlineBox.textContext()->content; 86 86 if (!text.length()) 87 87 return inlineContent.append(InlineTextItem::createEmptyItem(inlineBox)); … … 92 92 93 93 auto inlineItemWidth = [&](auto startPosition, auto length) -> Optional<LayoutUnit> { 94 if (!inlineBox.textContext() .canUseSimplifiedContentMeasuring)94 if (!inlineBox.textContext()->canUseSimplifiedContentMeasuring) 95 95 return { }; 96 96 return TextUtil::width(inlineBox, startPosition, startPosition + length); -
trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp
r252686 r252816 47 47 return 0; 48 48 49 auto& textContext = inlineBox.textContext();49 auto& textContext = *inlineBox.textContext(); 50 50 auto& text = textContext.content; 51 51 ASSERT(to <= text.length()); -
trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp
r252686 r252816 58 58 : Box({ }, WTFMove(style), BaseTypeFlag::BoxFlag) 59 59 { 60 setTextContext(WTFMove(textContext)); 60 ASSERT(isInlineLevelBox()); 61 m_textContext = makeUnique<TextContext>(WTFMove(textContext)); 61 62 } 62 63 … … 387 388 } 388 389 389 void Box::setTextContext(TextContext&& textContext)390 {391 ASSERT(isInlineLevelBox());392 ensureRareData().textContext = WTFMove(textContext);393 }394 395 bool Box::hasTextContent() const396 {397 ASSERT(isInlineLevelBox());398 return hasRareData() && !rareData().textContext.content.isNull();399 }400 401 const TextContext& Box::textContext() const402 {403 ASSERT(hasRareData());404 ASSERT(isInlineLevelBox());405 return rareData().textContext;406 }407 408 390 const Replaced* Box::replaced() const 409 391 { -
trunk/Source/WebCore/layout/layouttree/LayoutBox.h
r252686 r252816 144 144 // FIXME: Temporary until after intrinsic size change is tracked by Replaced. 145 145 Replaced* replaced(); 146 bool hasTextContent() const ;147 const TextContext & textContext() const;146 bool hasTextContent() const { return !!m_textContext; } 147 const TextContext* textContext() const { return m_textContext.get(); } 148 148 149 149 // FIXME: Find a better place for random DOM things. … … 167 167 168 168 private: 169 void setTextContext(TextContext&&);170 171 169 class BoxRareData { 172 170 WTF_MAKE_FAST_ALLOCATED; … … 174 172 BoxRareData() = default; 175 173 176 TextContext textContext;177 174 std::unique_ptr<Replaced> replaced; 178 175 unsigned rowSpan { 1 }; … … 197 194 Box* m_previousSibling { nullptr }; 198 195 Box* m_nextSibling { nullptr }; 196 197 std::unique_ptr<const TextContext> m_textContext; 199 198 200 199 unsigned m_baseTypeFlags : 6; -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r252686 r252816 389 389 stream << " layout box->(" << &layoutBox << ")"; 390 390 if (layoutBox.isInlineLevelBox() && layoutBox.isAnonymous()) 391 stream << " text content [\"" << layoutBox.textContext() .content.utf8().data() << "\"]";391 stream << " text content [\"" << layoutBox.textContext()->content.utf8().data() << "\"]"; 392 392 393 393 stream.nextLine();
Note: See TracChangeset
for help on using the changeset viewer.