Bug 150891 - [css-grid] Grid placement conflict handling
Summary: [css-grid] Grid placement conflict handling
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sergio Villar Senin
Depends on:
Blocks: 60731
  Show dependency treegraph
Reported: 2015-11-04 04:31 PST by Sergio Villar Senin
Modified: 2015-11-09 04:24 PST (History)
10 users (show)

See Also:

Patch (14.93 KB, patch)
2015-11-05 08:11 PST, Sergio Villar Senin
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Villar Senin 2015-11-04 04:31:39 PST
The specs have recently changed. If the placement for a grid item contains two lines, and the start line is further end-ward than the end line, swap the two lines.
Comment 1 Sergio Villar Senin 2015-11-05 08:11:49 PST
Created attachment 264865 [details]
Comment 2 Darin Adler 2015-11-06 09:02:55 PST
Comment on attachment 264865 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=264865&action=review

> Source/WebCore/rendering/style/GridResolvedPosition.cpp:300
> +    m_integerPosition = isStartSide(side) ? integerPosition : std::max<int>(0, integerPosition - 1);

This conversion to int and back to unsigned is not a clean way to clamp at zero? I suggest instead we write:

    if (!isStartSide(side) && integerPosition)

    m_integerPosition = integerPosition;

> Source/WebCore/rendering/style/GridResolvedPosition.h:138
> +        return std::max<int>(m_integerPosition - 1, 0);

Same issue here with converting to and from int. I would instead write:

    return m_integerPosition ? m_integerPosition - 1 : 0;
Comment 3 Sergio Villar Senin 2015-11-09 04:24:53 PST
Committed r192153: <http://trac.webkit.org/changeset/192153>