Modified: trunk/Source/WebCore/ChangeLog (231957 => 231958)
--- trunk/Source/WebCore/ChangeLog 2018-05-18 16:15:50 UTC (rev 231957)
+++ trunk/Source/WebCore/ChangeLog 2018-05-18 16:32:14 UTC (rev 231958)
@@ -1,3 +1,16 @@
+2018-05-18 Zalan Bujtas <[email protected]>
+
+ [LFC] Implement height computation for non-replaced floating elements.
+ https://bugs.webkit.org/show_bug.cgi?id=185767
+
+ Reviewed by Antti Koivisto.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::computeFloatingHeight const):
+ (WebCore::Layout::FormattingContext::computeFloatingNonReplacedHeight const):
+ (WebCore::Layout::FormattingContext::contentHeightForFormattingContextRoot const):
+ * layout/FormattingContext.h:
+
2018-05-18 Dirk Schulze <[email protected]>
Make all SVG shape interfaces inherit from SVGGeometryElement
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (231957 => 231958)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2018-05-18 16:15:50 UTC (rev 231957)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2018-05-18 16:32:14 UTC (rev 231958)
@@ -108,7 +108,7 @@
void FormattingContext::computeFloatingHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
{
if (!layoutBox.replaced()) {
- ASSERT_NOT_IMPLEMENTED_YET();
+ computeFloatingNonReplacedHeight(layoutContext, layoutBox, displayBox);
return;
}
computeReplacedHeight(layoutContext, layoutBox, displayBox);
@@ -217,6 +217,18 @@
displayBox.setHeight(computedHeightValue);
}
+void FormattingContext::computeFloatingNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
+{
+ ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
+ // 10.6.6 Complicated cases
+ //
+ // Floating, non-replaced elements.
+ //
+ // If 'height' is 'auto', the height depends on the element's descendants per 10.6.7.
+ auto height = layoutBox.style().logicalHeight();
+ displayBox.setHeight(height.isAuto() ? contentHeightForFormattingContextRoot(layoutContext, layoutBox) : LayoutUnit(height.value()));
+}
+
void FormattingContext::computeReplacedHeight(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const
{
ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
@@ -317,12 +329,7 @@
LayoutUnit FormattingContext::contentHeightForFormattingContextRoot(LayoutContext& layoutContext, const Box& layoutBox) const
{
- ASSERT(layoutBox.style().logicalHeight().isAuto());
-
- if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
- return 0;
-
- auto& formattingRootContainer = downcast<Container>(layoutBox);
+ ASSERT(layoutBox.style().logicalHeight().isAuto() && layoutBox.establishesFormattingContext());
// 10.6.7 'Auto' heights for block formatting context roots
// If it only has inline-level children, the height is the distance between the top of the topmost line box and the bottom of the bottommost line box.
@@ -332,6 +339,10 @@
// In addition, if the element has any floating descendants whose bottom margin edge is below the element's bottom content edge,
// then the height is increased to include those edges. Only floats that participate in this block formatting context are taken
// into account, e.g., floats inside absolutely positioned descendants or other floats are not.
+ if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
+ return 0;
+
+ auto& formattingRootContainer = downcast<Container>(layoutBox);
if (formattingRootContainer.establishesInlineFormattingContext())
return 0;
Modified: trunk/Source/WebCore/layout/FormattingContext.h (231957 => 231958)
--- trunk/Source/WebCore/layout/FormattingContext.h 2018-05-18 16:15:50 UTC (rev 231957)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2018-05-18 16:32:14 UTC (rev 231958)
@@ -96,6 +96,7 @@
void computeOutOfFlowReplacedHeight(LayoutContext&, const Box&, Display::Box&) const;
void computeOutOfFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
+ void computeFloatingNonReplacedHeight(LayoutContext&, const Box&, Display::Box&) const;
void computeFloatingNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
LayoutUnit contentHeightForFormattingContextRoot(LayoutContext&, const Box&) const;