Title: [239903] trunk/Source/WebCore
Revision
239903
Author
[email protected]
Date
2019-01-12 13:28:15 -0800 (Sat, 12 Jan 2019)

Log Message

[LFC] Block/InlinFormattingContext should take Block/InlineFormattingState
https://bugs.webkit.org/show_bug.cgi?id=193383

Reviewed by Antti Koivisto.

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239902 => 239903)


--- trunk/Source/WebCore/ChangeLog	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/ChangeLog	2019-01-12 21:28:15 UTC (rev 239903)
@@ -1,3 +1,38 @@
+2019-01-12  Zalan Bujtas  <[email protected]>
+
+        [LFC] Block/InlinFormattingContext should take Block/InlineFormattingState
+        https://bugs.webkit.org/show_bug.cgi?id=193383
+
+        Reviewed by Antti Koivisto.
+
+        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  Myles C. Maxfield  <[email protected]>
 
         [WHLSL] Add native function synthesis passes

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (239902 => 239903)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2019-01-12 21:28:15 UTC (rev 239903)
@@ -59,11 +59,6 @@
 #endif
 }
 
-FormattingState& FormattingContext::formattingState() const
-{
-    return m_formattingState;
-}
-
 LayoutState& FormattingContext::layoutState() const
 {
     return m_formattingState.layoutState();

Modified: trunk/Source/WebCore/layout/FormattingContext.h (239902 => 239903)


--- trunk/Source/WebCore/layout/FormattingContext.h	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2019-01-12 21:28:15 UTC (rev 239903)
@@ -65,8 +65,8 @@
 protected:
     using LayoutQueue = Vector<const Box*>;
 
-    FormattingState& formattingState() const;
     LayoutState& layoutState() const;
+    FormattingState& formattingState() const { return m_formattingState; }
     const Box& root() const { return *m_root; }
 
     void computeBorderAndPadding(const Box&) const;

Modified: trunk/Source/WebCore/layout/LayoutState.cpp (239902 => 239903)


--- trunk/Source/WebCore/layout/LayoutState.cpp	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/LayoutState.cpp	2019-01-12 21:28:15 UTC (rev 239903)
@@ -153,12 +153,15 @@
 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();

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (239902 => 239903)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2019-01-12 21:28:15 UTC (rev 239903)
@@ -44,7 +44,7 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingContext);
 
-BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot, FormattingState& formattingState)
+BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot, BlockFormattingState& formattingState)
     : FormattingContext(formattingContextRoot, formattingState)
 {
 }

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (239902 => 239903)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2019-01-12 21:28:15 UTC (rev 239903)
@@ -47,13 +47,11 @@
 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 @@
     bool hasPrecomputedMarginBefore(const Box&) const;
 #endif
 
+    BlockFormattingState& formattingState() const { return downcast<BlockFormattingState>(FormattingContext::formattingState()); }
+
 private:
     mutable HashMap<const Box*, EstimatedMarginBefore> m_estimatedMarginBeforeList;
 };

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (239902 => 239903)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-01-12 21:28:15 UTC (rev 239903)
@@ -48,7 +48,7 @@
 
 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 @@
     // 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::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::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::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::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::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 @@
     if (auto instrinsicWidthConstraints = formattingStateForRoot.instrinsicWidthConstraints(root()))
         return *instrinsicWidthConstraints;
 
-    auto& inlineFormattingState = this->inlineFormattingState();
+    auto& inlineFormattingState = formattingState();
     InlineRunProvider inlineRunProvider;
     collectInlineContent(inlineRunProvider);
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (239902 => 239903)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2019-01-12 20:56:37 UTC (rev 239902)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2019-01-12 21:28:15 UTC (rev 239903)
@@ -43,7 +43,7 @@
 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 @@
     void collectInlineContentForSubtree(const Box& root, InlineRunProvider&) const;
     InstrinsicWidthConstraints instrinsicWidthConstraints() const override;
 
-    InlineFormattingState& inlineFormattingState() const { return downcast<InlineFormattingState>(formattingState()); }
+    InlineFormattingState& formattingState() const { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to