Title: [263940] trunk/Source/WebCore
Revision
263940
Author
[email protected]
Date
2020-07-04 12:17:30 -0700 (Sat, 04 Jul 2020)

Log Message

[LFC] Remove redundant Display::Box::HorizontalMargin c'tors
https://bugs.webkit.org/show_bug.cgi?id=213957

Reviewed by Antti Koivisto.

Let's just have a very simple Display::Box:HorizontalMargin struct.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
* layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::HorizontalMargin::HorizontalMargin): Deleted.
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263939 => 263940)


--- trunk/Source/WebCore/ChangeLog	2020-07-04 18:56:39 UTC (rev 263939)
+++ trunk/Source/WebCore/ChangeLog	2020-07-04 19:17:30 UTC (rev 263940)
@@ -1,5 +1,25 @@
 2020-07-04  Zalan Bujtas  <[email protected]>
 
+        [LFC] Remove redundant Display::Box::HorizontalMargin c'tors
+        https://bugs.webkit.org/show_bug.cgi?id=213957
+
+        Reviewed by Antti Koivisto.
+
+        Let's just have a very simple Display::Box:HorizontalMargin struct.
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
+        * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
+        (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
+        * layout/displaytree/DisplayBox.h:
+        (WebCore::Display::Box::HorizontalMargin::HorizontalMargin): Deleted.
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
+
+2020-07-04  Zalan Bujtas  <[email protected]>
+
         [LFC] Do not cache computed horizontal margin values
         https://bugs.webkit.org/show_bug.cgi?id=213956
 

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (263939 => 263940)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2020-07-04 18:56:39 UTC (rev 263939)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2020-07-04 19:17:30 UTC (rev 263940)
@@ -93,7 +93,8 @@
     auto& displayBox = formattingState().displayBox(layoutBox);
     displayBox.setLeft(horizontalGeometry.left + horizontalGeometry.contentWidthAndMargin.usedMargin.start);
     displayBox.setContentBoxWidth(horizontalGeometry.contentWidthAndMargin.contentWidth);
-    displayBox.setHorizontalMargin({ horizontalGeometry.contentWidthAndMargin.usedMargin });
+    auto& usedHorizontalMargin = horizontalGeometry.contentWidthAndMargin.usedMargin;
+    displayBox.setHorizontalMargin({ usedHorizontalMargin.start, usedHorizontalMargin.end });
 }
 
 void FormattingContext::computeOutOfFlowVerticalGeometry(const Box& layoutBox, const ConstraintsForOutOfFlowContent& constraints)

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (263939 => 263940)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-07-04 18:56:39 UTC (rev 263939)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-07-04 19:17:30 UTC (rev 263940)
@@ -326,7 +326,7 @@
     auto contentWidthAndMargin = geometry().computedWidthAndMargin(layoutBox, constraintsPair.containingBlock.horizontal, availableWidthFloatAvoider);
     auto& displayBox = formattingState().displayBox(layoutBox);
     displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth);
-    displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin });
+    displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end });
 }
 
 void BlockFormattingContext::computeHeightAndMargin(const Box& layoutBox, const ConstraintsForInFlowContent& constraints)

Modified: trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp (263939 => 263940)


--- trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp	2020-07-04 18:56:39 UTC (rev 263939)
+++ trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp	2020-07-04 19:17:30 UTC (rev 263940)
@@ -209,7 +209,7 @@
 
     auto& displayBox = formattingState().displayBox(tableBox);
     displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth);
-    displayBox.setHorizontalMargin(contentWidthAndMargin.usedMargin);
+    displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end });
 }
 
 void TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox(const ContainerBox& tableBox, const ConstraintsForInFlowContent& constraints)

Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (263939 => 263940)


--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2020-07-04 18:56:39 UTC (rev 263939)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2020-07-04 19:17:30 UTC (rev 263940)
@@ -56,6 +56,10 @@
     Rect rect() const { return { top(), left(), width(), height() }; }
     Rect rectWithMargin() const;
 
+    struct HorizontalMargin {
+        LayoutUnit start;
+        LayoutUnit end;
+    };
     struct VerticalMargin {
         LayoutUnit before() const { return m_collapsedValues.before.valueOr(m_nonCollapsedValues.before); }
         LayoutUnit after() const { return m_collapsedValues.after.valueOr(m_nonCollapsedValues.after); }
@@ -91,15 +95,6 @@
         NonCollapsedValues m_nonCollapsedValues;
         CollapsedValues m_collapsedValues;
     };
-
-    struct HorizontalMargin {
-        HorizontalMargin() = default;
-        HorizontalMargin(Layout::UsedHorizontalMargin);
-        HorizontalMargin(LayoutUnit, LayoutUnit);
-
-        LayoutUnit start;
-        LayoutUnit end;
-    };
     VerticalMargin verticalMargin() const;
     HorizontalMargin horizontalMargin() const;
     LayoutUnit marginBefore() const;
@@ -254,18 +249,6 @@
 {
 }
 
-inline Box::HorizontalMargin::HorizontalMargin(Layout::UsedHorizontalMargin horizontalMargin)
-    : start(horizontalMargin.start)
-    , end(horizontalMargin.end)
-{
-}
-
-inline Box::HorizontalMargin::HorizontalMargin(LayoutUnit start, LayoutUnit end)
-    : start(start)
-    , end(end)
-{
-}
-
 #if ASSERT_ENABLED
 inline void Box::invalidateMargin()
 {

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (263939 => 263940)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-07-04 18:56:39 UTC (rev 263939)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-07-04 19:17:30 UTC (rev 263940)
@@ -313,7 +313,7 @@
 
     auto& displayBox = formattingState().displayBox(layoutBox);
     displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth);
-    displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin });
+    displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end });
 }
 
 void InlineFormattingContext::computeHeightAndMargin(const Box& layoutBox, const HorizontalConstraints& horizontalConstraints)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to