Page MenuHomePhabricator

Bug 1322780 - Part 2: Support unprefixed min-content and max-content.
ClosedPublic

Authored by boris on Oct 2 2018, 8:12 PM.

Details

Summary

Support unprefixed min-content and max-content and treat the prefixed
version as aliases for

  1. width, min-width, max-width if inline-axis is horizontal, and
  2. height, min-height, max-height if inline-axis is vertical, and
  3. inline-size, min-inline-size, max-inline-size, and
  4. flex-basis.

Besides, update the test cases to use unprefixed max-content and
min-content.

Depends on D7535

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

boris created this revision.Oct 2 2018, 8:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 2 2018, 8:12 PM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Oct 2 2018, 8:12 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.
boris requested review of this revision.Oct 2 2018, 8:12 PM
boris added a reviewer: mats.Oct 2 2018, 8:13 PM
boris updated this revision to Diff 20794.Oct 2 2018, 8:17 PM
boris added a comment.Oct 2 2018, 8:22 PM

Basically, only

  1. layout/style/nsCSSKeywordList.h
  2. layout/style/nsCSSProps.cpp
  3. layout/style/nsStyleConsts.h
  4. servo/components/style/values/computed/length.rs

are needed for reviewing. The rest are just replacing -moz-max-content with max-content and -moz-min-content with min-content (in test files and comments).

mats accepted this revision.Oct 2 2018, 9:18 PM
mats added inline comments.
layout/reftests/flexbox/reftest.list
3–4

Just remove the "or -moz-max-content" altogether. Also, please file a follow-up bug to investigate if some of these tests that used -moz-max-content can be moved to the w3c-css reftest directory now.

This revision is now accepted and ready to land.Oct 2 2018, 9:18 PM
emilio added inline comments.Oct 2 2018, 10:41 PM
servo/components/style/values/computed/length.rs
988–991

Do we want to keep supporting the -moz- prefixed version as an alias? Have we done any research on whether these values are used with the unprefixed version as well, or do we not expect content to use them?

I'm fine trying to land this, but we should be eager to add the alias back if it causes any regression.

emilio added inline comments.Oct 2 2018, 10:43 PM
servo/components/style/values/computed/length.rs
988–991

Given chrome ships it unprefixed I guess it's worth a shot to avoid the alias.

boris marked an inline comment as done.Oct 2 2018, 10:53 PM
boris added inline comments.
servo/components/style/values/computed/length.rs
988–991

Given chrome ships it unprefixed I guess it's worth a shot to avoid the alias.

Or a safer way is add a pref for unprefixed version, so we keep both versions. This means that we need to implement the parser to accept the unprefiex version if the pref is enabled.

Yeah sorry I was missing the context from bugzilla. I'd prefer to avoid prefs if possible (in particular to hide the unprefixed value) because they need to affect not only parsing but serialization, but just so i understand what is exactly the proposed behavior?

  • Pref that toggles between prefixed and unprefixed.
  • Pref that hides the prefixed version.
  • Pref that hides the unprefixed one.

(1) and (3) are tricky because you need to either have extra enum variants and code handling it or switch in both parsing and serialization to prefix or not, and that includes the computed style serialization which uses the keyword tables. Not impossible, but not super excited about duplicating those tables just for this.

Re. (2) I think that is probably not worth guarding behind a pref...

boris added a comment.Oct 2 2018, 11:28 PM
  • Pref that toggles between prefixed and unprefixed.
  • Pref that hides the prefixed version.
  • Pref that hides the unprefixed one.

I think xidorn suggests (2) and (3) together, and mats suggests (3). The serialization could be a problem and I didn't notice it. So now, I prefer to adding the alias without any pref. I will update this patch by adding the alias, instead of the pref.

boris updated this revision to Diff 20861.Oct 3 2018, 12:49 AM
boris retitled this revision from Bug 1322780 - Part 2: Unprefix -moz-min-content and -moz-max-content to Bug 1322780 - Part 2: Support unprefixed min-content and max-content.
boris edited the summary of this revision. (Show Details)
boris marked 2 inline comments as done.Oct 3 2018, 12:56 AM
boris added inline comments.
layout/reftests/flexbox/reftest.list
3–4

Filed Bug 1495939

boris marked 3 inline comments as done.Oct 3 2018, 12:57 AM
boris added a reviewer: emilio.
This revision now requires review to proceed.Oct 3 2018, 12:58 AM
boris updated this revision to Diff 20895.Oct 3 2018, 5:02 AM
emilio accepted this revision.Oct 4 2018, 6:41 PM

This looks ok, code-wise, but I'd rather fix the computed value... Please ensure that there's a bug on file. Do you plan to fix it?

