[LFC][TFC] Table formatting context accesses geometry information from parent BFC
https://bugs.webkit.org/show_bug.cgi?id=203082
<rdar://problem/56370827>
Reviewed by Antti Koivisto.
Tables are wrapped in a 2 level formatting context structure. A <table> element initiates a block formatting context for its principal table box
where the caption and the table content live. It also initiates a table wrapper box which establishes the table formatting context.
In many cases the TFC needs access to the parent (generated) BFC.
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::geometryForBox const):
* layout/FormattingContext.h:
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::computedTableWidth):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5fcff80..11e93bf 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,23 @@
2019-10-17 Zalan Bujtas <zalan@apple.com>
+ [LFC][TFC] Table formatting context accesses geometry information from parent BFC
+ https://bugs.webkit.org/show_bug.cgi?id=203082
+ <rdar://problem/56370827>
+
+ Reviewed by Antti Koivisto.
+
+ Tables are wrapped in a 2 level formatting context structure. A <table> element initiates a block formatting context for its principal table box
+ where the caption and the table content live. It also initiates a table wrapper box which establishes the table formatting context.
+ In many cases the TFC needs access to the parent (generated) BFC.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::geometryForBox const):
+ * layout/FormattingContext.h:
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::computedTableWidth):
+
+2019-10-17 Zalan Bujtas <zalan@apple.com>
+
[LFC][Painting] Add support for image/background image painting
https://bugs.webkit.org/show_bug.cgi?id=203054
<rdar://problem/56347733>
diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp
index 1351bcb..46fbe94 100644
--- a/Source/WebCore/layout/FormattingContext.cpp
+++ b/Source/WebCore/layout/FormattingContext.cpp
@@ -252,8 +252,15 @@
return false;
ancestorFormattingContextRoot = &ancestorFormattingContextRoot->formattingContextRoot();
}
-
}
+
+ // 7. Tables are wrapped in a 2 level formatting context structure. A <table> element initiates a block formatting context for its principal table box
+ // where the caption and the table content live. It also initiates a table wrapper box which establishes the table formatting context.
+ // In many cases the TFC needs access to the parent (generated) BFC.
+ if (*escapeType == EscapeType::TableFormattingContextAccessParentTableWrapperBlockFormattingContext
+ && (&layoutBox == &root().formattingContextRoot() || &layoutBox.formattingContextRoot() == &root().formattingContextRoot()))
+ return true;
+
return false;
};
#endif
diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h
index eb824e3..0ffac77 100644
--- a/Source/WebCore/layout/FormattingContext.h
+++ b/Source/WebCore/layout/FormattingContext.h
@@ -86,7 +86,8 @@
enum class EscapeType {
AccessChildFormattingContext,
AccessParentFormattingContext,
- AccessAncestorFormattingContext
+ AccessAncestorFormattingContext,
+ TableFormattingContextAccessParentTableWrapperBlockFormattingContext
};
const Display::Box& geometryForBox(const Box&, Optional<EscapeType> = WTF::nullopt) const;
diff --git a/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp b/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
index 5a66389..a1c8b3f 100644
--- a/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
+++ b/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
@@ -274,7 +274,7 @@
auto& tableWrapperBox = root();
auto& style = tableWrapperBox.style();
auto& containingBlock = *tableWrapperBox.containingBlock();
- auto containingBlockWidth = geometryForBox(containingBlock).contentBoxWidth();
+ auto containingBlockWidth = geometryForBox(containingBlock, EscapeType::TableFormattingContextAccessParentTableWrapperBlockFormattingContext).contentBoxWidth();
auto& grid = formattingState().tableGrid();
auto& columnsContext = grid.columnsContext();