Changeset 175314 in webkit


Ignore:
Timestamp:
Oct 29, 2014 1:30:39 AM (9 years ago)
Author:
svillar@igalia.com
Message:

ASSERTION FAILED: growthShare > 0 in WebCore::RenderGrid::distributeSpaceToTracks
https://bugs.webkit.org/show_bug.cgi?id=137772

Reviewed by Andreas Kling.

Source/WebCore:

We're hitting the ASSERTION because if the number of tracks an
item spans does greatly exceed the available logical space, then
the result of the division availableLogicalSpace/numberOfTracks is
truncated to 0. So the ASSERTION was theoretically right because
the result has to be always >0 (as the dividend > 0) but the fact
that the result is a LayoutUnit forces us to accept 0 as a valid
outcome of the operation.

Test: fast/css-grid-layout/tracks-number-greatly-exceeding-available-size-crash.html

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::distributeSpaceToTracks):

LayoutTests:

  • fast/css-grid-layout/tracks-number-greatly-exceeding-available-size-crash-expected.txt: Added.
  • fast/css-grid-layout/tracks-number-greatly-exceeding-available-size-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r175312 r175314  
     12014-10-17  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        ASSERTION FAILED: growthShare > 0 in WebCore::RenderGrid::distributeSpaceToTracks
     4        https://bugs.webkit.org/show_bug.cgi?id=137772
     5
     6        Reviewed by Andreas Kling.
     7
     8        * fast/css-grid-layout/tracks-number-greatly-exceeding-available-size-crash-expected.txt: Added.
     9        * fast/css-grid-layout/tracks-number-greatly-exceeding-available-size-crash.html: Added.
     10
    1112014-10-29  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r175312 r175314  
     12014-10-17  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        ASSERTION FAILED: growthShare > 0 in WebCore::RenderGrid::distributeSpaceToTracks
     4        https://bugs.webkit.org/show_bug.cgi?id=137772
     5
     6        Reviewed by Andreas Kling.
     7
     8        We're hitting the ASSERTION because if the number of tracks an
     9        item spans does greatly exceed the available logical space, then
     10        the result of the division availableLogicalSpace/numberOfTracks is
     11        truncated to 0. So the ASSERTION was theoretically right because
     12        the result has to be always >0 (as the dividend > 0) but the fact
     13        that the result is a LayoutUnit forces us to accept 0 as a valid
     14        outcome of the operation.
     15
     16        Test: fast/css-grid-layout/tracks-number-greatly-exceeding-available-size-crash.html
     17
     18        * rendering/RenderGrid.cpp:
     19        (WebCore::RenderGrid::distributeSpaceToTracks):
     20
    1212014-10-29  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r174946 r175314  
    651651            LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksSize - i);
    652652            LayoutUnit growthShare = infiniteGrowthPotential ? availableLogicalSpaceShare : std::min(availableLogicalSpaceShare, trackGrowthPotential);
    653             ASSERT(growthShare > 0);
    654             // We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function.
     653            ASSERT_WITH_MESSAGE(growthShare >= 0, "We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function. We can still have 0 as growthShare if the amount of tracks greatly exceeds the availableLogicalSpace.");
    655654            sizingData.distributeTrackVector[i] += growthShare;
    656655            availableLogicalSpace -= growthShare;
Note: See TracChangeset for help on using the changeset viewer.