Changeset 180142 in webkit for trunk/Source/WebCore/ChangeLog


Ignore:
Timestamp:
Feb 16, 2015, 4:00:17 AM (11 years ago)
Author:
svillar@igalia.com
Message:

[CSS Grid Layout] Invalid initialization of track sizes with non spanning grid items
https://bugs.webkit.org/show_bug.cgi?id=140763

Reviewed by Antti Koivisto.

Source/WebCore:

Content sized tracks with non-spanning grid items were not
properly sized because the growth limit was sometimes infinity
(-1) after calling resolveContentBasedTrackSizingFunctions() when
it should not. This patch adds an special initialization phase for
non-spanning grid items as the new track sizing algorithm
describes.

Granted, that was handled in the old algorithm in
distributeSpaceToTracks() as a special case. The problem is that
it regressed after the optimization added in r173868 because that
method is no longer called when the space to distribute is 0.

That's why we could fix this by allowing calls to
distributeSpaceToTracks() with spaceToDistribute>=0 but by fixing
it with an explicit initialization our implementation becomes
closer to the new algorithm and the initialization is now explicit
in the code instead of a side effect of calling
distributeSpaceToTracks() with no space to be distributed. It also
brings a slight performance improvement as we save sorts and hash
lookups.

I also took the change to add caching to several GridTrackSize
methods that were hot on the profiler (each one accounted for ~1%
of the total time, now they account for ~0.3% each).

Test: fast/css-grid-layout/grid-initialize-span-one-items.html

  • rendering/RenderGrid.cpp:

(WebCore::GridItemWithSpan::span): New helper method for ASSERTs.
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
Exclude non spanning grid items from the calls to
resolveContentBasedTrackSizingFunctionsForItems().
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems):
New method to resolve track sizes only using non-spanning grid
items.
(WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
Ensure that it isn't called for non-spanning grid items.

  • rendering/RenderGrid.h:
  • rendering/style/GridTrackSize.h:

(WebCore::GridTrackSize::GridTrackSize): Cache return values.
(WebCore::GridTrackSize::setLength): Ditto.
(WebCore::GridTrackSize::setMinMax): Ditto.
(WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes): New method
that caches the return values for hasXXXTrackBreadth() methods.
(WebCore::GridTrackSize::hasMinOrMaxContentMinTrackBreadth): Use
the cached return value.
(WebCore::GridTrackSize::hasMaxContentMaxTrackBreadth): Ditto.
(WebCore::GridTrackSize::hasMinContentMaxTrackBreadth): Ditto.
(WebCore::GridTrackSize::hasMinOrMaxContentMaxTrackBreadth): Ditto.
(WebCore::GridTrackSize::hasMaxContentMinTrackBreadth): Ditto.
(WebCore::GridTrackSize::hasMinContentMinTrackBreadth): Ditto.
(WebCore::GridTrackSize::hasMinContentMinTrackBreadthAndMinOrMaxContentMaxTrackBreadth):
Ditto.
(WebCore::GridTrackSize::hasMaxContentMinTrackBreadthAndMaxContentMaxTrackBreadth):
Ditto.

LayoutTests:

  • fast/css-grid-layout/grid-content-sized-columns-resolution-expected.txt:
  • fast/css-grid-layout/grid-content-sized-columns-resolution.html:
  • fast/css-grid-layout/grid-initialize-span-one-items-expected.txt: Added.
  • fast/css-grid-layout/grid-initialize-span-one-items.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r180141 r180142  
     12015-02-13  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [CSS Grid Layout] Invalid initialization of track sizes with non spanning grid items
     4        https://bugs.webkit.org/show_bug.cgi?id=140763
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Content sized tracks with non-spanning grid items were not
     9        properly sized because the growth limit was sometimes infinity
     10        (-1) after calling resolveContentBasedTrackSizingFunctions() when
     11        it should not. This patch adds an special initialization phase for
     12        non-spanning grid items as the new track sizing algorithm
     13        describes.
     14
     15        Granted, that was handled in the old algorithm in
     16        distributeSpaceToTracks() as a special case. The problem is that
     17        it regressed after the optimization added in r173868 because that
     18        method is no longer called when the space to distribute is 0.
     19
     20        That's why we could fix this by allowing calls to
     21        distributeSpaceToTracks() with spaceToDistribute>=0 but by fixing
     22        it with an explicit initialization our implementation becomes
     23        closer to the new algorithm and the initialization is now explicit
     24        in the code instead of a side effect of calling
     25        distributeSpaceToTracks() with no space to be distributed. It also
     26        brings a slight performance improvement as we save sorts and hash
     27        lookups.
     28
     29        I also took the change to add caching to several GridTrackSize
     30        methods that were hot on the profiler (each one accounted for ~1%
     31        of the total time, now they account for ~0.3% each).
     32
     33        Test: fast/css-grid-layout/grid-initialize-span-one-items.html
     34
     35        * rendering/RenderGrid.cpp:
     36        (WebCore::GridItemWithSpan::span): New helper method for ASSERTs.
     37        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
     38        Exclude non spanning grid items from the calls to
     39        resolveContentBasedTrackSizingFunctionsForItems().
     40        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems):
     41        New method to resolve track sizes only using non-spanning grid
     42        items.
     43        (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
     44        Ensure that it isn't called for non-spanning grid items.
     45        * rendering/RenderGrid.h:
     46        * rendering/style/GridTrackSize.h:
     47        (WebCore::GridTrackSize::GridTrackSize): Cache return values.
     48        (WebCore::GridTrackSize::setLength): Ditto.
     49        (WebCore::GridTrackSize::setMinMax): Ditto.
     50        (WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes): New method
     51        that caches the return values for hasXXXTrackBreadth() methods.
     52        (WebCore::GridTrackSize::hasMinOrMaxContentMinTrackBreadth): Use
     53        the cached return value.
     54        (WebCore::GridTrackSize::hasMaxContentMaxTrackBreadth): Ditto.
     55        (WebCore::GridTrackSize::hasMinContentMaxTrackBreadth): Ditto.
     56        (WebCore::GridTrackSize::hasMinOrMaxContentMaxTrackBreadth): Ditto.
     57        (WebCore::GridTrackSize::hasMaxContentMinTrackBreadth): Ditto.
     58        (WebCore::GridTrackSize::hasMinContentMinTrackBreadth): Ditto.
     59        (WebCore::GridTrackSize::hasMinContentMinTrackBreadthAndMinOrMaxContentMaxTrackBreadth):
     60        Ditto.
     61        (WebCore::GridTrackSize::hasMaxContentMinTrackBreadthAndMaxContentMaxTrackBreadth):
     62        Ditto.
     63
    1642015-02-16  Milan Crha  <mcrha@redhat.com>
    265
Note: See TracChangeset for help on using the changeset viewer.