Bug 134059 - REGRESSION (r168685): css calc() expression fails
Summary: REGRESSION (r168685): css calc() expression fails
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.9
: P2 Normal
Assignee: Nobody
URL: http://jsfiddle.net/hooleyhoop/3RZ8Q/4/
Keywords: InRadar
Depends on:
Blocks: 132870
  Show dependency treegraph
Reported: 2014-06-19 04:43 PDT by hooleyhoop
Modified: 2014-06-27 11:56 PDT (History)
15 users (show)

See Also:

Proposed patch (4.26 KB, patch)
2014-06-27 09:25 PDT, Martin Hodovan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description hooleyhoop 2014-06-19 04:43:04 PDT
This expression no longer works..

width: calc((100% - 20px) / 3;

equivalent expression still works

width: calc(100%/3 - 20px/3)
Comment 1 Simon Fraser (smfr) 2014-06-20 08:28:06 PDT
Regressed in http://trac.webkit.org/changeset/168685.
Comment 2 Radar WebKit Bug Importer 2014-06-24 00:39:16 PDT
Comment 3 Simon Fraser (smfr) 2014-06-24 08:58:32 PDT
Martin, can you take a look please, so we don't have to roll out your patch?
Comment 4 hodovanmartin@gmail.com 2014-06-24 09:05:39 PDT
Yes, I am already working on it, I just need a little more time.
I will upload a patch till tomorrow.
Comment 5 hodovanmartin@gmail.com 2014-06-24 12:16:56 PDT
I have reverted my repository to the revision before right my patch (r168684) and it does not work either.
This expression can not be parsed properly because of the superfluous '(' character, but seems like it is
an older issue. () However, I am glad to investigate it.

The following example shows two rectangle of the same size:
<div width="300px">
  <div style="height:100px; width: calc((100% - 20px) / 3); border: 1px solid;" ></div>
  <div style="height:100px; width: calc(100%/3 - 20px/3); border: 1px solid;"></div>
Comment 6 Simon Fraser (smfr) 2014-06-24 12:32:20 PDT
The test case def. worked in http://trac.webkit.org/changeset/168684
Comment 7 Martin Hodovan 2014-06-25 02:57:11 PDT
(In reply to comment #0)
> This expression no longer works..
> width: calc((100% - 20px) / 3;

I think there has been some misunderstanding here. Your first example is a malformed expression,
because a closing brace is missing from the end, and therefore it can not be parsed properly.
I thought that my patch has ruined some error recovery feature, which seemed a little unlikely,
since my patch did not change the CSS grammar. So I double-checked it and the expression you
mentioned has never worked before. (Maybe I should report it, if it needs auto-correction at all.)

But now I get it. "width: calc((100% - 20px) / 3)" is now a well-formed expression and it really
does not work since my patch has landed. Thank you for your patience, I will upload a fix very soon.
Comment 8 Martin Hodovan 2014-06-27 09:25:00 PDT
Created attachment 233987 [details]
Proposed patch
Comment 9 WebKit Commit Bot 2014-06-27 11:56:10 PDT
Comment on attachment 233987 [details]
Proposed patch

Clearing flags on attachment: 233987

Committed r170544: <http://trac.webkit.org/changeset/170544>
Comment 10 WebKit Commit Bot 2014-06-27 11:56:17 PDT
All reviewed patches have been landed.  Closing bug.