Bug 128173 - [CSS Grid Layout] Percentages of indefinite sizes should compute to auto
Summary: [CSS Grid Layout] Percentages of indefinite sizes should compute to auto
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sergio Villar Senin
URL:
Keywords:
Depends on: 127033
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-04 04:33 PST by Sergio Villar Senin
Modified: 2014-03-04 04:30 PST (History)
13 users (show)

See Also:


Attachments
Patch (19.22 KB, patch)
2014-02-07 03:17 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 2014-02-04 04:33:33 PST
According to the spec, http://dev.w3.org/csswg/css-grid/#valuedef-percentage, that's what we have to do.

This will fix examples like the following one

.grid {
width: -webkit-min-content;
height: auto;

-webkit-grid-definition-columns:50%;
-webkit-grid-definition-rows:20%;
}

<div class="grid"></div>

If we ask for getComputedStyle() for the <div> element, we'll get a negative value, because the renderer will try to compute a percentage of an undefined size (which is internally represented as -1).
Comment 1 Sergio Villar Senin 2014-02-07 03:17:21 PST
Created attachment 223446 [details]
Patch
Comment 2 Darin Adler 2014-03-03 10:58:39 PST
Comment on attachment 223446 [details]
Patch

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

> Source/WebCore/rendering/RenderGrid.cpp:413
> +            DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Auto));

New code should not use DEFINE_STATIC_LOCAL (I think we should rename it DEPRECATED_DEFINE_STATIC_LOCAL). Instead you should just use static NeverDestroyed. There are lots of examples of that all over the code.
Comment 3 Sergio Villar Senin 2014-03-03 11:17:46 PST
(In reply to comment #2)
> (From update of attachment 223446 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=223446&action=review
> 
> > Source/WebCore/rendering/RenderGrid.cpp:413
> > +            DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Auto));
> 
> New code should not use DEFINE_STATIC_LOCAL (I think we should rename it DEPRECATED_DEFINE_STATIC_LOCAL). Instead you should just use static NeverDestroyed. There are lots of examples of that all over the code.

Filed https://bugs.webkit.org/show_bug.cgi?id=129612
Comment 4 Sergio Villar Senin 2014-03-04 04:30:47 PST
Committed r165048: <http://trac.webkit.org/changeset/165048>