WebKit Bugzilla
Attachment 358995 Details for
Bug 193383
: [LFC] Block/InlinFormattingContext should take Block/InlineFormattingState
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193383-20190112124647.patch (text/plain), 13.34 KB, created by
zalan
on 2019-01-12 12:47:00 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-01-12 12:47:00 PST
Size:
13.34 KB
patch
obsolete
>Subversion Revision: 239900 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9baf8cbb65257398247b74e9d5bc57069f04ae02..ca08b64fde170a36b99f09f08904436b027c2fbe 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2019-01-12 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Block/InlinFormattingContext should take Block/InlineFormattingState >+ https://bugs.webkit.org/show_bug.cgi?id=193383 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is just a downcast really. >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::FormattingContext): >+ (WebCore::Layout::FormattingContext::formattingState const): Deleted. >+ * layout/FormattingContext.h: >+ * layout/LayoutState.cpp: >+ (WebCore::Layout::LayoutState::createFormattingContext): >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::BlockFormattingContext): >+ * layout/blockformatting/BlockFormattingContext.h: >+ (WebCore::Layout::BlockFormattingContext::formattingState const): >+ (WebCore::Layout::BlockFormattingContext::blockFormattingState const): Deleted. >+ * layout/inlineformatting/InlineFormattingContext.cpp: >+ (WebCore::Layout::InlineFormattingContext::InlineFormattingContext): >+ (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const): >+ (WebCore::Layout::InlineFormattingContext::createFinalRuns const): >+ (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const): >+ (WebCore::Layout::InlineFormattingContext::layoutInlineContent const): >+ (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const): >+ (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const): >+ (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const): >+ * layout/inlineformatting/InlineFormattingContext.h: >+ (WebCore::Layout::InlineFormattingContext::formattingState const): >+ (WebCore::Layout::InlineFormattingContext::inlineFormattingState const): Deleted. >+ * page/FrameViewLayoutContext.cpp: >+ (WebCore::layoutUsingFormattingContext): >+ > 2019-01-12 Zalan Bujtas <zalan@apple.com> > > [LFC] Move formatting context creation from FormattingState to LayoutState >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index d5a83ed15d1b576d2602782c0886ba7a8431f574..26b689a6a13f3f3d6411298ce1b1c72a22cac9b9 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -44,8 +44,8 @@ namespace Layout { > WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingContext); > > FormattingContext::FormattingContext(const Box& formattingContextRoot, FormattingState& formattingState) >- : m_root(makeWeakPtr(formattingContextRoot)) >- , m_formattingState(formattingState) >+ : m_formattingState(formattingState) >+ , m_root(makeWeakPtr(formattingContextRoot)) > { > #ifndef NDEBUG > layoutState().registerFormattingContext(*this); >@@ -59,11 +59,6 @@ FormattingContext::~FormattingContext() > #endif > } > >-FormattingState& FormattingContext::formattingState() const >-{ >- return m_formattingState; >-} >- > LayoutState& FormattingContext::layoutState() const > { > return m_formattingState.layoutState(); >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 42d729b75172747a91e1cd9fa0dfc5188cd0b9c1..48e64397e806a4e7fd9db0b659e4e9016553e36a 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -65,7 +65,6 @@ public: > protected: > using LayoutQueue = Vector<const Box*>; > >- FormattingState& formattingState() const; > LayoutState& layoutState() const; > const Box& root() const { return *m_root; } > >@@ -127,12 +126,13 @@ protected: > static LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const LayoutState&, const Box&); > }; > >+ FormattingState& m_formattingState; >+ > private: > void computeOutOfFlowVerticalGeometry(const Box&) const; > void computeOutOfFlowHorizontalGeometry(const Box&) const; > > WeakPtr<const Box> m_root; >- FormattingState& m_formattingState; > }; > > } >diff --git a/Source/WebCore/layout/LayoutState.cpp b/Source/WebCore/layout/LayoutState.cpp >index b4765d288fa971c7b7c124cfe771be52a52f5097..c98628b8dcbc5f681fb3bfb11f0b5d5ecec73dc8 100644 >--- a/Source/WebCore/layout/LayoutState.cpp >+++ b/Source/WebCore/layout/LayoutState.cpp >@@ -153,12 +153,15 @@ FormattingState& LayoutState::createFormattingStateForFormattingRootIfNeeded(con > std::unique_ptr<FormattingContext> LayoutState::createFormattingContext(const Box& formattingContextRoot) > { > ASSERT(formattingContextRoot.establishesFormattingContext()); >- if (formattingContextRoot.establishesInlineFormattingContext()) >- return std::make_unique<InlineFormattingContext>(formattingContextRoot, createFormattingStateForFormattingRootIfNeeded(formattingContextRoot)); >+ if (formattingContextRoot.establishesInlineFormattingContext()) { >+ auto& inlineFormattingState = downcast<InlineFormattingState>(createFormattingStateForFormattingRootIfNeeded(formattingContextRoot)); >+ return std::make_unique<InlineFormattingContext>(formattingContextRoot, inlineFormattingState); >+ } > > if (formattingContextRoot.establishesBlockFormattingContext()) { > ASSERT(formattingContextRoot.establishesBlockFormattingContextOnly()); >- return std::make_unique<BlockFormattingContext>(formattingContextRoot, createFormattingStateForFormattingRootIfNeeded(formattingContextRoot)); >+ auto& blockFormattingState = downcast<BlockFormattingState>(createFormattingStateForFormattingRootIfNeeded(formattingContextRoot)); >+ return std::make_unique<BlockFormattingContext>(formattingContextRoot, blockFormattingState); > } > > CRASH(); >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 2faf75e4b14b43d8cff863b77c7e8c05df45083f..1f4465aa99f606d9335ebfc43ac0b3bad462d625 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -44,7 +44,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingContext); > >-BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState) >+BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot, BlockFormattingState& formattingState) > : FormattingContext(formattingContextRoot, formattingState) > { > } >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 8c837b0abfe33ec66f3702d16f6956d8f27988b3..a0113eca5ef5d8ba1a5e3a6bb763e64e1ec06ebc 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -47,13 +47,11 @@ class FloatingContext; > class BlockFormattingContext : public FormattingContext { > WTF_MAKE_ISO_ALLOCATED(BlockFormattingContext); > public: >- BlockFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState); >+ BlockFormattingContext(const Box& formattingContextRoot, BlockFormattingState&); > > void layout() const override; > > private: >- BlockFormattingState& blockFormattingState() const { return downcast<BlockFormattingState>(formattingState()); } >- > void layoutFormattingContextRoot(FloatingContext&, const Box&) const; > void placeInFlowPositionedChildren(const Container&) const; > >@@ -137,6 +135,8 @@ private: > bool hasPrecomputedMarginBefore(const Box&) const; > #endif > >+ BlockFormattingState& formattingState() const { return downcast<BlockFormattingState>(m_formattingState); } >+ > private: > mutable HashMap<const Box*, EstimatedMarginBefore> m_estimatedMarginBeforeList; > }; >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index 408d7876c332a3ba00a0cd4a0df39f4e1ededf8a..96f01eae466076eac7f98179286310bb0e792e4c 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -48,7 +48,7 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(InlineFormattingContext); > >-InlineFormattingContext::InlineFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState) >+InlineFormattingContext::InlineFormattingContext(const Box& formattingContextRoot, InlineFormattingState& formattingState) > : FormattingContext(formattingContextRoot, formattingState) > { > } >@@ -133,7 +133,7 @@ void InlineFormattingContext::splitInlineRunIfNeeded(const InlineRun& inlineRun, > // 1. Start with the first inline item (element) and travers the list until > // 2. either find an inline item that needs a dedicated run or we reach the end of the run > // 3. Create dedicate inline runs. >- auto& inlineContent = inlineFormattingState().inlineContent(); >+ auto& inlineContent = formattingState().inlineContent(); > auto contentStart = inlineRun.logicalLeft(); > auto startPosition = inlineRun.textContext()->start(); > auto remaningLength = inlineRun.textContext()->length(); >@@ -215,7 +215,7 @@ void InlineFormattingContext::splitInlineRunIfNeeded(const InlineRun& inlineRun, > > void InlineFormattingContext::createFinalRuns(Line& line) const > { >- auto& inlineFormattingState = this->inlineFormattingState(); >+ auto& inlineFormattingState = formattingState(); > for (auto& inlineRun : line.runs()) { > if (inlineRun.overlapsMultipleInlineItems()) { > InlineRuns splitRuns; >@@ -246,7 +246,7 @@ void InlineFormattingContext::createFinalRuns(Line& line) const > void InlineFormattingContext::postProcessInlineRuns(Line& line, IsLastLine isLastLine) const > { > Geometry::alignRuns(root().style().textAlign(), line, isLastLine); >- auto firstRunIndex = inlineFormattingState().inlineRuns().size(); >+ auto firstRunIndex = formattingState().inlineRuns().size(); > createFinalRuns(line); > > placeInFlowPositionedChildren(firstRunIndex); >@@ -273,7 +273,7 @@ void InlineFormattingContext::appendContentToLine(Line& line, const InlineRunPro > void InlineFormattingContext::layoutInlineContent(const InlineRunProvider& inlineRunProvider) const > { > auto& layoutState = this->layoutState(); >- auto& inlineFormattingState = this->inlineFormattingState(); >+ auto& inlineFormattingState = formattingState(); > auto floatingContext = FloatingContext { inlineFormattingState.floatingState() }; > > Line line; >@@ -408,7 +408,7 @@ void InlineFormattingContext::computeFloatPosition(const FloatingContext& floati > > void InlineFormattingContext::placeInFlowPositionedChildren(unsigned fistRunIndex) const > { >- auto& inlineRuns = inlineFormattingState().inlineRuns(); >+ auto& inlineRuns = formattingState().inlineRuns(); > for (auto runIndex = fistRunIndex; runIndex < inlineRuns.size(); ++runIndex) { > auto& inlineRun = inlineRuns[runIndex]; > >@@ -433,7 +433,7 @@ void InlineFormattingContext::placeInFlowPositionedChildren(unsigned fistRunInde > void InlineFormattingContext::collectInlineContentForSubtree(const Box& root, InlineRunProvider& inlineRunProvider) const > { > // Collect inline content recursively and set breaking rules for the inline elements (for paddings, margins, positioned element etc). >- auto& inlineFormattingState = this->inlineFormattingState(); >+ auto& inlineFormattingState = formattingState(); > > auto createAndAppendInlineItem = [&] { > auto inlineItem = std::make_unique<InlineItem>(root); >@@ -528,7 +528,7 @@ FormattingContext::InstrinsicWidthConstraints InlineFormattingContext::instrinsi > if (auto instrinsicWidthConstraints = formattingStateForRoot.instrinsicWidthConstraints(root())) > return *instrinsicWidthConstraints; > >- auto& inlineFormattingState = this->inlineFormattingState(); >+ auto& inlineFormattingState = formattingState(); > InlineRunProvider inlineRunProvider; > collectInlineContent(inlineRunProvider); > >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >index 4010ffd04e6a6848d8d8e7e975862d8ec976723c..5a7e9140196b9dfce859b183740311b4f970f7b0 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >@@ -43,7 +43,7 @@ class InlineRunProvider; > class InlineFormattingContext : public FormattingContext { > WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext); > public: >- InlineFormattingContext(const Box& formattingContextRoot, FormattingState&); >+ InlineFormattingContext(const Box& formattingContextRoot, InlineFormattingState&); > > void layout() const override; > >@@ -121,7 +121,7 @@ private: > void collectInlineContentForSubtree(const Box& root, InlineRunProvider&) const; > InstrinsicWidthConstraints instrinsicWidthConstraints() const override; > >- InlineFormattingState& inlineFormattingState() const { return downcast<InlineFormattingState>(formattingState()); } >+ InlineFormattingState& formattingState() const { return downcast<InlineFormattingState>(m_formattingState); } > }; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193383
: 358995