Bug 106143 - min-width/max-width of min-content/max-content don't work correctly if the width set
Summary: min-width/max-width of min-content/max-content don't work correctly if the wi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ojan Vafai
URL:
Keywords:
: 108134 (view as bug list)
Depends on: 106517 106591 106617 106675
Blocks: 97747
  Show dependency treegraph
 
Reported: 2013-01-04 16:04 PST by Ojan Vafai
Modified: 2013-04-02 12:56 PDT (History)
18 users (show)

See Also:


Attachments
test case (321 bytes, text/html)
2013-01-04 16:04 PST, Ojan Vafai
no flags Details
screenshot of different browsers (43.98 KB, image/png)
2013-01-07 10:47 PST, Ojan Vafai
no flags Details
better test case (458 bytes, text/html)
2013-01-07 10:47 PST, Ojan Vafai
no flags Details
another test case (568 bytes, text/html)
2013-01-22 16:38 PST, Ojan Vafai
no flags Details
Patch (28.90 KB, patch)
2013-03-19 19:30 PDT, Ojan Vafai
no flags Details | Formatted Diff | Diff
Patch (29.83 KB, patch)
2013-03-19 20:34 PDT, Ojan Vafai
no flags Details | Formatted Diff | Diff
Patch (31.09 KB, patch)
2013-03-29 12:15 PDT, Ojan Vafai
tony: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ojan Vafai 2013-01-04 16:04:51 PST
Created attachment 181400 [details]
test case

See test case. Mozilla nightly gets this right. This is the same root cause as bug 97747.

I think we might need to add a concept of minContent/maxContent in addition to min/maxPreferredLogicalWidth. The former is not be affected by the width being set, the latter is.
Comment 1 Ojan Vafai 2013-01-07 10:47:00 PST
Created attachment 181529 [details]
screenshot of different browsers

Browsers disagree about how to render this.
Comment 2 Ojan Vafai 2013-01-07 10:47:38 PST
That was IE9, FF17 and Chrome at WebKit r136968.
Comment 3 Ojan Vafai 2013-01-07 10:47:57 PST
Created attachment 181530 [details]
better test case
Comment 4 Ojan Vafai 2013-01-07 13:29:23 PST
Thread on www-style: http://lists.w3.org/Archives/Public/www-style/2013Jan/0046.html
Comment 5 Ojan Vafai 2013-01-22 16:38:21 PST
Created attachment 184072 [details]
another test case

fixed width applies when done to a flexbox that is a flex-item. Should be the same root cause.
Comment 6 Ojan Vafai 2013-01-28 18:30:32 PST
*** Bug 108134 has been marked as a duplicate of this bug. ***
Comment 7 Ojan Vafai 2013-03-19 19:30:36 PDT
Created attachment 193970 [details]
Patch
Comment 8 WebKit Review Bot 2013-03-19 20:17:15 PDT
Comment on attachment 193970 [details]
Patch

Attachment 193970 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://webkit-commit-queue.appspot.com/results/17230223

New failing tests:
css3/flexbox/box-sizing.html
Comment 9 Build Bot 2013-03-19 20:30:16 PDT
Comment on attachment 193970 [details]
Patch

Attachment 193970 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-commit-queue.appspot.com/results/17137524

New failing tests:
css3/flexbox/box-sizing.html
Comment 10 Ojan Vafai 2013-03-19 20:34:18 PDT
Created attachment 193975 [details]
Patch
Comment 11 Elliott Sprehn 2013-03-19 22:04:09 PDT
Comment on attachment 193975 [details]
Patch

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

What's the benefit of passing all these values around as ref params?

> Source/WebCore/rendering/RenderBlock.cpp:5750
> +void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const

It's pretty weird to have this method be "const" but take ref params to instance members so it's not const at all :/

> Source/WebCore/rendering/RenderBlock.cpp:5768
> +        Length w = toRenderTableCell(this)->styleOrColLogicalWidth();

Would be nice to ditch the single letter variables.

