Bug 85991

Summary: REGRESSION (r116331): RSS Headlines/links are missing (-webkit-box-flex broken?)
Product: WebKit Reporter: Vincent <v.a.a.g>
Component: Layout and RenderingAssignee: Pravin D <pravind.2k4>
Status: RESOLVED FIXED    
Severity: Critical CC: ap, eric, hamaji, hyatt, jchaffraix, mitz, mrowe, ojan, pravind.2k4, simon.fraser, tony, webkit, webkit.review.bot
Priority: P1 Keywords: Regression
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
screen RSS example
none
An archive of such a page
none
mostly reduced test case
none
more reduced test case
none
Patch
none
Patch
none
Patch none

Description Vincent 2012-05-09 07:14:10 PDT
Choose RSS->View all RSS articles -> the headlines/links don't show up (see attachment)
Comment 1 Vincent 2012-05-09 07:15:58 PDT
Created attachment 140939 [details]
screen RSS example
Comment 2 Alexey Proskuryakov 2012-05-10 12:25:28 PDT
*** Bug 86053 has been marked as a duplicate of this bug. ***
Comment 3 Alexey Proskuryakov 2012-05-10 12:53:58 PDT
Eric, Pravin, is this something that can be fixed quickly, or should this change be just reverted?
Comment 4 Eric Seidel (no email) 2012-05-10 12:59:58 PDT
Do you have any html example?
Comment 5 Alexey Proskuryakov 2012-05-10 13:38:52 PDT
Created attachment 141240 [details]
An archive of such a page

This is not a reduced case, but shows the issue in browser.
Comment 6 Eric Seidel (no email) 2012-05-10 14:46:16 PDT
Reducing now...
Comment 7 Eric Seidel (no email) 2012-05-10 14:55:56 PDT
Created attachment 141270 [details]
mostly reduced test case
Comment 8 Eric Seidel (no email) 2012-05-10 14:59:34 PDT
Created attachment 141272 [details]
more reduced test case
Comment 9 Eric Seidel (no email) 2012-05-10 15:00:42 PDT
I don't know anything about deprecated flex box.  It's not clear to me what broke.  If it isn't obvious to pravind, we'll likely have to roll it out.
Comment 10 Eric Seidel (no email) 2012-05-10 15:36:26 PDT
A link to the change:
http://trac.webkit.org/changeset/116331/trunk/Source/WebCore/rendering/RenderBlock.cpp
Comment 11 Eric Seidel (no email) 2012-05-10 15:46:18 PDT
The change was a single character change. :)  The question is how Safari's RSS layout is supposed to work here.  Not understanding deprecated flex-boxes, it's unclear to me if the new rendering is "correct" or not.
Comment 12 Tony Chang 2012-05-10 15:51:26 PDT
I think the new behavior is correct.  Here's the CSS of the flex item:
#inner {
    max-width: intrinsic;
    width: 0px;
    overflow: hidden;
    -webkit-box-flex: 60;
}

The max-width is intrinsic, which means it's 0px.  Thus, #inner can't flex bigger than 0.

The main problem is that width is trying to be used both to determine the intrinsic size and it's being used as the starting size for flexing (that's why the author set it to 0 here).  Unfortunately, I'm not sure how to get the same behavior as prior to r116331.

FWIW, new flexbox avoids this by having the starting size for flexing be a part of the flex property rather than overloading 'width' for both.
Comment 13 Eric Seidel (no email) 2012-05-10 15:58:57 PDT
Tony: Do you have a suggestion as to how one might change the markup to get what the RSS author intended?

Or would we need to add a quirk to this check that if the box is using the deprecated flexbox model width: 0 needs to be special?
Comment 14 Tony Chang 2012-05-10 16:23:57 PDT
Created attachment 141289 [details]
Patch
Comment 15 Tony Chang 2012-05-10 16:26:13 PDT
The above fixes the old flexbox behavior.  It's kind of conceptually correct-- I bet the old spec is underdefined here.

