[LFC][BFC] Add support for block replaced intrinsic width.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 12:56:11 +0000 (12:56 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 12:56:11 +0000 (12:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194705

Reviewed by Simon Fraser.

Source/WebCore:

Replaced boxes should report their intrinsic width as preferred widths.

Test: fast/block/block-only/replaced-intrinsic-width-simple.html

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/block-only/replaced-intrinsic-width-simple-expected.html: Added.
* fast/block/block-only/replaced-intrinsic-width-simple.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241647 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/block/block-only/replaced-intrinsic-width-simple-expected.html [new file with mode: 0644]
LayoutTests/fast/block/block-only/replaced-intrinsic-width-simple.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt

index d2862ea..f6b3b6a 100644 (file)
@@ -1,5 +1,15 @@
 2019-02-16  Zalan Bujtas  <zalan@apple.com>
 
 2019-02-16  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][BFC] Add support for block replaced intrinsic width.
+        https://bugs.webkit.org/show_bug.cgi?id=194705
+
+        Reviewed by Simon Fraser.
+
+        * fast/block/block-only/replaced-intrinsic-width-simple-expected.html: Added.
+        * fast/block/block-only/replaced-intrinsic-width-simple.html: Added.
+
+2019-02-16  Zalan Bujtas  <zalan@apple.com>
+
         [LFC] Apply min/max width constraints to preferred width computation
         https://bugs.webkit.org/show_bug.cgi?id=194739
 
         [LFC] Apply min/max width constraints to preferred width computation
         https://bugs.webkit.org/show_bug.cgi?id=194739
 
diff --git a/LayoutTests/fast/block/block-only/replaced-intrinsic-width-simple-expected.html b/LayoutTests/fast/block/block-only/replaced-intrinsic-width-simple-expected.html
new file mode 100644 (file)
index 0000000..ce8a25d
--- /dev/null
@@ -0,0 +1,6 @@
+<style>
+img {
+    display: block;
+}
+</style>
+<img src="../resources/50x50.gif">
\ No newline at end of file
diff --git a/LayoutTests/fast/block/block-only/replaced-intrinsic-width-simple.html b/LayoutTests/fast/block/block-only/replaced-intrinsic-width-simple.html
new file mode 100644 (file)
index 0000000..fd11d54
--- /dev/null
@@ -0,0 +1,12 @@
+<style>
+div {
+       float: left;
+       width: auto;
+       height: auto;
+       background-color: green;
+}
+img {
+    display: block;
+}
+</style>
+<div><img src="../resources/50x50.gif"></div>
\ No newline at end of file
index c045164..f9678c3 100644 (file)
@@ -1,5 +1,19 @@
 2019-02-16  Zalan Bujtas  <zalan@apple.com>
 
 2019-02-16  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][BFC] Add support for block replaced intrinsic width.
+        https://bugs.webkit.org/show_bug.cgi?id=194705
+
+        Reviewed by Simon Fraser.
+
+        Replaced boxes should report their intrinsic width as preferred widths.
+
+        Test: fast/block/block-only/replaced-intrinsic-width-simple.html
+
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
+
+2019-02-16  Zalan Bujtas  <zalan@apple.com>
+
         [LFC] Apply min/max width constraints to preferred width computation
         https://bugs.webkit.org/show_bug.cgi?id=194739
 
         [LFC] Apply min/max width constraints to preferred width computation
         https://bugs.webkit.org/show_bug.cgi?id=194739
 
index fe84bd8..f9633b4 100644 (file)
@@ -299,6 +299,15 @@ FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::i
         if (!style.logicalWidth().isAuto())
             return { };
 
         if (!style.logicalWidth().isAuto())
             return { };
 
+        if (layoutBox.isReplaced()) {
+            auto& replaced = *layoutBox.replaced();
+            if (replaced.hasIntrinsicWidth()) {
+                auto replacedWidth = replaced.intrinsicWidth();
+                return { replacedWidth, replacedWidth };
+            }
+            return { };
+        }
+
         if (!is<Container>(layoutBox))
             return { };
 
         if (!is<Container>(layoutBox))
             return { };
 
index f7bf9cd..6c08955 100644 (file)
@@ -1,5 +1,14 @@
 2019-02-16  Zalan Bujtas  <zalan@apple.com>
 
 2019-02-16  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][BFC] Add support for block replaced intrinsic width.
+        https://bugs.webkit.org/show_bug.cgi?id=194705
+
+        Reviewed by Simon Fraser.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-02-16  Zalan Bujtas  <zalan@apple.com>
+
         [LFC] Apply min/max width constraints to preferred width computation
         https://bugs.webkit.org/show_bug.cgi?id=194739
 
         [LFC] Apply min/max width constraints to preferred width computation
         https://bugs.webkit.org/show_bug.cgi?id=194739
 
index 286d61c..0728a23 100644 (file)
@@ -114,6 +114,7 @@ fast/block/block-only/relative-position-when-containing-block-is-not-in-the-form
 fast/block/block-only/relative-right.html
 fast/block/block-only/relative-siblings.html
 fast/block/block-only/relative-simple.html
 fast/block/block-only/relative-right.html
 fast/block/block-only/relative-siblings.html
 fast/block/block-only/relative-simple.html
+fast/block/block-only/replaced-intrinsic-width-simple-expected.html
 fast/block/float/001.html
 fast/block/float/003.html
 fast/block/float/007.html
 fast/block/float/001.html
 fast/block/float/003.html
 fast/block/float/007.html