Bug 128173

Summary: [CSS Grid Layout] Percentages of indefinite sizes should compute to auto
Product: WebKit Reporter: Sergio Villar Senin <svillar>
Component: CSSAssignee: Sergio Villar Senin <svillar>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, dino, esprehn+autocc, fpizlo, glenn, hyatt, jfernandez, kling, kondapallykalyan, mark.lam, rego, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 127033    
Bug Blocks:    
Attachments:
Description Flags
Patch darin: review+

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>