Last Comment Bug 695222 - Implement column-fill property of CSS3 spec
: Implement column-fill property of CSS3 spec
Status: RESOLVED DUPLICATE of bug 764567
[qa+]
: dev-doc-complete
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla14
Assigned To: Scott Johnson (:jwir3)
:
Mentors:
http://www.w3.org/TR/css3-multicol/#cf
Depends on: 733808 722888 731516 733614 CVE-2012-1940
Blocks: 684062 698783 459597 569193
  Show dependency treegraph
 
Reported: 2011-10-17 16:20 PDT by Scott Johnson (:jwir3)
Modified: 2012-06-13 13:58 PDT (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
wontfix
wontfix
wontfix
wontfix
affected


Attachments
b695222 (11.83 KB, patch)
2011-11-28 18:25 PST, Scott Johnson (:jwir3)
no flags Details | Diff | Splinter Review
b695222 (v2) (12.64 KB, patch)
2011-11-30 15:35 PST, Scott Johnson (:jwir3)
dbaron: review-
Details | Diff | Splinter Review
TEST CASE (447.30 KB, text/html)
2011-12-01 13:37 PST, Scott Johnson (:jwir3)
no flags Details
b695222 (v3) (14.95 KB, patch)
2011-12-07 15:43 PST, Scott Johnson (:jwir3)
dbaron: review+
Details | Diff | Splinter Review
b695222 (v4) [r=dbaron] (14.86 KB, patch)
2011-12-07 20:09 PST, Scott Johnson (:jwir3)
no flags Details | Diff | Splinter Review
b695222 (v5) [r=dbaron] (39.38 KB, patch)
2011-12-19 14:17 PST, Scott Johnson (:jwir3)
roc: review+
Details | Diff | Splinter Review

Description Scott Johnson (:jwir3) 2011-10-17 16:20:54 PDT
Currently, the column-fill property, as specified in http://www.w3.org/TR/css3-multicol/#cf is not implemented by Gecko. In order to become fully compliant with this spec, we should implement the flow behavior as specified.

A reftest for the expected behavior has already been written as part of a patch to bug 684062.
Comment 1 Scott Johnson (:jwir3) 2011-11-28 18:25:18 PST
Created attachment 577455 [details] [diff] [review]
b695222

Hopefully I'm on the right track here.
Comment 2 Scott Johnson (:jwir3) 2011-11-28 18:26:57 PST
Also, this is the prefixed form of this, but it'll be unprefixed when bug 698783 is finished.
Comment 3 Robert O'Callahan (:roc) (email my personal email if necessary) 2011-11-29 15:37:47 PST
Comment on attachment 577455 [details] [diff] [review]
b695222

Review of attachment 577455 [details] [diff] [review]:
-----------------------------------------------------------------

Also, get dbaron's review on the style system changes.

::: dom/interfaces/css/nsIDOMCSS2Properties.idl
@@ +534,5 @@
>  
>             attribute DOMString        MozColumnGap;
>                                          // raises(DOMException) on setting
>  
> +           attribute DOMString        MozColumnFill;

Rev UUID on interface

::: layout/generic/nsColumnSetFrame.cpp
@@ +422,4 @@
>    // NOTE that the non-balancing behavior for non-auto computed height
>    // is not in the CSS3 columns draft as of 18 January 2001
> +  if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
> +      || aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {

I think we should check computed max-height as well. If height is not auto OR max-height is not 'none' then we should consider the column-length to be constrained. The spec is unclear and I've asked Hakon to clarify.
Comment 4 Scott Johnson (:jwir3) 2011-11-30 15:35:40 PST
Created attachment 578114 [details] [diff] [review]
b695222 (v2)

(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #3)
> Also, get dbaron's review on the style system changes.

Added dbaron as a reviewer.

> Rev UUID on interface

Done.

> I think we should check computed max-height as well. If height is not auto
> OR max-height is not 'none' then we should consider the column-length to be
> constrained. The spec is unclear and I've asked Hakon to clarify.

Ok, I added logic for this. I believe this is what you were asking for, but please let me know if I did this incorrectly.
Comment 5 Robert O'Callahan (:roc) (email my personal email if necessary) 2011-11-30 17:28:08 PST
Comment on attachment 578114 [details] [diff] [review]
b695222 (v2)

Review of attachment 578114 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/generic/nsColumnSetFrame.cpp
@@ +422,5 @@
>    // NOTE that the non-balancing behavior for non-auto computed height
>    // is not in the CSS3 columns draft as of 18 January 2001
> +  if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
> +      || aReflowState.ComputedHeight() == NS_INTRINSICSIZE
> +      || aReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE) {

I don't think this is right. If the max-height != NS_UNCONSTRAINEDSIZE, then the column length is constrained so we should respect COLUMN_FILL_AUTO.
Comment 6 Scott Johnson (:jwir3) 2011-12-01 13:37:41 PST
Created attachment 578376 [details]
TEST CASE

(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #5)

> I don't think this is right. If the max-height != NS_UNCONSTRAINEDSIZE, then
> the column length is constrained so we should respect COLUMN_FILL_AUTO.

So the test case I've posted works with the conditional as I had originally added it. However, I do agree that the logic seems incorrect. If I make the conditional:

  if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
      || aReflowState.ComputedHeight() == NS_INTRINSICSIZE
      || aReflowState.mComputedMaxHeight == NS_UNCONSTRAINEDSIZE) {

Then, this results in 'with column-fill: auto and constrained height' being rendered incorrectly. It appears as the 'with column-fill: balance and constrained height' appears in the expected results of the test case.

I also have a question about whether the behavior is correct for 'with column-fill: balance and constrained height'. It seems as though the div containing the column box is large (obviously because it has a specified height), but the text is balanced correctly. I'm not sure how to resolve this discrepancy - the height of the column frame is specified explicitly, so it doesn't seem like it should be overridden. Thoughts on this?
Comment 7 Scott Johnson (:jwir3) 2011-12-01 13:46:49 PST
(In reply to Scott Johnson (:jwir3) from comment #6)
> Created attachment 578376 [details]
> TEST CASE
> 
> (In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #5)
> 
> > I don't think this is right. If the max-height != NS_UNCONSTRAINEDSIZE, then
> > the column length is constrained so we should respect COLUMN_FILL_AUTO.
> 
> So the test case I've posted works with the conditional as I had originally
> added it. However, I do agree that the logic seems incorrect. If I make the
> conditional:
> 
>   if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
>       || aReflowState.ComputedHeight() == NS_INTRINSICSIZE
>       || aReflowState.mComputedMaxHeight == NS_UNCONSTRAINEDSIZE) {
> 
> Then, this results in 'with column-fill: auto and constrained height' being
> rendered incorrectly. It appears as the 'with column-fill: balance and
> constrained height' appears in the expected results of the test case.

I think I have the logic incorrect. I think it should be something like:
  if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
      || (aReflowState.ComputedHeight() == NS_INTRINSICSIZE
          && aReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE))
Comment 8 Scott Johnson (:jwir3) 2011-12-01 13:48:00 PST
(In reply to Scott Johnson (:jwir3) from comment #7)

> I think I have the logic incorrect. I think it should be something like:
>   if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
>       || (aReflowState.ComputedHeight() == NS_INTRINSICSIZE
>           && aReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE))

Oops, I meant:
  if (colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
      || (aReflowState.ComputedHeight() == NS_INTRINSICSIZE
          && aReflowState.mComputedMaxHeight == NS_UNCONSTRAINEDSIZE))
Comment 9 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-12-01 14:05:17 PST
Comment on attachment 578114 [details] [diff] [review]
b695222 (v2)

As far as the style system changes go:

You should make appropriate additions to layout/style/test/property_database.js and then get the mochitests in layout/style/ to pass.  I'd note that you're at the very least missing a piece of the code you need to add in nsRuleNode to handle Inherit/Initial, which you should probably just use SetDiscrete for.  You might also be missing other pieces, but the tests should help with that.
Comment 10 Scott Johnson (:jwir3) 2011-12-07 15:43:08 PST
Created attachment 579877 [details] [diff] [review]
b695222 (v3)

(In reply to David Baron [:dbaron] from comment #9)
> You should make appropriate additions to
> layout/style/test/property_database.js and then get the mochitests in
> layout/style/ to pass.  

Ok, I did this. They all appear to be passing for me now.

> I'd note that you're at the very least missing a
> piece of the code you need to add in nsRuleNode to handle Inherit/Initial,
> which you should probably just use SetDiscrete for.  You might also be
> missing other pieces, but the tests should help with that.

I replaced the chunk I had in nsRuleNode for this with SetDiscrete. as you advised, however, I'm unsure about the last 4 parameters that I'm passing in. If you could verify these are correct, then I think this should work as expected now.
Comment 11 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-12-07 15:58:01 PST
Comment on attachment 579877 [details] [diff] [review]
b695222 (v3)

>diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp

>+  // column-fill: enum
>+  SetDiscrete(*aRuleData->ValueForColumnFill(),
>+                column->mColumnFill, canStoreInRuleTree,
>+                SETDSC_ENUMERATED, parent->mColumnFill,
>+                NS_STYLE_COLUMN_FILL_BALANCE, NS_STYLE_COLUMN_FILL_AUTO,
>+                0, 0, 0);

The last four values only do anything if you use flags other than SETDSC_ENUMERATED, so you should just make the last 4 all 0.

>diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h

>   PRUint32     mColumnCount; // [reset] see nsStyleConsts.h
>   nsStyleCoord mColumnWidth; // [reset] coord, auto
>   nsStyleCoord mColumnGap;   // [reset] coord, normal
>+  PRUint8      mColumnFill;  // [reset] see nsStyleConsts.h
> 
>   nscolor      mColumnRuleColor;  // [reset]
>   PRUint8      mColumnRuleStyle;  // [reset]
>+

Probably best (For struct packing) to put mColumnFill after mColumnRuleStyle, so you have two PRUint8 values together.

>diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js

This file uses tabs.  Sorry.  You should match the rest.


r=dbaron with that
Comment 12 Scott Johnson (:jwir3) 2011-12-07 20:09:58 PST
Created attachment 579953 [details] [diff] [review]
b695222 (v4) [r=dbaron]

Fixed the issues raised by dbaron in the last comment. Requesting re-review of the layout stuff.
Comment 13 Robert O'Callahan (:roc) (email my personal email if necessary) 2011-12-07 20:14:45 PST
Comment on attachment 579953 [details] [diff] [review]
b695222 (v4) [r=dbaron]

Review of attachment 579953 [details] [diff] [review]:
-----------------------------------------------------------------

You need to add something to nsStyleColumn::CalcDifference to reflow when column-fill changes.

We'll need reftests covering that, and the other basic cases for column-fill (e.g. making sure it behaves correctly when height is constrained).
Comment 14 Robert O'Callahan (:roc) (email my personal email if necessary) 2011-12-13 12:46:34 PST
Sounds like Hakon is leaning towards removing the language about column-fill only applying in certain cases. So you can remove that from your patch.
Comment 15 Scott Johnson (:jwir3) 2011-12-19 14:17:12 PST
Created attachment 582956 [details] [diff] [review]
b695222 (v5) [r=dbaron]

Made suggested changes to CalculateDifference and added unit tests.
Comment 16 Scott Johnson (:jwir3) 2011-12-25 23:12:27 PST
Pushed to inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/93b804e5f3f5
Comment 17 Ed Morley [:emorley] 2011-12-26 18:00:40 PST
https://hg.mozilla.org/mozilla-central/rev/93b804e5f3f5
Comment 19 Daniel Holbert [:dholbert] 2012-01-25 16:54:49 PST
My flexbox code touches a chunk of code that this bug added (since column-* properties compute to their initial values on a flexbox), and I noticed that there was some extra indentation.  I figured I'd fix the indentation as an atomic followup-cset on this bug rather than as part of flexbox.  Pushed indentation-fix (as whitespace-only/DONTBUILD):
 https://hg.mozilla.org/integration/mozilla-inbound/rev/5343959472c8
Comment 20 Ed Morley [:emorley] 2012-01-26 04:35:27 PST
https://hg.mozilla.org/mozilla-central/rev/5343959472c8
Comment 21 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-04-22 08:31:15 PDT
Looks like this was backed out with https://hg.mozilla.org/releases/mozilla-beta/rev/fe494e9c9714, so the docs will need to be updated.
Comment 22 Jean-Yves Perrier [:teoli] 2012-04-22 13:03:38 PDT
khuey: thx, I missed that point. Do you know if it may be backed out from Beta13 too?
Comment 23 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-04-22 13:07:26 PDT
That's possible, if the regressions are not fixed.  Scott could give a better assessment than me of how likely that is.
Comment 24 Scott Johnson (:jwir3) 2012-04-22 13:13:02 PDT
I'm trying to get this regression fixed in 13, but I'm not sure whether it will get completed soon enough. it's probably a 50-50 chance it will be in 13.
Comment 25 Jean-Yves Perrier [:teoli] 2012-04-23 10:04:43 PDT
The doc was up-to-date (fx 13), so I probably noticed the backout but didn't changed the target version here.

Scott: thx, could you change the keyword here to dev-doc-needed if it happens (or add dev-doc-needed on the backout bug) so that we track it in the doc.

(I'm a big fan of CSS3 Columns, I would like to have column-span and the breaking values for the MDN :-) — we use it for the index and may use it for some 2-column landing page but need to control the breaking between sections )
Comment 26 Scott Johnson (:jwir3) 2012-04-23 11:16:55 PDT
(In reply to Jean-Yves Perrier [:teoli] from comment #25)
> The doc was up-to-date (fx 13), so I probably noticed the backout but didn't
> changed the target version here.
> 
> Scott: thx, could you change the keyword here to dev-doc-needed if it
> happens (or add dev-doc-needed on the backout bug) so that we track it in
> the doc.
> 

Sure thing.

> (I'm a big fan of CSS3 Columns, I would like to have column-span and the
> breaking values for the MDN :-) — we use it for the index and may use it for
> some 2-column landing page but need to control the breaking between sections
> )

Cool. Yeah, I'm working on it. :) Gotta get column-fill right, first, though. ;)
Comment 27 Scott Johnson (:jwir3) 2012-04-25 09:17:30 PDT
This was backed out of Fx13.
Comment 28 Eric Shepherd [:sheppy] 2012-04-27 17:38:01 PDT
Removing doc-needed; please place it on whatever bug covers re-landing this.
Comment 29 j.j. 2012-04-28 02:26:12 PDT
I'm confused.
If this was backed out of Fx13, at least 
https://developer.mozilla.org/en/CSS/column-fill and
https://developer.mozilla.org/en/Firefox_13_for_developers
need to change, therefore the dev-doc-needed keyword, no?

And the status flags are confusing. Why is this fixed in Fx12 and 13 when it was backed out?
Comment 30 Jean-Yves Perrier [:teoli] 2012-04-28 08:32:15 PDT
Sorry, my bad I should have reacted quickly.

I fixed the two pages and Fx 14 for developers.

Currently both our team and the PMM team have problems to track what is being backed out in the Aurora and Beta phase (as often the back-out happens in a separate bug that is not followed by any of the two teams, and has a cryptic title).

So when a back-out occurs on something that has or need to be documented, the dev-doc-needed must be added on the back-out bug (which must have a link to the original bug so that we can easily find it!), or at least on the original bug (like here), though the second case may lead to some confusion. 

That way we can update Firefox XY for developers that are now often done before the documentation per se.

Sorry for the confusion. (And as the back-out of Fx 13 has been handled in regard to the documentation I switch again the flag :-) ). 

:-)
Comment 31 Daniel Veditz [:dveditz] 2012-05-01 14:44:02 PDT
The date of the beta backout, March 30, means Firefox 12 should still have the bug
http://hg.mozilla.org/releases/mozilla-beta/rev/fe494e9c9714

According to comment 27 it was also backed out of Firefox 13. Unless there have been additional backouts this should still be fixed on 14 and later. Adjusting the status flags to match that understanding, the opposite of how they were set. Maybe Scott was thinking of the regression bug 733614 when he was setting them.
Comment 32 Scott Johnson (:jwir3) 2012-06-13 12:05:09 PDT
Backed this out on mozilla central (currently firefox 16) due to bug 733614:
https://hg.mozilla.org/mozilla-central/rev/aeaa00b5cab5
https://hg.mozilla.org/mozilla-central/rev/00244ceddd42

This will not be fixed until at least Firefox 16.
Comment 33 Scott Johnson (:jwir3) 2012-06-13 13:58:42 PDT
I opened another bug to track remaining issues with column fill.

*** This bug has been marked as a duplicate of bug 764567 ***

Note You need to log in before you can comment on or make changes to this bug.