Bug 167000 - Support min() and max() in calc()
Summary: Support min() and max() in calc()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
: 143515 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-01-12 16:47 PST by Myles C. Maxfield
Modified: 2019-04-30 07:53 PDT (History)
13 users (show)

See Also:


Attachments
WIP (28.79 KB, patch)
2017-01-12 17:41 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
parsing half works now (30.84 KB, patch)
2017-08-15 13:05 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews112 for mac-elcapitan (647.25 KB, application/zip)
2017-08-15 15:03 PDT, Build Bot
no flags Details
fix tests; parse n>2 min()/max() items (31.77 KB, patch)
2017-08-15 16:42 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (61.75 KB, patch)
2017-09-13 12:17 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-elcapitan (1.53 MB, application/zip)
2017-09-13 13:33 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (1.85 MB, application/zip)
2017-09-13 13:40 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-elcapitan (2.21 MB, application/zip)
2017-09-13 13:46 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-wk2 (1.41 MB, application/zip)
2017-09-13 14:02 PDT, Build Bot
no flags Details
Patch (64.92 KB, patch)
2017-09-15 00:48 PDT, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2017-01-12 16:47:57 PST
The CSSWG just resolved to add these.
Comment 1 Myles C. Maxfield 2017-01-12 17:41:26 PST
Created attachment 298742 [details]
WIP
Comment 2 Radar WebKit Bug Importer 2017-01-23 15:25:10 PST
<rdar://problem/30153481>
Comment 3 Tim Horton 2017-08-15 13:05:45 PDT
Created attachment 318155 [details]
parsing half works now
Comment 4 Build Bot 2017-08-15 13:07:28 PDT
Attachment 318155 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:9:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Build Bot 2017-08-15 15:03:57 PDT
Comment on attachment 318155 [details]
parsing half works now

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

Number of test failures exceeded the failure limit.
Comment 6 Build Bot 2017-08-15 15:03:58 PDT
Created attachment 318180 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 7 Tim Horton 2017-08-15 16:42:24 PDT
Created attachment 318198 [details]
fix tests; parse n>2 min()/max() items
Comment 8 Dean Jackson 2017-08-15 22:28:40 PDT
Is this for review? Or did it land?
Comment 9 Dean Jackson 2017-08-15 22:29:35 PDT
I don't see a commit, so I guess not.
Comment 10 Tim Horton 2017-08-15 22:40:07 PDT
Not yet. Needs tests! And probably some cleanup. It's more of a [WIP] than anything, I was just pushing it along.
Comment 11 Dean Jackson 2017-08-15 22:40:08 PDT
Comment on attachment 318198 [details]
fix tests; parse n>2 min()/max() items

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

> Source/WebCore/ChangeLog:9
> +        No new tests... yet.

I guess this is why there isn't a review :)

> Source/WebCore/css/CSSCalculationValue.cpp:552
> +            if (m_children.isEmpty())
> +                return CSSPrimitiveValue::CSS_UNKNOWN;

Can this ever happen?

> Source/WebCore/platform/CalculationValue.cpp:102
> +        if (m_children.isEmpty())
> +            return std::numeric_limits<float>::quiet_NaN();

Can this happen?

You have ASSERT(!childExpressions.isEmpty()); above, as well as this in the parser:

if (!parseValueTerm(innerRange, depth, &value))
      return false;


Maybe we should fail elsewhere too?
Comment 12 Darin Adler 2017-08-28 17:27:23 PDT
Comment on attachment 318198 [details]
fix tests; parse n>2 min()/max() items

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

> Source/WebCore/platform/CalculationValue.h:228
> -inline bool operator==(const CalcExpressionBinaryOperation& a, const CalcExpressionBinaryOperation& b)
> +inline bool operator==(const CalcExpressionOperation& a, const CalcExpressionOperation& b)
>  {
>      return a.getOperator() == b.getOperator() && a.leftSide() == b.leftSide() && a.rightSide() == b.rightSide();
>  }

