Title: [231952] trunk/Source/WebCore
Revision
231952
Author
[email protected]
Date
2018-05-18 07:30:44 -0700 (Fri, 18 May 2018)

Log Message

[LFC] Implement width computation for non-replaced floating elements.
https://bugs.webkit.org/show_bug.cgi?id=185759

Reviewed by Antti Koivisto.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeFloatingWidth const):
(WebCore::Layout::FormattingContext::computeFloatingNonReplacedWidth const):
* layout/FormattingContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (231951 => 231952)


--- trunk/Source/WebCore/ChangeLog	2018-05-18 14:15:04 UTC (rev 231951)
+++ trunk/Source/WebCore/ChangeLog	2018-05-18 14:30:44 UTC (rev 231952)
@@ -1,3 +1,15 @@
+2018-05-18  Zalan Bujtas  <[email protected]>
+
+        [LFC] Implement width computation for non-replaced floating elements.
+        https://bugs.webkit.org/show_bug.cgi?id=185759
+
+        Reviewed by Antti Koivisto.
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::computeFloatingWidth const):
+        (WebCore::Layout::FormattingContext::computeFloatingNonReplacedWidth const):
+        * layout/FormattingContext.h:
+
 2018-05-18  Antoine Quint  <[email protected]>
 
         [modern-media-controls] AirPlaySupport should be disabled by default

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (231951 => 231952)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2018-05-18 14:15:04 UTC (rev 231951)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2018-05-18 14:30:44 UTC (rev 231952)
@@ -90,7 +90,7 @@
 void FormattingContext::computeFloatingWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
 {
     if (!layoutBox.replaced()) {
-        ASSERT_NOT_IMPLEMENTED_YET();
+        computeFloatingNonReplacedWidth(layoutContext, layoutBox, displayBox);
         return;
     }
     computeReplacedWidth(layoutContext, layoutBox, displayBox);
@@ -295,6 +295,16 @@
     return bottom - top;
 }
 
+void FormattingContext::computeFloatingNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
+{
+    ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
+    // 10.3.5 Floating, non-replaced elements
+
+    // If 'width' is computed as 'auto', the used value is the "shrink-to-fit" width.
+    auto width = layoutBox.style().logicalWidth();
+    displayBox.setWidth(width.isAuto() ? shrinkToFitWidth(layoutContext, layoutBox) : LayoutUnit(width.value()));
+}
+
 void FormattingContext::computeOutOfFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());

Modified: trunk/Source/WebCore/layout/FormattingContext.h (231951 => 231952)


--- trunk/Source/WebCore/layout/FormattingContext.h	2018-05-18 14:15:04 UTC (rev 231951)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2018-05-18 14:30:44 UTC (rev 231952)
@@ -94,6 +94,8 @@
     void computeOutOfFlowNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
     void computeOutOfFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
 
+    void computeFloatingNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
+
     LayoutUnit contentHeightForFormattingContextRoot(LayoutContext&, const Box&) const;
     LayoutUnit shrinkToFitWidth(LayoutContext&, const Box&) const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to