Bug 101294

Summary: While absolute positioning is put before the first flexitem, flexitems will move to a new line.
Product: WebKit Reporter: wayfind <whyer1>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, kennyluck, ojan, tony, webkit.review.bot, whyer1
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 62048    
Attachments:
Description Flags
Patch
none
Prev patch lost a LayoutTesst Changelog.
none
Add more Changelog
none
Finally patch
none
Really finally patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description wayfind 2012-11-05 19:13:01 PST
an absolute div before all flex item in a container will lead to flex item lmove to a new line.
Comment 1 wayfind 2012-11-05 19:55:49 PST
Created attachment 172473 [details]
Patch
Comment 2 wayfind 2012-11-05 19:57:06 PST
If absolute div before all flex item in a container,and the set flex container to "-webkit-flex-flow: row wrap" the flex item after absolute div will move to a new line.
Comment 3 wayfind 2012-11-06 00:57:18 PST
We may come across this problem in RenderFlexibleBox::computeNextFlexLine.when it comes to the move-to-next-line issue, 2 condition must be taken into consideration 1) whether the width has gone beyond lineBreakLength , 2) whether the rderedChildren is empty. 
If the width has gone beyond ineBreakLength and absloute layout is ongoing in the container, wrong line-moving might occur. 
The way to solve the problem is to jutify whether orderedChildren could collect at least one flex item, if yes, move to next line
Comment 4 wayfind 2012-11-06 01:10:49 PST
Created attachment 172511 [details]
Prev patch lost a LayoutTesst Changelog.
Comment 5 wayfind 2012-11-06 01:54:46 PST
Created attachment 172525 [details]
Add more Changelog
Comment 6 wayfind 2012-11-06 05:49:19 PST
Created attachment 172560 [details]
Finally patch
Comment 7 wayfind 2012-11-06 06:12:10 PST
Created attachment 172566 [details]
Really finally patch
Comment 8 Ojan Vafai 2012-11-06 09:32:38 PST
Comment on attachment 172566 [details]
Really finally patch

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

Thanks for the fix. The change looks good. Just a bunch of style nits.

You're ChangeLog description does not match the standard format. I recommend deleting them and uploading this patch using "webkit-patch upload". Then it will create the ChangeLog entries for you and you just need to fill in the detailed description section. Also, that will properly mark the patch as ready for review by setting r?.

> LayoutTests/css3/flexbox/flex-algorithm.html:202
> +  <div style="position: absolute;"></div>

May as well check the x/y positions on this element as well.

> LayoutTests/css3/flexbox/flex-algorithm.html:203
> +  <div data-offset-y="0" style="width: 700px;"></div>

May as well add data-offset-x=0 as well for good measure.

> Source/WebCore/rendering/RenderFlexibleBox.cpp:898
> +    bool hasOneItemCollected = false;

I'd prefer a name like...lineHasInFlowItem. Also, a line break after this line would break up the code to make it a bit more readable.
Comment 9 wayfind 2012-11-07 07:55:22 PST
Created attachment 172802 [details]
Patch
Comment 10 Ojan Vafai 2012-11-07 09:10:21 PST
Comment on attachment 172802 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).

You need to put a description of the change here.

> Source/WebCore/ChangeLog:10
> +        No new tests (OOPS!).

You can delete this line.

> LayoutTests/ChangeLog:8
> +        Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).

Need a short description here.
Comment 11 wayfind 2012-11-07 21:48:59 PST
Created attachment 172928 [details]
Patch
Comment 12 Ojan Vafai 2012-11-07 22:03:30 PST
Comment on attachment 172928 [details]
Patch

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

This patch doesn't seem to apply to tip of tree (see all the bot failures).

> Source/WebCore/ChangeLog:10
> +		If there is an absolutely positioned flex item before other items in a container and the container is set to "-webkit-flex-flow: row wrap", the flex item after the absolutely positioned will move to a new line.
> +		This issue has to do with RenderFlexibleBox::computeNextFlexLine. When determing line breaks, the algorithm sees if 1) the total width exceeds lineBreakLength and 2) whether orderedChildren is non-empty.  But then, if the total width exceeds lineBreakLength and there's only absolutely positioned elemments in orderedChildren then the conditions are met and the algorithm mistakenly breaks the line.
> +		The solution is to see if orderedChildren collects at least a flex item. If it does, break the line.

Please use only spaces and not tabs.
Comment 13 wayfind 2012-11-07 22:06:28 PST
Created attachment 172931 [details]
Patch
Comment 14 Ojan Vafai 2012-11-07 22:18:32 PST
Comment on attachment 172931 [details]
Patch

Patch looks good. Thanks. Just need to figure out why it's not applying. Looks like there's a conflict in RenderFlexibleBox.cpp. e.g. see http://queues.webkit.org/results/14757641.
Comment 15 wayfind 2012-11-08 03:04:21 PST
Created attachment 172975 [details]
Patch
Comment 16 wayfind 2012-11-08 03:19:06 PST
Created attachment 172986 [details]
Patch
Comment 17 Ojan Vafai 2012-11-08 08:43:01 PST
Comment on attachment 172986 [details]
Patch

Yay! Thanks! I assume you want me to commit this as well. I'm adding cq+ (puts in in the commit queue). For future reference, you request cq by setting cq?. That lets the reviewer know you would like a cq+ once the patch is r+'ed.
Comment 18 WebKit Review Bot 2012-11-08 09:29:32 PST
Comment on attachment 172986 [details]
Patch

Clearing flags on attachment: 172986

Committed r133906: <http://trac.webkit.org/changeset/133906>
Comment 19 WebKit Review Bot 2012-11-08 09:29:36 PST
All reviewed patches have been landed.  Closing bug.
Comment 20 Tony Chang 2012-11-08 16:15:38 PST
Comment on attachment 172975 [details]
Patch

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

> LayoutTests/css3/flexbox/flex-algorithm.html:201
> +<div class="flexbox" style="height: 60px; -webkit-flex-flow: row wrap; position: relative;">

Nit: Instead of using -webkit-flex-flow, you should use the row and wrap class from flexbox.css so this code will run in Firefox.