Changeset 237633 in webkit
- Timestamp:
- Oct 31, 2018, 6:50:05 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
-
ChangeLog (modified) (1 diff)
-
layout/FormattingContext.cpp (modified) (2 diffs)
-
layout/FormattingContext.h (modified) (4 diffs)
-
layout/FormattingState.cpp (modified) (1 diff)
-
layout/FormattingState.h (modified) (2 diffs)
-
layout/LayoutFormattingState.h (modified) (1 diff)
-
layout/blockformatting/BlockFormattingContext.cpp (modified) (1 diff)
-
layout/blockformatting/BlockFormattingContext.h (modified) (1 diff)
-
layout/blockformatting/BlockFormattingState.cpp (modified) (2 diffs)
-
layout/blockformatting/BlockFormattingState.h (modified) (1 diff)
-
layout/inlineformatting/InlineFormattingContext.cpp (modified) (1 diff)
-
layout/inlineformatting/InlineFormattingContext.h (modified) (1 diff)
-
layout/inlineformatting/InlineFormattingState.cpp (modified) (2 diffs)
-
layout/inlineformatting/InlineFormattingState.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r237632 r237633 1 2018-10-31 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] FormattingContext class should take FormattingState& 4 https://bugs.webkit.org/show_bug.cgi?id=191099 5 6 Reviewed by Antti Koivisto. 7 8 This is in preparation for not passing LayoutState& into every layout functions. 9 FormattingContext has FormattingState now and LayoutState can be acquired through FormattingState. 10 LayoutState <- FormattingState <- FormattingContext 11 12 * layout/FormattingContext.cpp: 13 (WebCore::Layout::FormattingContext::FormattingContext): 14 (WebCore::Layout::FormattingContext::formattingState const): 15 (WebCore::Layout::FormattingContext::layoutState const): 16 * layout/FormattingContext.h: 17 * layout/FormattingState.cpp: 18 (WebCore::Layout::FormattingState::FormattingState): 19 * layout/FormattingState.h: 20 (WebCore::Layout::FormattingState::layoutState const): 21 * layout/LayoutFormattingState.h: 22 * layout/blockformatting/BlockFormattingContext.cpp: 23 (WebCore::Layout::BlockFormattingContext::BlockFormattingContext): 24 * layout/blockformatting/BlockFormattingContext.h: 25 * layout/blockformatting/BlockFormattingState.cpp: 26 (WebCore::Layout::BlockFormattingState::BlockFormattingState): 27 (WebCore::Layout::BlockFormattingState::formattingContext): 28 (WebCore::Layout::BlockFormattingState::formattingContext const): Deleted. 29 * layout/blockformatting/BlockFormattingState.h: 30 * layout/inlineformatting/InlineFormattingContext.cpp: 31 (WebCore::Layout::InlineFormattingContext::InlineFormattingContext): 32 * layout/inlineformatting/InlineFormattingContext.h: 33 * layout/inlineformatting/InlineFormattingState.cpp: 34 (WebCore::Layout::InlineFormattingState::InlineFormattingState): 35 (WebCore::Layout::InlineFormattingState::formattingContext): 36 (WebCore::Layout::InlineFormattingState::formattingContext const): Deleted. 37 * layout/inlineformatting/InlineFormattingState.h: 38 1 39 2018-10-31 Zalan Bujtas <zalan@apple.com> 2 40 -
trunk/Source/WebCore/layout/FormattingContext.cpp
r237632 r237633 44 44 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingContext); 45 45 46 FormattingContext::FormattingContext(const Box& formattingContextRoot )46 FormattingContext::FormattingContext(const Box& formattingContextRoot, FormattingState& formattingState) 47 47 : m_root(makeWeakPtr(formattingContextRoot)) 48 , m_formattingState(formattingState) 48 49 { 49 50 } … … 51 52 FormattingContext::~FormattingContext() 52 53 { 54 } 55 56 FormattingState& FormattingContext::formattingState() const 57 { 58 return m_formattingState; 59 } 60 61 LayoutState& FormattingContext::layoutState() const 62 { 63 return m_formattingState.layoutState(); 53 64 } 54 65 -
trunk/Source/WebCore/layout/FormattingContext.h
r237631 r237633 29 29 30 30 #include "DisplayBox.h" 31 #include "FloatingState.h"32 31 #include <wtf/IsoMalloc.h> 33 32 #include <wtf/WeakPtr.h> … … 48 47 WTF_MAKE_ISO_ALLOCATED(FormattingContext); 49 48 public: 50 FormattingContext(const Box& formattingContextRoot );49 FormattingContext(const Box& formattingContextRoot, FormattingState&); 51 50 virtual ~FormattingContext(); 52 51 … … 67 66 using LayoutQueue = Vector<const Box*>; 68 67 68 FormattingState& formattingState() const; 69 LayoutState& layoutState() const; 69 70 const Box& root() const { return *m_root; } 70 71 … … 127 128 128 129 WeakPtr<const Box> m_root; 130 FormattingState& m_formattingState; 129 131 }; 130 132 -
trunk/Source/WebCore/layout/FormattingState.cpp
r237631 r237633 36 36 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingState); 37 37 38 FormattingState::FormattingState(Ref<FloatingState>&& floatingState, Type type, constLayoutState& layoutState)38 FormattingState::FormattingState(Ref<FloatingState>&& floatingState, Type type, LayoutState& layoutState) 39 39 : m_layoutState(layoutState) 40 40 , m_floatingState(WTFMove(floatingState)) -
trunk/Source/WebCore/layout/FormattingState.h
r237632 r237633 47 47 virtual ~FormattingState(); 48 48 49 virtual std::unique_ptr<FormattingContext>formattingContext(const Box& formattingContextRoot) const= 0;49 virtual std::unique_ptr<FormattingContext>formattingContext(const Box& formattingContextRoot) = 0; 50 50 51 51 FloatingState& floatingState() const { return m_floatingState; } … … 61 61 bool isInlineFormattingState() const { return m_type == Type::Inline; } 62 62 63 LayoutState& layoutState() const { return m_layoutState; } 64 63 65 protected: 64 66 enum class Type { Block, Inline }; 65 FormattingState(Ref<FloatingState>&&, Type, const LayoutState&); 66 67 const LayoutState& m_layoutState; 67 FormattingState(Ref<FloatingState>&&, Type, LayoutState&); 68 68 69 69 private: 70 LayoutState& m_layoutState; 70 71 Ref<FloatingState> m_floatingState; 71 72 HashMap<const Box*, FormattingContext::InstrinsicWidthConstraints> m_instrinsicWidthConstraints; -
trunk/Source/WebCore/layout/LayoutFormattingState.h
r237632 r237633 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "FormattingContext.h"31 30 #include <wtf/HashMap.h> 32 31 #include <wtf/HashSet.h> -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r237632 r237633 45 45 WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingContext); 46 46 47 BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot )48 : FormattingContext(formattingContextRoot )47 BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState) 48 : FormattingContext(formattingContextRoot, formattingState) 49 49 { 50 50 } -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r237631 r237633 46 46 WTF_MAKE_ISO_ALLOCATED(BlockFormattingContext); 47 47 public: 48 BlockFormattingContext(const Box& formattingContextRoot );48 BlockFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState); 49 49 50 50 void layout(LayoutState&, FormattingState&) const override; -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingState.cpp
r237632 r237633 38 38 WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingState); 39 39 40 BlockFormattingState::BlockFormattingState(Ref<FloatingState>&& floatingState, constLayoutState& layoutState)40 BlockFormattingState::BlockFormattingState(Ref<FloatingState>&& floatingState, LayoutState& layoutState) 41 41 : FormattingState(WTFMove(floatingState), Type::Block, layoutState) 42 42 { … … 47 47 } 48 48 49 std::unique_ptr<FormattingContext> BlockFormattingState::formattingContext(const Box& formattingContextRoot) const49 std::unique_ptr<FormattingContext> BlockFormattingState::formattingContext(const Box& formattingContextRoot) 50 50 { 51 51 ASSERT(formattingContextRoot.establishesBlockFormattingContext()); 52 return std::make_unique<BlockFormattingContext>(formattingContextRoot );52 return std::make_unique<BlockFormattingContext>(formattingContextRoot, *this); 53 53 } 54 54 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingState.h
r237632 r237633 39 39 WTF_MAKE_ISO_ALLOCATED(BlockFormattingState); 40 40 public: 41 BlockFormattingState(Ref<FloatingState>&&, constLayoutState&);41 BlockFormattingState(Ref<FloatingState>&&, LayoutState&); 42 42 virtual ~BlockFormattingState(); 43 43 44 std::unique_ptr<FormattingContext> formattingContext(const Box& formattingContextRoot) constoverride;44 std::unique_ptr<FormattingContext> formattingContext(const Box& formattingContextRoot) override; 45 45 }; 46 46 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r237632 r237633 47 47 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineFormattingContext); 48 48 49 InlineFormattingContext::InlineFormattingContext(const Box& formattingContextRoot )50 : FormattingContext(formattingContextRoot )49 InlineFormattingContext::InlineFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState) 50 : FormattingContext(formattingContextRoot, formattingState) 51 51 { 52 52 } -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h
r237631 r237633 44 44 WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext); 45 45 public: 46 InlineFormattingContext(const Box& formattingContextRoot );46 InlineFormattingContext(const Box& formattingContextRoot, FormattingState&); 47 47 48 48 void layout(LayoutState&, FormattingState&) const override; -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp
r237632 r237633 36 36 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineFormattingState); 37 37 38 InlineFormattingState::InlineFormattingState(Ref<FloatingState>&& floatingState, constLayoutState& layoutState)38 InlineFormattingState::InlineFormattingState(Ref<FloatingState>&& floatingState, LayoutState& layoutState) 39 39 : FormattingState(WTFMove(floatingState), Type::Inline, layoutState) 40 40 { … … 45 45 } 46 46 47 std::unique_ptr<FormattingContext> InlineFormattingState::formattingContext(const Box& formattingContextRoot) const47 std::unique_ptr<FormattingContext> InlineFormattingState::formattingContext(const Box& formattingContextRoot) 48 48 { 49 49 ASSERT(formattingContextRoot.establishesInlineFormattingContext()); 50 return std::make_unique<InlineFormattingContext>(formattingContextRoot );50 return std::make_unique<InlineFormattingContext>(formattingContextRoot, this); 51 51 } 52 52 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h
r237632 r237633 40 40 WTF_MAKE_ISO_ALLOCATED(InlineFormattingState); 41 41 public: 42 InlineFormattingState(Ref<FloatingState>&&, constLayoutState&);42 InlineFormattingState(Ref<FloatingState>&&, LayoutState&); 43 43 virtual ~InlineFormattingState(); 44 44 45 std::unique_ptr<FormattingContext> formattingContext(const Box& formattingContextRoot) constoverride;45 std::unique_ptr<FormattingContext> formattingContext(const Box& formattingContextRoot) override; 46 46 47 47 InlineContent& inlineContent() { return m_inlineContent; }
Note:
See TracChangeset
for help on using the changeset viewer.