Changeset 221910 in webkit


Ignore:
Timestamp:
Sep 12, 2017 4:30:48 AM (7 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Use transferred size over content size for automatic minimum size
https://bugs.webkit.org/show_bug.cgi?id=176688

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Import changes on the tests related to the new behavior.

  • web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-006.html:
  • web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-007.html:
  • web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-008.html:
  • web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-009.html:
  • web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-021.html:
  • web-platform-tests/css/css-grid-1/grid-items/support/100x50-green.png: Removed.
  • web-platform-tests/css/css-grid-1/grid-items/support/25x50-green.png: Added.
  • web-platform-tests/css/css-grid-1/grid-items/support/50x100-green.png: Removed.
  • web-platform-tests/css/css-grid-1/grid-items/support/50x25-green.png: Added.
  • web-platform-tests/css/css-grid-1/grid-items/support/w3c-import.log:

Source/WebCore:

CSS WG has agreed to modify the spec so now the transferred size is used
(if it exists) independently if it's bigger or smaller
than the content size.
See: https://github.com/w3c/csswg-drafts/issues/1149

The spec text (https://drafts.csswg.org/css-grid/#min-size-auto):

"The automatic minimum size for a grid item in a given dimension is

its specified size if it exists, otherwise its transferred size
if that exists, else its content size"

This patch use the WPT tests updated to check the new behavior.

  • rendering/GridTrackSizingAlgorithm.cpp:

(WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
Modified so it always returns the transferred size (if any).

Location:
trunk
Files:
2 added
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r221869 r221910  
     12017-09-12  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Use transferred size over content size for automatic minimum size
     4        https://bugs.webkit.org/show_bug.cgi?id=176688
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Import changes on the tests related to the new behavior.
     9
     10        * web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-006.html:
     11        * web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-007.html:
     12        * web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-008.html:
     13        * web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-009.html:
     14        * web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-021.html:
     15        * web-platform-tests/css/css-grid-1/grid-items/support/100x50-green.png: Removed.
     16        * web-platform-tests/css/css-grid-1/grid-items/support/25x50-green.png: Added.
     17        * web-platform-tests/css/css-grid-1/grid-items/support/50x100-green.png: Removed.
     18        * web-platform-tests/css/css-grid-1/grid-items/support/50x25-green.png: Added.
     19        * web-platform-tests/css/css-grid-1/grid-items/support/w3c-import.log:
     20
    1212017-09-11  Joseph Pecoraro  <pecoraro@apple.com>
    222
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-006.html

    r217652 r221910  
    66<link rel="match" href="ref-filled-green-100px-square-image.html">
    77<meta name="flags" content="image">
    8 <meta name="assert" content="Checks that minimum size for grid items is the specified size for width (regardless the content size) and the transferred size for height (as it's smaller than the content size of the image).">
     8<meta name="assert" content="Checks that minimum size for grid items is the specified size for width (regardless the content size) and the transferred size of the image for height (even when content size is bigger).">
    99<style>
    1010  #reference-overlapped-red {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-007.html

    r217652 r221910  
    66<link rel="match" href="ref-filled-green-100px-square-image.html">
    77<meta name="flags" content="image">
    8 <meta name="assert" content="Checks that minimum size for grid items is the specified size for width (regardless the content size) and the content size for height (as it's smaller than the transferred size of the image).">
     8<meta name="assert" content="Checks that minimum size for grid items is the specified size for width (regardless the content size) and the transferred size of the image for height (even when content size is smaller).">
    99<style>
    1010  #reference-overlapped-red {
     
    1818  #constrained-grid {
    1919    display: grid;
     20    grid-template-columns: auto auto;
    2021    width: 10px;
    2122    height: 10px;
    2223  }
    2324
    24   #test-grid-item-overlapping-green {
    25     width: 100px;
     25  .test-grid-item-overlapping-green {
     26    width: 50px;
    2627    justify-self: stretch;
    2728    align-self: stretch;
     
    3233<div id="reference-overlapped-red"></div>
    3334<div id="constrained-grid">
    34   <img id="test-grid-item-overlapping-green" src="support/50x100-green.png" alt="Image download support must be enabled" />
     35  <img class="test-grid-item-overlapping-green" src="support/25x50-green.png" alt="Image download support must be enabled" />
     36  <img class="test-grid-item-overlapping-green" src="support/25x50-green.png" alt="Image download support must be enabled" />
    3537</div>
    3638
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-008.html

    r217652 r221910  
    66<link rel="match" href="ref-filled-green-100px-square-image.html">
    77<meta name="flags" content="image">
    8 <meta name="assert" content="Checks that minimum size for grid items is the specified size for height (regardless the content size) and the transferred size for width (as it's smaller than the content size of the image).">
     8<meta name="assert" content="Checks that minimum size for grid items is the specified size for height (regardless the content size) and the transferred size of the image for width (even when content size is bigger).">
    99<style>
    1010  #reference-overlapped-red {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-009.html

    r217652 r221910  
    66<link rel="match" href="ref-filled-green-100px-square-image.html">
    77<meta name="flags" content="image">
    8 <meta name="assert" content="Checks that minimum size for grid items is the specified size for height (regardless the content size) and the content size for width (as it's smaller than the transferred size of the image).">
     8<meta name="assert" content="Checks that minimum size for grid items is the specified size for height (regardless the content size) and the transferred size for width of the image (even when content size is smaller).">
    99<style>
    1010  #reference-overlapped-red {
     
    2222  }
    2323
    24   #test-grid-item-overlapping-green {
    25     height: 100px;
     24  .test-grid-item-overlapping-green {
     25    height: 50px;
    2626    justify-self: stretch;
    2727    align-self: stretch;
     
    3232<div id="reference-overlapped-red"></div>
    3333<div id="constrained-grid">
    34   <img id="test-grid-item-overlapping-green" src="support/100x50-green.png" alt="Image download support must be enabled" />
     34  <img class="test-grid-item-overlapping-green" src="support/50x25-green.png" alt="Image download support must be enabled" />
     35  <img class="test-grid-item-overlapping-green" src="support/50x25-green.png" alt="Image download support must be enabled" />
    3536</div>
    3637
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/grid-minimum-size-grid-items-021.html

    r217652 r221910  
    6868  function runTests() {
    6969    checkGridSizeTracksAndImageSize("grid-1", "img-1", "200px", "200px", "200px", "200px", "200px", "200px");
    70     checkGridSizeTracksAndImageSize("grid-2", "img-2", "10px", "10px", "200px", "50px", "200px", "200px");
     70    checkGridSizeTracksAndImageSize("grid-2", "img-2", "10px", "10px", "200px", "200px", "200px", "200px");
    7171    checkGridSizeTracksAndImageSize("grid-3", "img-3", "200px", "50px", "200px", "50px", "200px", "200px");
    7272    checkGridSizeTracksAndImageSize("grid-4", "img-4", "200px", "10px", "200px", "50px", "200px", "200px");
     
    7474    checkGridSizeTracksAndImageSize("grid-6", "img-6", "200px", "10px", "50px", "50px", "50px", "50px");
    7575    checkGridSizeTracksAndImageSize("grid-7", "img-7", "200px", "225px", "200px", "200px 25px", "200px", "200px");
    76     checkGridSizeTracksAndImageSize("grid-8", "img-8", "10px", "10px", "200px", "50px 25px", "200px", "200px");
     76    checkGridSizeTracksAndImageSize("grid-8", "img-8", "10px", "10px", "200px", "200px 25px", "200px", "200px");
    7777    checkGridSizeTracksAndImageSize("grid-9", "img-9", "200px", "125px", "200px", "100px 25px", "200px", "200px");
    78     checkGridSizeTracksAndImageSize("grid-10", "img-10", "200px", "10px", "200px", "50px 25px", "200px", "200px");
     78    checkGridSizeTracksAndImageSize("grid-10", "img-10", "200px", "10px", "200px", "100px 25px", "200px", "200px");
    7979    checkGridSizeTracksAndImageSize("grid-11", "img-11", "200px", "125px", "100px", "100px 25px", "100px", "100px");
    80     checkGridSizeTracksAndImageSize("grid-12", "img-12", "200px", "10px", "100px", "50px 25px", "100px", "100px");
     80    checkGridSizeTracksAndImageSize("grid-12", "img-12", "200px", "10px", "100px", "100px 25px", "100px", "100px");
    8181    checkGridSizeTracksAndImageSize("grid-13", "img-13", "200px", "200px", "200px", "200px", "200px", "200px");
    8282    checkGridSizeTracksAndImageSize("grid-14", "img-14", "10px", "10px", "200px", "200px", "200px", "200px");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/w3c-import.log

    r217652 r221910  
    1616List of files:
    1717/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/100x100-green.png
    18 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/100x50-green.png
    1918/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/200x200-green.png
     19/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/25x50-green.png
    2020/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/500x500-green.png
    21 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/50x100-green.png
     21/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/50x25-green.png
    2222/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/grid-items/support/50x50-green.png
  • trunk/Source/WebCore/ChangeLog

    r221909 r221910  
     12017-09-12  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Use transferred size over content size for automatic minimum size
     4        https://bugs.webkit.org/show_bug.cgi?id=176688
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        CSS WG has agreed to modify the spec so now the transferred size is used
     9        (if it exists) independently if it's bigger or smaller
     10        than the content size.
     11        See: https://github.com/w3c/csswg-drafts/issues/1149
     12
     13        The spec text (https://drafts.csswg.org/css-grid/#min-size-auto):
     14          "The automatic minimum size for a grid item in a given dimension is
     15           its specified size if it exists, otherwise its transferred size
     16           if that exists, else its content size"
     17
     18        This patch use the WPT tests updated to check the new behavior.
     19
     20        * rendering/GridTrackSizingAlgorithm.cpp:
     21        (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
     22        Modified so it always returns the transferred size (if any).
     23
    1242017-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
    225
  • trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

    r217709 r221910  
    787787
    788788    bool overflowIsVisible = isRowAxis ? child.style().overflowInlineDirection() == OVISIBLE : child.style().overflowBlockDirection() == OVISIBLE;
    789     if (!childSize.isAuto() || (childMinSize.isAuto() && overflowIsVisible)) {
    790         if (child.isRenderReplaced() && childSize.isAuto()) {
    791             // If the box has an aspect ratio and no specified size, its automatic
    792             // minimum size is the smaller of its content size and its transferred
    793             // size.
    794             return isRowAxis ? std::min(child.intrinsicLogicalWidth(), minContentForChild(child)) : std::min(child.intrinsicLogicalHeight(), minContentForChild(child));
    795         }
     789    if (!childSize.isAuto() || (childMinSize.isAuto() && overflowIsVisible))
    796790        return minContentForChild(child);
    797     }
    798791
    799792    bool overrideSizeHasChanged = updateOverrideContainingBlockContentSizeForChild(child, childInlineDirection);
Note: See TracChangeset for help on using the changeset viewer.