> Source/WebCore/rendering/RenderBlock.h:904
> +    void computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;

Block is const but inline isnt?
Comment 12 Ojan Vafai 2013-03-19 22:21:09 PDT
(In reply to comment #11)
> (From update of attachment 193975 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=193975&action=review
> 
> What's the benefit of passing all these values around as ref params?

Tried to explain this in the ChangeLog. computeInstrinsicLogicalWidths needs to pass these values in because it's not always setting the preferred width member variable.

> > Source/WebCore/rendering/RenderBlock.cpp:5750
> > +void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
> 
> It's pretty weird to have this method be "const" but take ref params to instance members so it's not const at all :/

The method is const. Sometimes you pass in member variables as the out params and sometimes you pass stack variables.

> > Source/WebCore/rendering/RenderBlock.cpp:5768
> > +        Length w = toRenderTableCell(this)->styleOrColLogicalWidth();
> 
> Would be nice to ditch the single letter variables.

I was just moving the code, but I may as well fix the name while I'm changing the code.

> > Source/WebCore/rendering/RenderBlock.h:904
> > +    void computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
> 
> Block is const but inline isnt?

Yeah, I started down the rabbit-hole of trying to make computeInlinePreferredLogicalWidths const and it was a tangled web that I didn't want to dive into right now. For now, I have a FIXME in the calling location. I suppose the FIXME should be here as well.
Comment 13 Tony Chang 2013-03-21 12:10:55 PDT
Comment on attachment 193975 [details]
Patch

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

This looks OK to me, but I would address Elliott's feedback as well (single letter variable and FIXME in RenderBlock.h.

> LayoutTests/ChangeLog:15
> +        * platform/chromium-win/fast/table/overflowHidden-expected.txt:
> +        The new result correctly adds the scrollbar width to the table cell intrinsic width.

Why is there no updated pixel result for this?

> LayoutTests/ChangeLog:25
> +        * scrollbars/custom-scrollbar-table-cell-expected.png:
> +        The new result correctly adds the scrollbar width to the table cell intrinsic width.

Is this test still testing what it's supposed to be testing?  Certainly the comment in the test about there being 2 grey scrollbars with a black thumb needs to be updated.
Comment 14 Ojan Vafai 2013-03-29 12:13:56 PDT
Comment on attachment 193975 [details]
Patch

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

>> LayoutTests/ChangeLog:15
>> +        The new result correctly adds the scrollbar width to the table cell intrinsic width.
> 
> Why is there no updated pixel result for this?

The elements that changed are below the fold, so they don't show up in the pixel dump.

>> LayoutTests/ChangeLog:25
>> +        The new result correctly adds the scrollbar width to the table cell intrinsic width.
> 
> Is this test still testing what it's supposed to be testing?  Certainly the comment in the test about there being 2 grey scrollbars with a black thumb needs to be updated.

Good catch. I'm pretty sure the new result is correct and the comment is wrong. Updated the comment.
Comment 15 Ojan Vafai 2013-03-29 12:15:46 PDT
Created attachment 195777 [details]
Patch
Comment 16 Tony Chang 2013-03-29 12:49:58 PDT
Comment on attachment 195777 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        min-width/max-width of min-content/max-content don't work correctly if the width set

"if the width set" is awkward.  Maybe "if width is specified"

> Source/WebCore/rendering/RenderBlock.cpp:5756
> +        // FIXME: Remove this const_casts.

Nit: const_casts -> const_cast

> LayoutTests/ChangeLog:15
> +        * platform/chromium-win/fast/table/overflowHidden-expected.txt:
> +        The new result correctly adds the scrollbar width to the table cell intrinsic width.

I would make a note why the pixel result isn't updated.
Comment 17 Ojan Vafai 2013-03-29 13:10:30 PDT
Committed r147245: <http://trac.webkit.org/changeset/147245>
Comment 18 Benjamin Poulain 2013-04-02 12:56:47 PDT
Committed r147488: <http://trac.webkit.org/changeset/147488>