Also, landing a test for this given it looks like there's none would be great.

This revision is now accepted and ready to land.Oct 4 2018, 6:41 PM
boris added a comment.Oct 4 2018, 8:10 PM

This looks ok, code-wise, but I'd rather fix the computed value... Please ensure that there's a bug on file. Do you plan to fix it?

Also, landing a test for this given it looks like there's none would be great.

Filed Bug 1496558. I could take a look at it. If it is pretty easy, I could fix it ASAP before landing this bug. Besides, I will add a test for getComputedStyle() to make sure we get the correct results if using keywords. Thanks for this review.

boris planned changes to this revision.Oct 10 2018, 8:25 PM
mats added a comment.Oct 10 2018, 8:39 PM
In D7536#173929, @boris wrote:
  • Pref that toggles between prefixed and unprefixed.
  • Pref that hides the prefixed version.
  • Pref that hides the unprefixed one.

I think xidorn suggests (2) and (3) together, and mats suggests (3).

Actually, I said in comment 14 that I'm fine with just shipping the unprefixed values,
without a pref or -moz- variants. Chrome supports the unprefixed values, so I think
the web-compat risk is low. Shipping -moz- aliases is fine too though and slightly
lower risk. Adding a pref for this seems overkill to me.

boris added a comment.Oct 11 2018, 5:10 PM
In D7536#193084, @mats wrote:

Actually, I said in comment 14 that I'm fine with just shipping the unprefixed values,
without a pref or -moz- variants. Chrome supports the unprefixed values, so I think
the web-compat risk is low. Shipping -moz- aliases is fine too though and slightly
lower risk. Adding a pref for this seems overkill to me.

So now what I can do is "try to make sure we are ready to ship". i.e. Add more tests in block size dimension and finish Bug 1496558. Therefore, we could ship this without any concern.

boris updated this revision to Diff 39814.Nov 28 2018, 12:41 AM
boris retitled this revision from Bug 1322780 - Part 2: Support unprefixed min-content and max-content to Bug 1322780 - Part 2: Support unprefixed min-content and max-content..
This revision is now accepted and ready to land.Nov 28 2018, 12:41 AM
boris updated this revision to Diff 40810.Nov 29 2018, 11:27 PM
boris edited the summary of this revision. (Show Details)
boris updated this revision to Diff 41247.Nov 30 2018, 9:05 PM
boris added a comment.Nov 30 2018, 9:07 PM

Only did rebase and updated wpt because some tests are unexpected pass after the rebase.

boris added a comment.Nov 30 2018, 9:10 PM

This version still use alias and doesn't use pref.

Code analysis found 4 defects in this patch:

  • 4 defects found by clang-format

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects: https://queue.taskcluster.net/v1/task/TofS2t1URN6D6tsbDQShLQ/runs/0/artifacts/public/results/clang-format-PHID-DIFF-suqtfkikhoell4rkload.diff (use it in your repository with hg import or git apply)

If you see a problem in this automated review, please report it here: https://bit.ly/2IyNRy2

layout/style/nsCSSProps.cpp
422–427

Warning: Incorrect coding style [clang-format]

430–436

Warning: Incorrect coding style [clang-format]

layout/tables/BasicTableLayoutStrategy.cpp
167–168

Warning: Incorrect coding style [clang-format]

191–192

Warning: Incorrect coding style [clang-format]

boris updated this revision to Diff 41255.Nov 30 2018, 9:33 PM
boris marked 2 inline comments as done.Nov 30 2018, 9:34 PM
boris updated this revision to Diff 41259.Nov 30 2018, 9:45 PM
boris marked 2 inline comments as done.Nov 30 2018, 9:46 PM

Code analysis found 4 defects in this patch:

  • 4 defects found by clang-format

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects: https://queue.taskcluster.net/v1/task/YwengBkTTFKdQdJgOjGqKg/runs/0/artifacts/public/results/clang-format-PHID-DIFF-pnzusgbeutc5xz6eyzgj.diff (use it in your repository with hg import or git apply)

If you see a problem in this automated review, please report it here: https://bit.ly/2IyNRy2

layout/style/nsCSSProps.cpp
422–427

Warning: Incorrect coding style [clang-format]

430–436

Warning: Incorrect coding style [clang-format]

layout/tables/BasicTableLayoutStrategy.cpp
167–168

Warning: Incorrect coding style [clang-format]

191–192

Warning: Incorrect coding style [clang-format]

boris marked 4 inline comments as done.Nov 30 2018, 10:42 PM
boris updated this revision to Diff 45598.Dec 18 2018, 6:47 PM
boris edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.