Title: [267343] trunk/Source/WebCore
- Revision
- 267343
- Author
- za...@apple.com
- Date
- 2020-09-21 06:49:07 -0700 (Mon, 21 Sep 2020)
Log Message
[LFC][BFC] Move hasClearance out of BoxGeometry
https://bugs.webkit.org/show_bug.cgi?id=216757
Reviewed by Antti Koivisto.
Do not cache the hasClearance state in BoxGeometry.
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear):
(WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
* layout/blockformatting/BlockFormattingState.h:
(WebCore::Layout::BlockFormattingState::setHasClearance):
(WebCore::Layout::BlockFormattingState::clearClearance):
(WebCore::Layout::BlockFormattingState::hasClearance const):
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::hasClearance const):
* layout/layouttree/LayoutBoxGeometry.cpp:
(WebCore::Layout::BoxGeometry::BoxGeometry):
* layout/layouttree/LayoutBoxGeometry.h:
(WebCore::Layout::BoxGeometry::hasClearance const): Deleted.
(WebCore::Layout::BoxGeometry::setHasClearance): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (267342 => 267343)
--- trunk/Source/WebCore/ChangeLog 2020-09-21 13:34:34 UTC (rev 267342)
+++ trunk/Source/WebCore/ChangeLog 2020-09-21 13:49:07 UTC (rev 267343)
@@ -1,5 +1,29 @@
2020-09-21 Zalan Bujtas <za...@apple.com>
+ [LFC][BFC] Move hasClearance out of BoxGeometry
+ https://bugs.webkit.org/show_bug.cgi?id=216757
+
+ Reviewed by Antti Koivisto.
+
+ Do not cache the hasClearance state in BoxGeometry.
+
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear):
+ (WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
+ * layout/blockformatting/BlockFormattingState.h:
+ (WebCore::Layout::BlockFormattingState::setHasClearance):
+ (WebCore::Layout::BlockFormattingState::clearClearance):
+ (WebCore::Layout::BlockFormattingState::hasClearance const):
+ * layout/blockformatting/BlockMarginCollapse.cpp:
+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::hasClearance const):
+ * layout/layouttree/LayoutBoxGeometry.cpp:
+ (WebCore::Layout::BoxGeometry::BoxGeometry):
+ * layout/layouttree/LayoutBoxGeometry.h:
+ (WebCore::Layout::BoxGeometry::hasClearance const): Deleted.
+ (WebCore::Layout::BoxGeometry::setHasClearance): Deleted.
+
+2020-09-21 Zalan Bujtas <za...@apple.com>
+
[LFC] Remove unused EscapeReason::StrokeOverflowNeedsViewportGeometry
https://bugs.webkit.org/show_bug.cgi?id=216759
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (267342 => 267343)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2020-09-21 13:34:34 UTC (rev 267342)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2020-09-21 13:49:07 UTC (rev 267343)
@@ -313,7 +313,7 @@
ASSERT(*verticalPositionAndClearance.position >= boxGeometry.logicalTop());
boxGeometry.setLogicalTop(*verticalPositionAndClearance.position);
if (verticalPositionAndClearance.clearance)
- boxGeometry.setHasClearance();
+ formattingState().setHasClearance(layoutBox);
// FIXME: Reset the margin values on the ancestors/previous siblings now that the float avoider with clearance does not margin collapse anymore.
}
@@ -477,7 +477,7 @@
// 3. Check if the previous box's margins collapse through. If not -> return previous box' bottom excluding margin after + marginBefore (they are supposed to be equal)
// 4. Go to previous box and start from step #1 until we hit the parent box.
auto& boxGeometry = geometryForBox(layoutBox);
- if (boxGeometry.hasClearance())
+ if (formattingState().hasClearance(layoutBox))
return boxGeometry.logicalTop();
auto* currentLayoutBox = &layoutBox;
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingState.h (267342 => 267343)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingState.h 2020-09-21 13:34:34 UTC (rev 267342)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingState.h 2020-09-21 13:49:07 UTC (rev 267343)
@@ -29,6 +29,7 @@
#include "FormattingState.h"
#include <wtf/IsoMalloc.h>
+#include <wtf/WeakHashSet.h>
namespace WebCore {
namespace Layout {
@@ -44,8 +45,13 @@
UsedVerticalMargin usedVerticalMargin(const Box& layoutBox) const { return m_usedVerticalMargins.get(&layoutBox); }
bool hasUsedVerticalMargin(const Box& layoutBox) const { return m_usedVerticalMargins.contains(&layoutBox); }
+ void setHasClearance(const Box& layoutBox) { m_clearanceSet.add(layoutBox); }
+ void clearHasClearance(const Box& layoutBox) { m_clearanceSet.remove(layoutBox); }
+ bool hasClearance(const Box& layoutBox) const { return m_clearanceSet.contains(layoutBox); }
+
private:
HashMap<const Box*, UsedVerticalMargin> m_usedVerticalMargins;
+ WeakHashSet<const Box> m_clearanceSet;
};
}
Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (267342 => 267343)
--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2020-09-21 13:34:34 UTC (rev 267342)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2020-09-21 13:49:07 UTC (rev 267343)
@@ -87,9 +87,7 @@
return false;
// FIXME: precomputedVerticalPositionForFormattingRoot logic ends up calling into this function when the layoutBox (first inflow child) has
// not been laid out.
- if (!layoutState().hasBoxGeometry(layoutBox))
- return false;
- return formattingContext().geometryForBox(layoutBox).hasClearance();
+ return formattingContext().formattingState().hasClearance(layoutBox);
}
bool BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(const Box& layoutBox) const
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp (267342 => 267343)
--- trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp 2020-09-21 13:34:34 UTC (rev 267342)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp 2020-09-21 13:49:07 UTC (rev 267343)
@@ -41,7 +41,6 @@
, m_contentHeight(other.m_contentHeight)
, m_horizontalMargin(other.m_horizontalMargin)
, m_verticalMargin(other.m_verticalMargin)
- , m_hasClearance(other.m_hasClearance)
, m_border(other.m_border)
, m_padding(other.m_padding)
#if ASSERT_ENABLED
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h (267342 => 267343)
--- trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h 2020-09-21 13:34:34 UTC (rev 267342)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h 2020-09-21 13:49:07 UTC (rev 267343)
@@ -71,7 +71,6 @@
LayoutUnit marginStart() const;
LayoutUnit marginAfter() const;
LayoutUnit marginEnd() const;
- bool hasClearance() const { return m_hasClearance; }
LayoutUnit borderTop() const;
LayoutUnit borderLeft() const;
@@ -131,7 +130,6 @@
void setHorizontalMargin(HorizontalMargin);
void setVerticalMargin(VerticalMargin);
- void setHasClearance() { m_hasClearance = true; }
void setBorder(Layout::Edges);
@@ -163,7 +161,6 @@
HorizontalMargin m_horizontalMargin;
VerticalMargin m_verticalMargin;
- bool m_hasClearance { false };
Layout::Edges m_border;
Optional<Layout::Edges> m_padding;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes