Changeset 252932 in webkit
- Timestamp:
- Nov 28, 2019 12:06:49 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252928 r252932 1 2019-11-28 Antti Koivisto <antti@apple.com> 2 3 [LFC][IFC] Remove m_inlineRunToLineMap 4 https://bugs.webkit.org/show_bug.cgi?id=204688 5 6 Reviewed by Zalan Bujtas. 7 8 Add line index to Display::Run and use it to locate the line it is on. 9 10 This is 4-5% progression in PerformanceTests/Layout/line-layout-simple.html 11 12 * layout/displaytree/DisplayRun.h: 13 (WebCore::Display::Run::lineIndex const): 14 (WebCore::Display::Run::Run): 15 * layout/inlineformatting/InlineFormattingContext.cpp: 16 (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine): 17 * layout/inlineformatting/InlineFormattingState.h: 18 (WebCore::Layout::InlineFormattingState::lineBoxForRun const): 19 (WebCore::Layout::InlineFormattingState::addInlineRun): 20 (WebCore::Layout::InlineFormattingState::resetInlineRuns): 21 1 22 2019-11-28 Antti Koivisto <antti@apple.com> 2 23 -
trunk/Source/WebCore/layout/displaytree/DisplayRun.h
r252905 r252932 68 68 }; 69 69 70 Run(const RenderStyle&, const Rect& logicalRect, Optional<TextContext> = WTF::nullopt); 70 Run(size_t lineIndex, const RenderStyle&, const Rect& logicalRect, Optional<TextContext> = WTF::nullopt); 71 72 size_t lineIndex() const { return m_lineIndex; } 71 73 72 74 const Rect& logicalRect() const { return m_logicalRect; } … … 100 102 private: 101 103 // FIXME: Find out the Display::Run <-> paint style setup. 104 const size_t m_lineIndex; 102 105 const RenderStyle& m_style; 103 106 CachedImage* m_cachedImage { nullptr }; … … 106 109 }; 107 110 108 inline Run::Run(const RenderStyle& style, const Rect& logicalRect, Optional<TextContext> textContext) 109 : m_style(style) 111 inline Run::Run(size_t lineIndex, const RenderStyle& style, const Rect& logicalRect, Optional<TextContext> textContext) 112 : m_lineIndex(lineIndex) 113 , m_style(style) 110 114 , m_logicalRect(logicalRect) 111 115 , m_textContext(textContext) -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r252865 r252932 427 427 } 428 428 429 auto lineIndex = formattingState.lineBoxes().size(); 429 430 formattingState.addLineBox(lineContent.lineBox); 430 auto& currentLine = *formattingState.lineBoxes().last(); 431 431 432 // Compute box final geometry. 432 433 auto& lineRuns = lineContent.runList; … … 441 442 auto initiatesInlineRun = !lineRun.isContainerStart() && !lineRun.isContainerEnd() && !lineRun.isCollapsedToVisuallyEmpty(); 442 443 if (initiatesInlineRun) 443 formattingState.addInlineRun(makeUnique<Display::Run>(line Run.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext()), currentLine);444 formattingState.addInlineRun(makeUnique<Display::Run>(lineIndex, lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext())); 444 445 445 446 if (lineRun.isForcedLineBreak()) { -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h
r252638 r252932 55 55 const InlineRuns& inlineRuns() const { return m_inlineRuns; } 56 56 InlineRuns& inlineRuns() { return m_inlineRuns; } 57 void addInlineRun(std::unique_ptr<Display::Run>&& , const LineBox&);57 void addInlineRun(std::unique_ptr<Display::Run>&&); 58 58 void resetInlineRuns(); 59 59 … … 62 62 void addLineBox(const LineBox& lineBox) { m_lineBoxes.append(makeUnique<LineBox>(lineBox)); } 63 63 64 const LineBox& lineBoxForRun(const Display::Run& inlineRun) const { return *m_ inlineRunToLineMap.get(&inlineRun); }64 const LineBox& lineBoxForRun(const Display::Run& inlineRun) const { return *m_lineBoxes[inlineRun.lineIndex()]; } 65 65 66 66 private: … … 68 68 InlineRuns m_inlineRuns; 69 69 LineBoxes m_lineBoxes; 70 // This is temporary until after we figure out the display run/line relationships.71 HashMap<const Display::Run*, const LineBox*> m_inlineRunToLineMap;72 70 }; 73 71 74 inline void InlineFormattingState::addInlineRun(std::unique_ptr<Display::Run>&& displayRun , const LineBox& line)72 inline void InlineFormattingState::addInlineRun(std::unique_ptr<Display::Run>&& displayRun) 75 73 { 76 m_inlineRunToLineMap.set(displayRun.get(), &line);77 74 m_inlineRuns.append(WTFMove(displayRun)); 78 75 } … … 83 80 // Resetting the runs means no more line boxes either. 84 81 m_lineBoxes.clear(); 85 m_inlineRunToLineMap.clear();86 82 87 83 }
Note: See TracChangeset
for help on using the changeset viewer.