Changeset 251638 in webkit
- Timestamp:
- Oct 26, 2019, 12:16:18 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
layout/LayoutContext.cpp (modified) (1 diff)
-
layout/LayoutContext.h (modified) (1 diff)
-
layout/LayoutState.cpp (modified) (1 diff)
-
layout/LayoutState.h (modified) (4 diffs)
-
layout/layouttree/LayoutTreeBuilder.cpp (modified) (1 diff)
-
page/FrameView.cpp (modified) (1 diff)
-
page/FrameViewLayoutContext.cpp (modified) (3 diffs)
-
page/FrameViewLayoutContext.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251637 r251638 1 2019-10-26 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Do not layout on every paint frame. 4 https://bugs.webkit.org/show_bug.cgi?id=203462 5 <rdar://problem/56646779> 6 7 Reviewed by Antti Koivisto. 8 9 This is in preparation for being able to run layout benchmarks. 10 11 * layout/LayoutContext.cpp: 12 (WebCore::Layout::LayoutContext::runLayoutAndVerify): 13 (WebCore::Layout::LayoutContext::paint): 14 (WebCore::Layout::LayoutContext::runLayoutAndPaint): Deleted. 15 * layout/LayoutContext.h: 16 * layout/LayoutState.cpp: 17 (WebCore::Layout::LayoutState::LayoutState): 18 * layout/LayoutState.h: 19 * layout/layouttree/LayoutTreeBuilder.cpp: 20 (WebCore::Layout::printLayoutTreeForLiveDocuments): 21 * page/FrameView.cpp: 22 (WebCore::FrameView::paintContents): 23 * page/FrameViewLayoutContext.cpp: 24 (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext): 25 (WebCore::FrameViewLayoutContext::layout): 26 (WebCore::layoutUsingFormattingContext): Deleted. 27 * page/FrameViewLayoutContext.h: 28 (WebCore::FrameViewLayoutContext::initialLayoutState const): 29 1 30 2019-10-26 Rob Buis <rbuis@igalia.com> 2 31 -
trunk/Source/WebCore/layout/LayoutContext.cpp
r250769 r251638 162 162 } 163 163 164 voidLayoutContext::runLayoutAndVerify(const RenderView& renderView)164 std::unique_ptr<LayoutState> LayoutContext::runLayoutAndVerify(const RenderView& renderView) 165 165 { 166 auto initialContainingBlock = TreeBuilder::createLayoutTree(renderView);167 auto layoutState = LayoutState { *initialContainingBlock };168 initializeLayoutState(layoutState, renderView);169 runLayout(layoutState);170 LayoutContext::verifyAndOutputMismatchingLayoutTree(layoutState, renderView);166 auto layoutState = makeUnique<LayoutState>(TreeBuilder::createLayoutTree(renderView)); 167 initializeLayoutState(*layoutState, renderView); 168 runLayout(*layoutState); 169 LayoutContext::verifyAndOutputMismatchingLayoutTree(*layoutState, renderView); 170 return layoutState; 171 171 } 172 172 173 void LayoutContext:: runLayoutAndPaint(const RenderView& renderView, GraphicsContext& context)173 void LayoutContext::paint(const LayoutState& layoutState, GraphicsContext& context) 174 174 { 175 auto initialContainingBlock = TreeBuilder::createLayoutTree(renderView);176 auto layoutState = LayoutState { *initialContainingBlock };177 initializeLayoutState(layoutState, renderView);178 runLayout(layoutState);179 175 Display::Painter::paint(layoutState, context); 180 176 } -
trunk/Source/WebCore/layout/LayoutContext.h
r251590 r251638 55 55 public: 56 56 // FIXME: These are temporary entry points for LFC layout. 57 static voidrunLayoutAndVerify(const RenderView&);58 static void runLayoutAndPaint(const RenderView&, GraphicsContext&);57 static std::unique_ptr<LayoutState> runLayoutAndVerify(const RenderView&); 58 static void paint(const LayoutState&, GraphicsContext&); 59 59 60 60 LayoutContext(LayoutState&); -
trunk/Source/WebCore/layout/LayoutState.cpp
r251484 r251638 39 39 WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutState); 40 40 41 LayoutState::LayoutState( const Container&root)42 : m_root( makeWeakPtr(root))41 LayoutState::LayoutState(std::unique_ptr<Container> root) 42 : m_root(WTFMove(root)) 43 43 { 44 44 // It makes absolutely no sense to construct a dedicated layout state for a non-formatting context root (it would be a no-op). 45 ASSERT( root.establishesFormattingContext());45 ASSERT(m_root->establishesFormattingContext()); 46 46 } 47 47 -
trunk/Source/WebCore/layout/LayoutState.h
r251484 r251638 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutContainer.h" 30 31 #include <wtf/HashMap.h> 31 32 #include <wtf/HashSet.h> … … 42 43 43 44 class Box; 44 class Container;45 45 class FormattingContext; 46 46 class FormattingState; … … 49 49 WTF_MAKE_ISO_ALLOCATED(LayoutState); 50 50 public: 51 LayoutState( const Container&root);51 LayoutState(std::unique_ptr<Container> root); 52 52 ~LayoutState(); 53 53 … … 75 75 76 76 private: 77 WeakPtr<const Container> m_root; 77 // FIXME: Figure out the ownership model for the layout tree. 78 std::unique_ptr<Container> m_root; 78 79 HashMap<const Container*, std::unique_ptr<FormattingState>> m_formattingStates; 79 80 #ifndef NDEBUG -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r251484 r251638 402 402 // FIXME: Need to find a way to output geometry without layout context. 403 403 auto& renderView = *document->renderView(); 404 auto initialContainingBlock = TreeBuilder::createLayoutTree(renderView); 405 auto layoutState = LayoutState { *initialContainingBlock }; 404 auto layoutState = LayoutState { TreeBuilder::createLayoutTree(renderView) }; 406 405 layoutState.setQuirksMode(renderView.document().inLimitedQuirksMode() ? LayoutState::QuirksMode::Limited : (renderView.document().inQuirksMode() ? LayoutState::QuirksMode::Yes : LayoutState::QuirksMode::No)); 407 406 LayoutContext(layoutState).layout(); 408 showLayoutTree( *initialContainingBlock, &layoutState);407 showLayoutTree(layoutState.root(), &layoutState); 409 408 } 410 409 } -
trunk/Source/WebCore/page/FrameView.cpp
r251567 r251638 4181 4181 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 4182 4182 if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) { 4183 Layout::LayoutContext::runLayoutAndPaint(*renderView, context); 4183 if (auto* layoutState = layoutContext().initialLayoutState()) 4184 Layout::LayoutContext::paint(*layoutState, context); 4184 4185 return; 4185 4186 } -
trunk/Source/WebCore/page/FrameViewLayoutContext.cpp
r251605 r251638 42 42 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 43 43 #include "LayoutContext.h" 44 #include "LayoutState.h" 44 45 #endif 45 46 … … 51 52 52 53 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 53 static void layoutUsingFormattingContext(const RenderView& renderView)54 void FrameViewLayoutContext::layoutUsingFormattingContext() 54 55 { 55 56 if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) 56 57 return; 57 Layout::LayoutContext::runLayoutAndVerify(renderView);58 m_initialLayoutState = Layout::LayoutContext::runLayoutAndVerify(*renderView()); 58 59 } 59 60 #endif … … 205 206 layoutRoot->layout(); 206 207 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 207 layoutUsingFormattingContext( *renderView());208 layoutUsingFormattingContext(); 208 209 #endif 209 210 ++m_layoutCount; -
trunk/Source/WebCore/page/FrameViewLayoutContext.h
r245868 r251638 43 43 class RenderLayoutState; 44 44 class RenderView; 45 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 46 namespace Layout { 47 class LayoutState; 48 } 49 #endif 45 50 46 51 class FrameViewLayoutContext { … … 111 116 using LayoutStateStack = Vector<std::unique_ptr<RenderLayoutState>>; 112 117 118 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 119 const Layout::LayoutState* initialLayoutState() const { return m_initialLayoutState.get(); } 120 #endif 121 113 122 private: 114 123 friend class LayoutScope; … … 151 160 void disablePaintOffsetCache() { m_paintOffsetCacheDisableCount++; } 152 161 void enablePaintOffsetCache() { ASSERT(m_paintOffsetCacheDisableCount > 0); m_paintOffsetCacheDisableCount--; } 162 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 163 void layoutUsingFormattingContext(); 164 #endif 153 165 154 166 Frame& frame() const; … … 176 188 unsigned m_paintOffsetCacheDisableCount { 0 }; 177 189 LayoutStateStack m_layoutStateStack; 190 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 191 std::unique_ptr<Layout::LayoutState> m_initialLayoutState; 192 #endif 178 193 }; 179 194
Note:
See TracChangeset
for help on using the changeset viewer.