Bug 65159 - column-count: 0 should not prevent margin-collapse through
Summary: column-count: 0 should not prevent margin-collapse through
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tab Atkins
URL:
Keywords:
Depends on: 98557
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-25 19:57 PDT by Philippe Wittenbergh
Modified: 2012-10-10 19:26 PDT (History)
13 users (show)

See Also:


Attachments
test case (requires Ahem font) (503 bytes, text/html)
2011-07-25 19:57 PDT, Philippe Wittenbergh
no flags Details
Patch (4.95 KB, patch)
2012-10-08 12:48 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff
Patch for landing (4.94 KB, patch)
2012-10-08 13:29 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff
Patch for landing (5.49 KB, patch)
2012-10-08 14:25 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff
Patch for landing (5.49 KB, patch)
2012-10-08 14:33 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff
Patch for landing (5.48 KB, patch)
2012-10-08 14:50 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff
Patch for landing (5.48 KB, patch)
2012-10-08 18:16 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff
Patch (5.46 KB, patch)
2012-10-10 15:12 PDT, Tab Atkins
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Wittenbergh 2011-07-25 19:57:59 PDT
Created attachment 101962 [details]
test case (requires Ahem font)

Since bug 64975, -webkit-column-count: 0 incorrectly prevents collapsing of margins of children with the margins of the parent (multi-col) element.

The spec says (for column-count): "Values must be greater than 0"
http://dev.w3.org/csswg/css3-multicol/#cc

-webkit-column-count: 0 is then invalid and should be ignored.

Test case: there should be no red, and 20px space between the 3 blocks.

Opera 11.5 and Gecko 1.9.2+ handle this correctly.
Comment 1 Tab Atkins 2012-10-08 12:48:23 PDT
Created attachment 167590 [details]
Patch
Comment 2 Tab Atkins 2012-10-08 12:50:20 PDT
Heya eseidel, I moved my work from bug 98557 to here, and fixed this bug with it.
Comment 3 Eric Seidel (no email) 2012-10-08 13:15:02 PDT
Comment on attachment 167590 [details]
Patch

Fantastic.
Comment 4 Tony Chang 2012-10-08 13:18:45 PDT
Comment on attachment 167590 [details]
Patch

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

> Source/WebCore/css/CSSParser.cpp:2444
> -            validPrimitive = !id && validUnit(value, FInteger | FNonNeg, CSSQuirksMode);
> +            validPrimitive = !id && validUnit(value, FInteger | FPositive, CSSQuirksMode);