You could construct other cases where this would differ from before r116331, but the new behavior is probably closer to the author's intent.

Maybe Hyatt or Ojan have an opinion.
Comment 16 Ojan Vafai 2012-05-10 19:23:02 PDT
(In reply to comment #15)
> The above fixes the old flexbox behavior.  It's kind of conceptually correct-- I bet the old spec is underdefined here.
> 
> You could construct other cases where this would differ from before r116331, but the new behavior is probably closer to the author's intent.
> 
> Maybe Hyatt or Ojan have an opinion.

Tony's fix seems fine to me. The new behavior is more correct, but if there's content depending on old bugs, it's fine to special case deprecated flex items to do something dumb since we're not fixing bugs in old flexbox.
Comment 17 Pravin D 2012-05-10 22:52:32 PDT
Sorry guys... I'm on the otherside of the Globe, so could not reply earlier. I'll  try and check for a alternative fix...
Comment 18 Eric Seidel (no email) 2012-05-10 22:58:01 PDT
I don't think there is anything for you to do Pravin.  The new behavior is correct.  We just need to check in a work-around for deprecated-flexbox, like Tony suggested.  Someone just needs to take tony's patch an a variant (ideally text-only) of my test case, and check it in. :)
Comment 19 Pravin D 2012-05-10 23:04:25 PDT
hmmm maybe... :) 
I was wondering about the patch that Tony had submitted. Will deprecated flex boxes behave as expected when the width > 0 ??
Comment 20 Pravin D 2012-05-10 23:35:29 PDT
(In reply to comment #14)
> Created an attachment (id=141289) [details]
> Patch

> if (!isTableCell() && styleToUse->logicalWidth().isFixed() 
  && styleToUse->logicalWidth().value() >= 0 && style()->marqueeBehavior() !=      MALTERNATE && !isDeprecatedFlexItem())

Hey Tony you need to add a check for width:0 also in the deprecated flex box case. 
Behavior before r116331
When the width > 0 then the width is taken
otherwise calculated width of the content is taken.

So !isDeprecatedFlexItem() will become 
!(isDeprecatedFlexItem() && styleToUse->logicalWidth().value()==0) shuld restore the behavior in case of flex box prior to r116331.
Comment 21 Ojan Vafai 2012-05-11 00:00:29 PDT
(In reply to comment #20)
> (In reply to comment #14)
> > Created an attachment (id=141289) [details] [details]
> > Patch
> 
> > if (!isTableCell() && styleToUse->logicalWidth().isFixed() 
>   && styleToUse->logicalWidth().value() >= 0 && style()->marqueeBehavior() !=      MALTERNATE && !isDeprecatedFlexItem())
> 
> Hey Tony you need to add a check for width:0 also in the deprecated flex box case. 
> Behavior before r116331
> When the width > 0 then the width is taken
> otherwise calculated width of the content is taken.
> 
> So !isDeprecatedFlexItem() will become 
> !(isDeprecatedFlexItem() && styleToUse->logicalWidth().value()==0) shuld restore the behavior in case of flex box prior to r116331.

Yup. That's more correct. Pravin, if you have the time, you could upload a patch with this fix and with an appropriate layout test.
Comment 22 Pravin D 2012-05-11 00:06:50 PDT
(In reply to comment #21)
> (In reply to comment #20)
> > (In reply to comment #14)
> > > Created an attachment (id=141289) [details] [details] [details]
> > > Patch
> > 
> > > if (!isTableCell() && styleToUse->logicalWidth().isFixed() 
> >   && styleToUse->logicalWidth().value() >= 0 && style()->marqueeBehavior() !=      MALTERNATE && !isDeprecatedFlexItem())
> > 
> > Hey Tony you need to add a check for width:0 also in the deprecated flex box case. 
> > Behavior before r116331
> > When the width > 0 then the width is taken
> > otherwise calculated width of the content is taken.
> > 
> > So !isDeprecatedFlexItem() will become 
> > !(isDeprecatedFlexItem() && styleToUse->logicalWidth().value()==0) shuld restore the behavior in case of flex box prior to r116331.
> 
> Yup. That's more correct. Pravin, if you have the time, you could upload a patch with this fix and with an appropriate layout test.

Sure...
Comment 23 Pravin D 2012-05-11 02:30:24 PDT
Created attachment 141361 [details]
Patch
Comment 24 Pravin D 2012-05-11 03:19:06 PDT
(In reply to comment #23)
> Created an attachment (id=141361) [details]
> Patch

Hi Eric , Ojan ,

The uploaded patch is for making the behavior of deprecated flex boxes prior to r116331.

There seems to be another issue to this. When width is fixed, we seem to totally ignore the max-width or min-width and take 
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width. 

The max-width:intrinsic , min-width:intrinsic is not handled at all...These cases have to handled atleast in flex box cases. Not sure of the other use cases...
Please let me know your opinions
Comment 25 Tony Chang 2012-05-11 09:45:25 PDT
Actually, I don't think you should include the check for 0 width.

Here's an example of where it would matter:

#inner {
    max-width: intrinsic;
    width: 50px;
    overflow: hidden;
    -webkit-box-flex: 60;
}

In the old code, max-width would be 50px.  But that's probably not the author's intent because by setting width, they probably were trying to set the initial flexing size while allowing #inner to flex as large as the intrinsic size.

The new behavior would be have max-width: intrinsic always resolve to the intrinsic size when we're dealing with a flex item.

It's possible that there's some content on the web that this may change the results of, but I doubt it.  The combination of flexbox + intrinsic min/max sizing + width != 0 sounds very rare (0 is a common width for flexbox items because it lets the boxes flex in proportion to box-flex).
Comment 26 Pravin D 2012-05-12 08:49:18 PDT
(In reply to comment #25)
> Actually, I don't think you should include the check for 0 width.
> 
> Here's an example of where it would matter:
> 
> #inner {
>     max-width: intrinsic;
>     width: 50px;
>     overflow: hidden;
>     -webkit-box-flex: 60;
> }
> 
> In the old code, max-width would be 50px.  But that's probably not the author's intent because by setting width, they probably were trying to set the initial flexing size while allowing #inner to flex as large as the intrinsic size.
> 

I also had the same doubt... See comment #24... However that's not the case here. 

The behavior before r116331:
When max-width:instrinsic; width: Xpx then width has to be taken as X pixels when X > 0 , intrinsic size when X <= 0 . 
width:0 is a special case or a bug and in my opinion it was exploited/used by webpage author to make flex box take the size of its content.


> The new behavior would be have max-width: intrinsic always resolve to the intrinsic size when we're dealing with a flex item.
> 

This would mean changing the behavior of deprecated flex boxes, which may not a good idea. 

The behavior on other browsers FF, Opera, and IE-8 is same as the behavior on current webkit i.e all ignore max-width:intrinsic when width:Xpx is specified, irrespective of whether width:0 or not. 

Also non of the attached test cases work on other browsers. 


As Ojan said in comment #16 we just need special case webkit to make the behavior of deprecated flex box prior to r116331 so that we don't end up breaking old webpages.
Comment 27 Tony Chang 2012-05-14 10:45:52 PDT
(In reply to comment #26)
> The behavior on other browsers FF, Opera, and IE-8 is same as the behavior on current webkit i.e all ignore max-width:intrinsic when width:Xpx is specified, irrespective of whether width:0 or not. 
> 
> Also non of the attached test cases work on other browsers. 

'intrinsic' and 'max-intrinsic' are webkit specific keywords.  Firefox supports -moz-max-content.  IE10 Preview and Opera 11 don't seem to support max-content/min-content.

> > The new behavior would be have max-width: intrinsic always resolve to the intrinsic size when we're dealing with a flex item.
> > 
> 
> This would mean changing the behavior of deprecated flex boxes, which may not a good idea. 
> 
> As Ojan said in comment #16 we just need special case webkit to make the behavior of deprecated flex box prior to r116331 so that we don't end up breaking old webpages.

Yes, this would change the behavior, but I think this is closer to the author's intent (i.e., we're fixing a bug) and there are probably no websites that actually hit this case so it should be safe.  The benefit of making the change is that the code is simpler.
Comment 28 Tony Chang 2012-05-14 10:47:15 PDT
(In reply to comment #27)
> (In reply to comment #26)
> > The behavior on other browsers FF, Opera, and IE-8 is same as the behavior on current webkit i.e all ignore max-width:intrinsic when width:Xpx is specified, irrespective of whether width:0 or not. 
> > 
> > Also non of the attached test cases work on other browsers. 
> 
> 'intrinsic' and 'max-intrinsic' are webkit specific keywords.  Firefox supports -moz-max-content.  IE10 Preview and Opera 11 don't seem to support max-content/min-content.

I meant to add that setting max-width to -moz-max-content doesn't seem to apply in display: -moz-box contexts.  Which is to say, this is a WebKit specific bug.
Comment 29 Pravin D 2012-05-14 13:31:45 PDT
(In reply to comment #27)

> Yes, this would change the behavior, but I think this is closer to the author's >intent (i.e., we're fixing a bug) and there are probably no websites that >actually hit this case so it should be safe.  The benefit of making the change >is that the code is simpler.
>

So this change for max-width:intrinsic will only apply for deprecated flex boxes or for all flex boxes ?
Comment 30 Tony Chang 2012-05-14 14:25:14 PDT
(In reply to comment #29)
> (In reply to comment #27)
> 
> > Yes, this would change the behavior, but I think this is closer to the author's >intent (i.e., we're fixing a bug) and there are probably no websites that >actually hit this case so it should be safe.  The benefit of making the change >is that the code is simpler.
> >
> 
> So this change for max-width:intrinsic will only apply for deprecated flex boxes or for all flex boxes ?

Only deprecated.  New flexbox avoids this by using a separate CSS property.
Comment 31 Ojan Vafai 2012-05-14 15:06:04 PDT
I don't feel strongly about this either way. I think it's unlikely to break content either way, so I'm happy to defer to Tony's "simpler code" argument.
Comment 32 Eric Seidel (no email) 2012-05-16 23:56:21 PDT
Comment on attachment 141361 [details]
Patch

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

> Source/WebCore/rendering/RenderBlock.cpp:5171
> +       && style()->marqueeBehavior() != MALTERNATE && !(isDeprecatedFlexItem() && styleToUse->logicalWidth().value() == static_cast<int>(0)))

YOu can use intValue() of the logicalWidth to do the case for you.  But otehrwies this loolks great.
Comment 33 Pravin D 2012-05-16 23:58:20 PDT
(In reply to comment #32)
> (From update of attachment 141361 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=141361&action=review
> 
> > Source/WebCore/rendering/RenderBlock.cpp:5171
> > +       && style()->marqueeBehavior() != MALTERNATE && !(isDeprecatedFlexItem() && styleToUse->logicalWidth().value() == static_cast<int>(0)))
> 
> YOu can use intValue() of the logicalWidth to do the case for you.  But otehrwies this loolks great.
>

I'll upload another patch with the IntValue changes... Thanks for the review comments
Comment 34 Pravin D 2012-05-17 00:43:48 PDT
Created attachment 142433 [details]
Patch
Comment 35 Eric Seidel (no email) 2012-05-17 00:46:40 PDT
Comment on attachment 142433 [details]
Patch

Thanks.
Comment 36 Pravin D 2012-05-17 00:49:18 PDT
(In reply to comment #35)
> (From update of attachment 142433 [details])
> Thanks.

Thanks a lot for the review
Comment 37 WebKit Review Bot 2012-05-17 01:18:13 PDT
Comment on attachment 142433 [details]
Patch

Clearing flags on attachment: 142433

Committed r117413: <http://trac.webkit.org/changeset/117413>
Comment 38 WebKit Review Bot 2012-05-17 01:18:19 PDT
All reviewed patches have been landed.  Closing bug.