The implementation of this function doesn’t seem right any more.
Comment 13 Tim Horton 2017-08-28 18:33:28 PDT
(In reply to Darin Adler from comment #12)
> Comment on attachment 318198 [details]
> fix tests; parse n>2 min()/max() items
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=318198&action=review
> 
> > Source/WebCore/platform/CalculationValue.h:228
> > -inline bool operator==(const CalcExpressionBinaryOperation& a, const CalcExpressionBinaryOperation& b)
> > +inline bool operator==(const CalcExpressionOperation& a, const CalcExpressionOperation& b)
> >  {
> >      return a.getOperator() == b.getOperator() && a.leftSide() == b.leftSide() && a.rightSide() == b.rightSide();
> >  }
> 
> The implementation of this function doesn’t seem right any more.

Not even slightly.
Comment 14 Alan Stearns 2017-09-04 14:01:16 PDT
Please consider adding tests to WPT for this, (instead of|in addition to) WebKit-specific tests.
Comment 15 Tim Horton 2017-09-13 11:43:45 PDT
(In reply to Alan Stearns from comment #14)
> Please consider adding tests to WPT for this, (instead of|in addition to)
> WebKit-specific tests.

I intend to, though the patch I'm about to upload just revives the existing-ish WebKit tests.
Comment 16 Tim Horton 2017-09-13 12:17:01 PDT
Created attachment 320673 [details]
Patch
Comment 17 Build Bot 2017-09-13 13:33:17 PDT
Comment on attachment 320673 [details]
Patch

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

New failing tests:
fast/block/positive-margin-block-child-align-center-calc.html
css3/supports-dom-api.html
css3/supports.html
css3/calc/simple-calcs-prefixed.html
Comment 18 Build Bot 2017-09-13 13:33:20 PDT
Created attachment 320683 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 19 Build Bot 2017-09-13 13:40:27 PDT
Comment on attachment 320673 [details]
Patch

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

New failing tests:
fast/block/positive-margin-block-child-align-center-calc.html
css3/supports-dom-api.html
css3/supports.html
css3/calc/simple-calcs-prefixed.html
Comment 20 Build Bot 2017-09-13 13:40:29 PDT
Created attachment 320685 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 21 Build Bot 2017-09-13 13:46:49 PDT
Comment on attachment 320673 [details]
Patch

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

New failing tests:
fast/block/positive-margin-block-child-align-center-calc.html
css3/supports-dom-api.html
css3/supports.html
css3/calc/simple-calcs-prefixed.html
Comment 22 Build Bot 2017-09-13 13:46:51 PDT
Created attachment 320687 [details]
Archive of layout-test-results from ews116 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 23 Build Bot 2017-09-13 14:02:53 PDT
Comment on attachment 320673 [details]
Patch

Attachment 320673 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4537195

New failing tests:
fast/block/positive-margin-block-child-align-center-calc.html
css3/supports-dom-api.html
css3/supports.html
css3/calc/simple-calcs-prefixed.html
Comment 24 Build Bot 2017-09-13 14:02:55 PDT
Created attachment 320690 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 25 Tim Horton 2017-09-15 00:48:07 PDT
Created attachment 320877 [details]
Patch
Comment 26 Dave Hyatt 2017-09-18 15:32:20 PDT
Comment on attachment 320877 [details]
Patch

r=me
Comment 27 WebKit Commit Bot 2017-09-18 16:36:25 PDT
Comment on attachment 320877 [details]
Patch

Clearing flags on attachment: 320877

Committed r222190: <http://trac.webkit.org/changeset/222190>
Comment 28 WebKit Commit Bot 2017-09-18 16:36:27 PDT
All reviewed patches have been landed.  Closing bug.
Comment 29 Joonghun Park 2019-04-30 07:53:25 PDT
*** Bug 143515 has been marked as a duplicate of this bug. ***