I would just use FNonNeg and also check that !value->fValue.  We do that in other parts of the code (see parseAspectRatio) and it's a little weird that you could pass FNonNeg | FPositive to validUnit.
Comment 5 Tab Atkins 2012-10-08 13:25:32 PDT
(In reply to comment #4)
> (From update of attachment 167590 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=167590&action=review
> 
> > Source/WebCore/css/CSSParser.cpp:2444
> > -            validPrimitive = !id && validUnit(value, FInteger | FNonNeg, CSSQuirksMode);
> > +            validPrimitive = !id && validUnit(value, FInteger | FPositive, CSSQuirksMode);
> 
> I would just use FNonNeg and also check that !value->fValue.  We do that in other parts of the code (see parseAspectRatio) and it's a little weird that you could pass FNonNeg | FPositive to validUnit.

That's not too weird.  You're just imposing two restrictions, one of which is a subset of the other.  It's no weirder than the fact that you can pass FInteger | FNumber to it (same thing).

I'd prefer to switch the other parts of the code over to FPositive, actually.  It's nice and clear!

Re: parseAspectRatio, whoops, the unofficial spec (my blog post) is imposing a bad restriction.  We purposely avoid open-ended ranges whenever possible, because they expose rounding behavior.  If this actually passed through the CSSWG, that would have been flagged and we would have found another way around it.
Comment 6 Tab Atkins 2012-10-08 13:29:09 PDT
Created attachment 167597 [details]
Patch for landing
Comment 7 Tony Chang 2012-10-08 14:14:50 PDT
Comment on attachment 167597 [details]
Patch for landing

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

> That's not too weird.  You're just imposing two restrictions, one of which is a subset of the other.  It's no weirder than the fact that you can pass FInteger | FNumber to it (same thing).

You're right, it's no weirder than what we already do.

> Source/WebCore/css/CSSParser.cpp:1572
> +        // FPositive only defines a closed range when the value is an integer.
> +        ASSERT(FInteger);

This assert doesn't do anything. FInteger is just an enum value. I think you mean unitflags & FInteger.  It would be more clear to just have the flag be FPositiveInteger or something if that's what you want.
Comment 8 Tab Atkins 2012-10-08 14:25:09 PDT
Created attachment 167607 [details]
Patch for landing
Comment 9 Tab Atkins 2012-10-08 14:26:32 PDT
(In reply to comment #7)
> > Source/WebCore/css/CSSParser.cpp:1572
> > +        // FPositive only defines a closed range when the value is an integer.
> > +        ASSERT(FInteger);
> 
> This assert doesn't do anything. FInteger is just an enum value. I think you mean unitflags & FInteger.

Oh, duh.  Sorry about that.

> It would be more clear to just have the flag be FPositiveInteger or something if that's what you want.

Good idea.  I've done so.
Comment 10 WebKit Review Bot 2012-10-08 14:27:04 PDT
Attachment 167607 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1
Source/WebCore/css/CSSParser.cpp:1571:  One line control clauses should not use braces.  [whitespace/braces] [4]
Source/WebCore/css/CSSParser.h:530:  One space before end of line comments  [whitespace/comments] [5]
Total errors found: 2 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Tab Atkins 2012-10-08 14:27:18 PDT
Comment on attachment 167607 [details]
Patch for landing

Whoops, sorry, messed up.  One sec.
Comment 12 Gyuyoung Kim 2012-10-08 14:30:44 PDT
Comment on attachment 167607 [details]
Patch for landing

Attachment 167607 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/14214461
Comment 13 kov's GTK+ EWS bot 2012-10-08 14:32:53 PDT
Comment on attachment 167607 [details]
Patch for landing

Attachment 167607 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/14223380
Comment 14 Tab Atkins 2012-10-08 14:33:07 PDT
Created attachment 167611 [details]
Patch for landing
Comment 15 Tab Atkins 2012-10-08 14:33:53 PDT
(In reply to comment #14)
> Created an attachment (id=167611) [details]
> Patch for landing

All right, ready to go.  Amended with Tony's suggestions, and properly building.
Comment 16 WebKit Review Bot 2012-10-08 14:36:11 PDT
Attachment 167611 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1
Source/WebCore/css/CSSParser.cpp:1571:  One line control clauses should not use braces.  [whitespace/braces] [4]
Source/WebCore/css/CSSParser.h:530:  One space before end of line comments  [whitespace/comments] [5]
Total errors found: 2 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Tab Atkins 2012-10-08 14:50:34 PDT
Created attachment 167620 [details]
Patch for landing
Comment 18 Tab Atkins 2012-10-08 14:51:18 PDT
(In reply to comment #17)
> Created an attachment (id=167620) [details]
> Patch for landing

Ugh, I didn't realize land-safely didn't run style checks.  Bleh.  Anyway, it now makes the stylechecker happy.
Comment 19 Eric Seidel (no email) 2012-10-08 14:55:41 PDT
If you'd like land-safely to run the style checks, it shoudl be easy to fix.  Just file a bug and CC me.

http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/tool/commands/upload.py#L224
http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/tool/steps/checkstyle.py
Comment 20 Tab Atkins 2012-10-08 18:16:28 PDT
Created attachment 167663 [details]
Patch for landing
Comment 21 Tab Atkins 2012-10-08 18:17:22 PDT
(In reply to comment #20)
> Created an attachment (id=167663) [details]
> Patch for landing

The bots have cycled around 6 times, and still claim that this patch makes ten thousand tests fail, all across WebKit.  Let's see if prodding them again helps any.
Comment 22 Tony Chang 2012-10-09 10:17:00 PDT
Comment on attachment 167663 [details]
Patch for landing

Looks like this causes a bunch of column tests to fail.
Comment 23 Tony Chang 2012-10-09 10:17:44 PDT
From the cr-linux ews bot:

Regressions: Unexpected image and text failures : (14)
  fast/line-grid/line-grid-inside-columns.html [ Failure ] 
  fast/line-grid/line-grid-into-columns.html [ Failure ] 
  fast/multicol/border-padding-pagination.html [ Failure ] 
  fast/multicol/client-rects.html [ Failure ] 
  fast/multicol/column-break-with-balancing.html [ Failure ] 
  fast/multicol/column-count-with-rules.html [ Failure ] 
  fast/multicol/column-rules-stacking.html [ Failure ] 
  fast/multicol/column-rules.html [ Failure ] 
  fast/multicol/columns-shorthand-parsing.html [ Failure ] 
  fast/multicol/flipped-blocks-border-after.html [ Failure ] 
  fast/multicol/span/anonymous-before-child-parent-crash.html [ Failure ] 
  fast/multicol/span/anonymous-split-block-crash.html [ Failure ] 
  fast/multicol/span/anonymous-style-inheritance.html [ Failure ] 
  fast/multicol/span/before-child-anonymous-column-block.html [ Failure ]
Comment 24 Tab Atkins 2012-10-09 10:31:53 PDT
(In reply to comment #22)
> (From update of attachment 167663 [details])
> Looks like this causes a bunch of column tests to fail.

Yeah, I don't see how, though.  :/

I'll dig into it tomorrow and see what's up - doing spec work today with fantasai.
Comment 25 Build Bot 2012-10-10 09:39:19 PDT
Comment on attachment 167663 [details]
Patch for landing

Attachment 167663 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14244632

New failing tests:
fast/multicol/span/before-child-anonymous-column-block.html
fast/css/remove-shorthand.html
compositing/geometry/composited-in-columns.html
fast/forms/number/number-spinbutton-in-multi-column.html
fast/multicol/span/span-as-immediate-child-property-removal.html
fast/multicol/span/anonymous-split-block-crash.html
fast/multicol/span/span-as-immediate-columns-child-removal.html
fast/line-grid/line-grid-inside-columns.html
fast/multicol/border-padding-pagination.html
fast/multicol/span/anonymous-style-inheritance.html
fast/multicol/span/span-as-immediate-child-generated-content.html
fast/multicol/span/span-as-immediate-columns-child.html
fast/multicol/span/span-as-nested-columns-child-dynamic.html
fast/line-grid/line-grid-into-columns.html
fast/multicol/span/clone-anonymous-block-non-inline-child-crash.html
fast/multicol/span/anonymous-before-child-parent-crash.html
fast/multicol/span/span-as-immediate-columns-child-dynamic.html
fast/multicol/span/generated-child-split-flow-crash.html
fast/dom/Element/getBoundingClientRect.html
fast/events/document-elementFromPoint.html
fast/forms/range/slider-in-multi-column.html
fast/multicol/span/span-as-nested-inline-block-child.html
fast/forms/select/listbox-in-multi-column.html
fast/multicol/span/span-as-immediate-child-complex-splitting.html
fast/loader/javascript-url-in-object.html
fast/block/float/float-not-removed-from-next-sibling4.html
fast/multicol/span/span-as-nested-columns-child.html
fast/multicol/break-properties.html
Comment 26 WebKit Review Bot 2012-10-10 10:05:01 PDT
Comment on attachment 167663 [details]
Patch for landing

Attachment 167663 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14260074

New failing tests:
fast/multicol/hit-test-float.html
fast/css/remove-shorthand.html
fast/multicol/flipped-blocks-border-after.html
fast/forms/number/number-spinbutton-in-multi-column.html
fast/multicol/span/anonymous-before-child-parent-crash.html
fast/multicol/client-rects.html
fast/line-grid/line-grid-inside-columns.html
fast/forms/range/slider-delete-while-dragging-thumb.html
fast/multicol/float-truncation.html
fast/multicol/hit-test-end-of-column.html
fast/multicol/border-padding-pagination.html
fast/line-grid/line-grid-into-columns.html
fast/multicol/column-break-with-balancing.html
fast/forms/range/slider-mouse-events.html
fast/dom/Element/getBoundingClientRect.html
fast/multicol/column-rules-stacking.html
fast/events/document-elementFromPoint.html
fast/forms/range/slider-in-multi-column.html
http/tests/xmlhttprequest/web-apps/001.html
fast/multicol/image-inside-nested-blocks-with-border.html
fast/multicol/hit-test-end-of-column-with-line-height.html
fast/frames/frame-limit.html
fast/forms/select/listbox-in-multi-column.html
fast/multicol/inherit-column-values.html
fast/multicol/column-count-with-rules.html
fast/multicol/columns-shorthand-parsing.html
fast/multicol/column-rules.html
fast/forms/range/slider-onchange-event.html
fast/loader/local-CSS-from-local.html
fast/multicol/break-properties.html
Comment 27 Tab Atkins 2012-10-10 15:12:12 PDT
Created attachment 168076 [details]
Patch
Comment 28 Tab Atkins 2012-10-10 15:15:54 PDT
Comment on attachment 168076 [details]
Patch

Figured out what was wrong - I was modelling my addition after FNonNegative, but that's wrong - that's intended as a check done *after* you've already done the "type" checks.

Instead, I should have modelled it after FInteger, which is a type check itself.

My earlier patches worked because I didn't remove the type check (I just added FNonZero to the existing FInteger type check), so the layering was okay.  When I removed FInteger, we were left with *no* type check, and the conditional structure I was using then wouldn't run the FPositiveInteger check.
Comment 29 WebKit Review Bot 2012-10-10 19:26:40 PDT
Comment on attachment 168076 [details]
Patch

Clearing flags on attachment: 168076

Committed r130997: <http://trac.webkit.org/changeset/130997>
Comment 30 WebKit Review Bot 2012-10-10 19:26:45 PDT
All reviewed patches have been landed.  Closing bug.