Changeset 238431 in webkit
- Timestamp:
- Nov 21, 2018, 3:25:13 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
layout/LayoutFormattingState.cpp (modified) (2 diffs)
-
layout/LayoutFormattingState.h (modified) (3 diffs)
-
layout/Verification.cpp (modified) (1 diff)
-
page/FrameViewLayoutContext.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r238430 r238431 1 2018-11-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] LayoutState should always be initialized with the initial containing block. 4 https://bugs.webkit.org/show_bug.cgi?id=191896 5 6 Reviewed by Antti Koivisto. 7 8 There should always be only one LayoutState per layout tree (it does not mean that layout always starts at the ICB). 9 The ICB is a special formatting context root because it does not have a parent formatting context. All the other formatting contexts 10 first need to be laid out (partially at least e.g margin) in their parent formatting context. 11 Having a non-null parent formatting context as root could lead to undefined behaviour. 12 13 * layout/LayoutFormattingState.cpp: 14 (WebCore::Layout::LayoutState::LayoutState): 15 (WebCore::Layout::LayoutState::initializeRoot): Deleted. 16 * layout/LayoutFormattingState.h: 17 * layout/Verification.cpp: 18 (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const): 19 * page/FrameViewLayoutContext.cpp: 20 (WebCore::layoutUsingFormattingContext): 21 1 22 2018-11-21 Zalan Bujtas <zalan@apple.com> 2 23 -
trunk/Source/WebCore/layout/LayoutFormattingState.cpp
r237634 r238431 46 46 WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutState); 47 47 48 LayoutState::LayoutState() 48 LayoutState::LayoutState(const Container& initialContainingBlock, const LayoutSize& containerSize) 49 : m_initialContainingBlock(makeWeakPtr(initialContainingBlock)) 49 50 { 50 } 51 // LayoutState is always initiated with the ICB. 52 ASSERT(!initialContainingBlock.parent()); 53 ASSERT(initialContainingBlock.establishesBlockFormattingContext()); 51 54 52 void LayoutState::initializeRoot(const Container& root, const LayoutSize& containerSize) 53 { 54 ASSERT(root.establishesFormattingContext()); 55 56 m_root = makeWeakPtr(root); 57 auto& displayBox = displayBoxForLayoutBox(root); 58 59 // FIXME: m_root could very well be a formatting context root with ancestors and resolvable border and padding (as opposed to the topmost root) 55 auto& displayBox = displayBoxForLayoutBox(initialContainingBlock); 60 56 displayBox.setHorizontalMargin({ }); 61 57 displayBox.setHorizontalNonComputedMargin({ }); … … 64 60 displayBox.setBorder({ }); 65 61 displayBox.setPadding({ }); 62 displayBox.setTopLeft({ }); 66 63 displayBox.setContentBoxHeight(containerSize.height()); 67 64 displayBox.setContentBoxWidth(containerSize.width()); 68 displayBox.setTopLeft({ });69 65 70 m_formattingContextRootListForLayout.add(& root);66 m_formattingContextRootListForLayout.add(&initialContainingBlock); 71 67 } 72 68 -
trunk/Source/WebCore/layout/LayoutFormattingState.h
r237633 r238431 50 50 class FormattingState; 51 51 52 // LayoutState is the entry point for layout. It takes a (formatting root)containerwhich acts as the root of the layout context.52 // LayoutState is the entry point for layout. It takes the initial containing block which acts as the root of the layout context. 53 53 // LayoutState::layout() generates the display tree for the root container's subtree (it does not run layout on the root though). 54 // Note, while the root container is suppposed to be theentry point for the initial layout, it does not necessarily need to be the entry point of any54 // Note, while the initial containing block is entry point for the initial layout, it does not necessarily need to be the entry point of any 55 55 // subsequent layouts (subtree layout). A non-initial, subtree layout could be initiated on multiple formatting contexts. 56 56 // Each formatting context has an entry point for layout, which potenitally means multiple entry points per layout frame. … … 59 59 WTF_MAKE_ISO_ALLOCATED(LayoutState); 60 60 public: 61 LayoutState( );61 LayoutState(const Container& initialContainingBlock, const LayoutSize&); 62 62 63 void initializeRoot(const Container&, const LayoutSize&);64 63 void updateLayout(); 65 64 void styleChanged(const Box&, StyleDiff); … … 87 86 88 87 private: 88 const Container& initialContainingBlock() const { return *m_initialContainingBlock; } 89 89 void layoutFormattingContextSubtree(const Box&); 90 90 91 WeakPtr<const Container> m_ root;91 WeakPtr<const Container> m_initialContainingBlock; 92 92 HashSet<const Container*> m_formattingContextRootListForLayout; 93 93 HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates; -
trunk/Source/WebCore/layout/Verification.cpp
r238415 r238431 322 322 { 323 323 TextStream stream; 324 auto mismatchingGeometry = verifyAndOutputSubtree(stream, *this, renderView, *m_root.get());324 auto mismatchingGeometry = verifyAndOutputSubtree(stream, *this, renderView, initialContainingBlock()); 325 325 if (!mismatchingGeometry) 326 326 return; 327 327 #if ENABLE(TREE_DEBUGGING) 328 328 showRenderTree(&renderView); 329 showLayoutTree( *m_root.get(), this);329 showLayoutTree(initialContainingBlock(), this); 330 330 #endif 331 331 WTFLogAlways("%s", stream.release().utf8().data()); -
trunk/Source/WebCore/page/FrameViewLayoutContext.cpp
r237631 r238431 57 57 { 58 58 auto initialContainingBlock = Layout::TreeBuilder::createLayoutTree(renderView); 59 auto layoutState = std::make_unique<Layout::LayoutState>(); 60 layoutState->initializeRoot(*initialContainingBlock, renderView.size()); 59 auto layoutState = std::make_unique<Layout::LayoutState>(*initialContainingBlock, renderView.size()); 61 60 layoutState->setInQuirksMode(renderView.document().inQuirksMode()); 62 61 layoutState->updateLayout();
Note:
See TracChangeset
for help on using the changeset viewer.