Diff
Modified: trunk/LayoutTests/ChangeLog (262791 => 262792)
--- trunk/LayoutTests/ChangeLog 2020-06-09 14:50:50 UTC (rev 262791)
+++ trunk/LayoutTests/ChangeLog 2020-06-09 15:17:01 UTC (rev 262792)
@@ -1,3 +1,13 @@
+2020-06-09 Zalan Bujtas <[email protected]>
+
+ [LFC][Table][Floats] Multi-pass table layout needs clean floating state
+ https://bugs.webkit.org/show_bug.cgi?id=212889
+
+ Reviewed by Antti Koivisto.
+
+ * fast/layoutformattingcontext/float-inside-table-cell-simple-expected.html: Added.
+ * fast/layoutformattingcontext/float-inside-table-cell-simple.html: Added.
+
2020-06-09 Takashi Komori <[email protected]>
[Curl] Implement functions to use ResourceLoadStatistics.
Added: trunk/LayoutTests/fast/layoutformattingcontext/float-inside-table-cell-simple-expected.html (0 => 262792)
--- trunk/LayoutTests/fast/layoutformattingcontext/float-inside-table-cell-simple-expected.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/float-inside-table-cell-simple-expected.html 2020-06-09 15:17:01 UTC (rev 262792)
@@ -0,0 +1,8 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+ position: absolute;
+}
+</style>
+<div style="left: 8px; top: 8px; width: 100px; height: 100px; background-color: green;"></div>
+<div style="left: 88px; top: 8px; width: 20px; height: 20px; background-color: blue;"></div>
Added: trunk/LayoutTests/fast/layoutformattingcontext/float-inside-table-cell-simple.html (0 => 262792)
--- trunk/LayoutTests/fast/layoutformattingcontext/float-inside-table-cell-simple.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/float-inside-table-cell-simple.html 2020-06-09 15:17:01 UTC (rev 262792)
@@ -0,0 +1,17 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+.table {
+ display: table;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+
+.float {
+ float: right;
+ width: 20px;
+ height: 20px;
+ background-color: blue;
+}
+</style>
+<div class=table><div class=float></div></div>
Modified: trunk/Source/WebCore/ChangeLog (262791 => 262792)
--- trunk/Source/WebCore/ChangeLog 2020-06-09 14:50:50 UTC (rev 262791)
+++ trunk/Source/WebCore/ChangeLog 2020-06-09 15:17:01 UTC (rev 262792)
@@ -1,3 +1,24 @@
+2020-06-09 Zalan Bujtas <[email protected]>
+
+ [LFC][Table][Floats] Multi-pass table layout needs clean floating state
+ https://bugs.webkit.org/show_bug.cgi?id=212889
+
+ Reviewed by Antti Koivisto.
+
+ When laying out the cell content multiple times to accommodate flex table layout,
+ the float state needs be cleared to avoid having redundant float content.
+
+ Test: fast/layoutformattingcontext/float-inside-table-cell-simple.html
+
+ * layout/floats/FloatingState.cpp:
+ (WebCore::Layout::FloatingState::append):
+ * layout/floats/FloatingState.h:
+ (WebCore::Layout::FloatingState::FloatItem::floatBox const):
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::TreeBuilder::createLayoutBox):
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::layoutCell):
+
2020-06-09 Takashi Komori <[email protected]>
[Curl] Implement functions to use ResourceLoadStatistics.
Modified: trunk/Source/WebCore/layout/floats/FloatingState.cpp (262791 => 262792)
--- trunk/Source/WebCore/layout/floats/FloatingState.cpp 2020-06-09 14:50:50 UTC (rev 262791)
+++ trunk/Source/WebCore/layout/floats/FloatingState.cpp 2020-06-09 15:17:01 UTC (rev 262792)
@@ -61,6 +61,14 @@
void FloatingState::append(FloatItem floatItem)
{
ASSERT(is<ContainerBox>(*m_formattingContextRoot));
+#if ASSERT_ENABLED
+ if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled()) {
+ // The integration codepath does not construct a layout box for the float item.
+ ASSERT(m_floats.findMatching([&] (auto& entry) {
+ return entry.floatBox() == floatItem.floatBox();
+ }) == notFound);
+ }
+#endif
if (m_floats.isEmpty())
return m_floats.append(floatItem);
Modified: trunk/Source/WebCore/layout/floats/FloatingState.h (262791 => 262792)
--- trunk/Source/WebCore/layout/floats/FloatingState.h 2020-06-09 14:50:50 UTC (rev 262791)
+++ trunk/Source/WebCore/layout/floats/FloatingState.h 2020-06-09 15:17:01 UTC (rev 262792)
@@ -62,6 +62,7 @@
public:
FloatItem(const Box&, Display::Box absoluteDisplayBox);
+ // FIXME: This c'tor is only used by the render tree integation codepath.
enum class Position { Left, Right };
FloatItem(Position, Display::Box absoluteDisplayBox);
@@ -72,6 +73,9 @@
UsedHorizontalMargin horizontalMargin() const { return m_absoluteDisplayBox.horizontalMargin(); }
PositionInContextRoot bottom() const { return { m_absoluteDisplayBox.bottom() }; }
+#if ASSERT_ENABLED
+ const Box* floatBox() const { return m_layoutBox.get(); }
+#endif
private:
WeakPtr<const Box> m_layoutBox;
Position m_position;
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (262791 => 262792)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-06-09 14:50:50 UTC (rev 262791)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-06-09 15:17:01 UTC (rev 262792)
@@ -278,14 +278,17 @@
}
if (is<RenderTableCell>(renderer)) {
- auto& cellElement = downcast<HTMLTableCellElement>(*renderer.element());
- auto rowSpan = cellElement.rowSpan();
- if (rowSpan > 1)
- childLayoutBox->setRowSpan(rowSpan);
+ auto* tableCellElement = renderer.element();
+ if (is<HTMLTableCellElement>(tableCellElement)) {
+ auto& cellElement = downcast<HTMLTableCellElement>(*tableCellElement);
+ auto rowSpan = cellElement.rowSpan();
+ if (rowSpan > 1)
+ childLayoutBox->setRowSpan(rowSpan);
- auto columnSpan = cellElement.colSpan();
- if (columnSpan > 1)
- childLayoutBox->setColumnSpan(columnSpan);
+ auto columnSpan = cellElement.colSpan();
+ if (columnSpan > 1)
+ childLayoutBox->setColumnSpan(columnSpan);
+ }
}
if (childRenderer.isAnonymous())
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (262791 => 262792)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-06-09 14:50:50 UTC (rev 262791)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-06-09 15:17:01 UTC (rev 262792)
@@ -28,7 +28,9 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "BlockFormattingState.h"
#include "DisplayBox.h"
+#include "FloatingState.h"
#include "InvalidationState.h"
#include "LayoutBox.h"
#include "LayoutChildIterator.h"
@@ -259,9 +261,13 @@
cellDisplayBox.setContentBoxWidth(availableSpaceForContent);
if (cellBox.hasInFlowOrFloatingChild()) {
- auto invalidationState = InvalidationState { };
auto constraintsForCellContent = geometry().constraintsForInFlowContent(cellBox);
constraintsForCellContent.vertical.logicalHeight = usedCellHeight;
+ auto invalidationState = InvalidationState { };
+ // FIXME: This should probably be part of the invalidation state to indicate when we re-layout the cell
+ // multiple times as part of the multi-pass table algorithm.
+ auto& floatingStateForCellContent = layoutState().ensureBlockFormattingState(cellBox).floatingState();
+ floatingStateForCellContent.clear();
LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(invalidationState, constraintsForCellContent);
}
cellDisplayBox.setContentBoxHeight(geometry().cellHeigh(cellBox));