Title: [252638] trunk/Source/WebCore
Revision
252638
Author
[email protected]
Date
2019-11-19 10:58:04 -0800 (Tue, 19 Nov 2019)

Log Message

[LFC][IFC] Assign inlineCapacity to various inline run vectors.
https://bugs.webkit.org/show_bug.cgi?id=204354
<rdar://problem/57322347>

Reviewed by Antti Koivisto.

Inline capacity values are mainly based off of the equivalent simple line layout vectors.

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
* layout/inlineformatting/InlineFormattingState.h:
* layout/inlineformatting/InlineLine.h:
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateRendererStyle): Apparently 'newStyle' is moved out at this point.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252637 => 252638)


--- trunk/Source/WebCore/ChangeLog	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/ChangeLog	2019-11-19 18:58:04 UTC (rev 252638)
@@ -1,3 +1,20 @@
+2019-11-19  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Assign inlineCapacity to various inline run vectors.
+        https://bugs.webkit.org/show_bug.cgi?id=204354
+        <rdar://problem/57322347>
+
+        Reviewed by Antti Koivisto.
+
+        Inline capacity values are mainly based off of the equivalent simple line layout vectors.
+
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
+        * layout/inlineformatting/InlineFormattingState.h:
+        * layout/inlineformatting/InlineLine.h:
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::updateRendererStyle): Apparently 'newStyle' is moved out at this point.
+
 2019-11-19  Sihui Liu  <[email protected]>
 
         Update expectations for bufferedAmount-unchanged-by-sync-xhr.any.worker.html

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h (252637 => 252638)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2019-11-19 18:58:04 UTC (rev 252638)
@@ -38,9 +38,9 @@
 namespace Layout {
 
 // Temp
-using InlineItems = Vector<std::unique_ptr<InlineItem>>;
-using InlineRuns = Vector<std::unique_ptr<Display::Run>>;
-using LineBoxes = Vector<std::unique_ptr<LineBox>>;
+using InlineItems = Vector<std::unique_ptr<InlineItem>, 30>;
+using InlineRuns = Vector<std::unique_ptr<Display::Run>, 10>;
+using LineBoxes = Vector<std::unique_ptr<LineBox>, 5>;
 // InlineFormattingState holds the state for a particular inline formatting context tree.
 class InlineFormattingState : public FormattingState {
     WTF_MAKE_ISO_ALLOCATED(InlineFormattingState);

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (252637 => 252638)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp	2019-11-19 18:58:04 UTC (rev 252638)
@@ -86,7 +86,7 @@
 }
 
 Line::Run::Run(const Box& layoutBox, InlineItem::Type type, const Display::Rect& logicalRect)
-    : m_layoutBox(layoutBox)
+    : m_layoutBox(&layoutBox)
     , m_type(type)
     , m_logicalRect(logicalRect)
 {

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.h (252637 => 252638)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.h	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.h	2019-11-19 18:58:04 UTC (rev 252638)
@@ -68,6 +68,9 @@
     void moveLogicalRight(LayoutUnit);
 
     struct Run {
+        Run(Run&&) = default;
+        Run& operator=(Run&& other) = default;
+
         bool isText() const { return m_type == InlineItem::Type::Text; }
         bool isBox() const { return m_type == InlineItem::Type::Box; }
         bool isForcedLineBreak() const { return m_type == InlineItem::Type::ForcedLineBreak; }
@@ -74,7 +77,7 @@
         bool isContainerStart() const { return m_type == InlineItem::Type::ContainerStart; }
         bool isContainerEnd() const { return m_type == InlineItem::Type::ContainerEnd; }
 
-        const Box& layoutBox() const { return m_layoutBox; }
+        const Box& layoutBox() const { return *m_layoutBox; }
         const Display::Rect& logicalRect() const { return m_logicalRect; }
         Optional<Display::Run::TextContext> textContext() const { return m_textContext; }
         bool isCollapsedToVisuallyEmpty() const { return m_isCollapsedToVisuallyEmpty; }
@@ -98,14 +101,14 @@
         void setComputedHorizontalExpansion(LayoutUnit logicalExpansion);
         void adjustExpansionBehavior(ExpansionBehavior);
 
-        const Box& m_layoutBox;
-        const InlineItem::Type m_type;
+        const Box* m_layoutBox { nullptr };
+        InlineItem::Type m_type;
         Display::Rect m_logicalRect;
         Optional<Display::Run::TextContext> m_textContext;
         unsigned m_expansionOpportunityCount { 0 };
         bool m_isCollapsedToVisuallyEmpty { false };
     };
-    using RunList = Vector<Run>;
+    using RunList = Vector<Run, 50>;
     enum class IsLastLineWithInlineContent { No, Yes };
     RunList close(IsLastLineWithInlineContent = IsLastLineWithInlineContent::No);
 
@@ -148,8 +151,8 @@
     const InlineFormattingContext& formattingContext() const; 
 
     const InlineFormattingContext& m_inlineFormattingContext;
-    Vector<std::unique_ptr<InlineItemRun>> m_inlineItemRuns;
-    Vector<InlineItemRun*> m_trimmableRuns;
+    Vector<std::unique_ptr<InlineItemRun>, 50> m_inlineItemRuns;
+    Vector<InlineItemRun*, 5> m_trimmableRuns;
     Optional<LineBox::Baseline> m_initialStrut;
     LayoutUnit m_lineLogicalWidth;
     Optional<TextAlignMode> m_horizontalAlignment;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (252637 => 252638)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2019-11-19 18:58:04 UTC (rev 252638)
@@ -47,7 +47,7 @@
     return trailingInlineItem.style().whiteSpace() == WhiteSpace::PreWrap && downcast<InlineTextItem>(trailingInlineItem).isWhitespace();
 }
 
-LineBreaker::BreakingContext LineBreaker::breakingContextForInlineContent(const Vector<LineLayout::Run>& runs, LayoutUnit logicalWidth, LayoutUnit availableWidth, bool lineIsEmpty)
+LineBreaker::BreakingContext LineBreaker::breakingContextForInlineContent(const LineLayout::RunList& runs, LayoutUnit logicalWidth, LayoutUnit availableWidth, bool lineIsEmpty)
 {
     if (logicalWidth <= availableWidth)
         return { BreakingContext::ContentBreak::Keep, { } };
@@ -87,7 +87,7 @@
     return !lineIsEmpty && floatLogicalWidth > availableWidth;
 }
 
-Optional<LineBreaker::BreakingContext::TrailingPartialContent> LineBreaker::wordBreakingBehavior(const Vector<LineLayout::Run>& runs, LayoutUnit availableWidth) const
+Optional<LineBreaker::BreakingContext::TrailingPartialContent> LineBreaker::wordBreakingBehavior(const LineLayout::RunList& runs, LayoutUnit availableWidth) const
 {
     // Check where the overflow occurs and use the corresponding style to figure out the breaking behaviour.
     // <span style="word-break: normal">first</span><span style="word-break: break-all">second</span><span style="word-break: normal">third</span>

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h (252637 => 252638)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h	2019-11-19 18:58:04 UTC (rev 252638)
@@ -48,12 +48,12 @@
         };
         Optional<TrailingPartialContent> trailingPartialContent;
     };
-    BreakingContext breakingContextForInlineContent(const Vector<LineLayout::Run>&, LayoutUnit logicalWidth, LayoutUnit availableWidth, bool lineIsEmpty);
+    BreakingContext breakingContextForInlineContent(const LineLayout::RunList&, LayoutUnit logicalWidth, LayoutUnit availableWidth, bool lineIsEmpty);
     bool shouldWrapFloatBox(LayoutUnit floatLogicalWidth, LayoutUnit availableWidth, bool lineIsEmpty);
 
 private:
 
-    Optional<BreakingContext::TrailingPartialContent> wordBreakingBehavior(const Vector<LineLayout::Run>&, LayoutUnit availableWidth) const;
+    Optional<BreakingContext::TrailingPartialContent> wordBreakingBehavior(const LineLayout::RunList&, LayoutUnit availableWidth) const;
 
     struct SplitLengthAndWidth {
         unsigned length { 0 };

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineLayout.h (252637 => 252638)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineLayout.h	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineLayout.h	2019-11-19 18:58:04 UTC (rev 252638)
@@ -69,6 +69,8 @@
         LayoutUnit logicalWidth;
     };
 
+    using RunList = Vector<Run, 30>;
+
 private:
     const InlineFormattingContext& formattingContext() const { return m_inlineFormattingContext; }
     enum class IsEndOfLine { No, Yes };
@@ -83,14 +85,14 @@
         void reset();
         void trim(unsigned newSize);
 
-        Vector<Run>& runs() { return m_uncommittedRuns; }
-        const Vector<Run>& runs() const { return m_uncommittedRuns; }
+        RunList& runs() { return m_uncommittedRuns; }
+        const RunList& runs() const { return m_uncommittedRuns; }
         bool isEmpty() const { return m_uncommittedRuns.isEmpty(); }
         unsigned size() const { return m_uncommittedRuns.size(); }
         LayoutUnit width() const { return m_width; }
 
     private:
-        Vector<Run> m_uncommittedRuns;
+        RunList m_uncommittedRuns;
         LayoutUnit m_width;
     };
 

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (252637 => 252638)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2019-11-19 18:41:31 UTC (rev 252637)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2019-11-19 18:58:04 UTC (rev 252638)
@@ -300,7 +300,7 @@
         if (!m_document.view() || !m_document.view()->layoutContext().layoutFormattingState())
             return;
         if (auto* layoutBox = m_document.view()->layoutContext().layoutTreeContent()->layoutBoxForRenderer(renderer))
-            layoutBox->updateStyle(newStyle);
+            layoutBox->updateStyle(renderer.style());
     }
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to