RESOLVED DUPLICATE of bug 127720 154506
WebKit considers exponential notation invalid when used inside CSS transforms.
https://bugs.webkit.org/show_bug.cgi?id=154506
Summary WebKit considers exponential notation invalid when used inside CSS transforms.
Andrei
Reported 2016-02-20 14:01:30 PST
Created attachment 271870 [details] transform bug demo Nested (orange) div should be translated to the right: <div style='background: green'> <div style="width:100px; height: 100px; background: orange; transform: translateX(0.0000001E+9px);">42424242</div> </div> See the image attached. FireFox and Chrome render this properly. Verified using latest Nightly build (Version 9.0.3 (10601.4.4, r196858)) on OSX (10.10.5) Have also confirmed this bug in mobile iOS browser (Mozilla/5.0 (iPhone; CPU iPhone OS 9_2_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13D15 Safari/601.1) Verified that the same happens for matrix3 transforms. JSBin: http://jsbin.com/didotureja/edit?html,css,output CSS Specs for <number>: https://www.w3.org/TR/css3-values/#number-value - allows exponential notation
Attachments
transform bug demo (234.79 KB, image/png)
2016-02-20 14:01 PST, Andrei
no flags
Reduction test case (584 bytes, text/html)
2016-05-10 21:54 PDT, Myles C. Maxfield
no flags
WIP (6.20 KB, patch)
2016-05-11 00:10 PDT, Myles C. Maxfield
no flags
Radar WebKit Bug Importer
Comment 1 2016-03-02 18:33:14 PST
Myles C. Maxfield
Comment 2 2016-05-10 21:54:40 PDT
Created attachment 278583 [details] Reduction test case
Myles C. Maxfield
Comment 3 2016-05-10 23:18:25 PDT
Looks like the parser is saying the CSSPrimitiveValue's unit is CSSPrimitiveValue::CSS_DIMENSION instead of CSSPrimitiveValue::CSS_NUMBER
Myles C. Maxfield
Comment 4 2016-05-10 23:47:49 PDT
The problem is in the "case CharacterNumber" part of CSSParser::realLex(). We see the string "5.868880048609526e-9" and we parse 5.868880048609526 (in charactersToDouble()) but when we hit the "e" we think this is part of a unit (like "em" or "ex" and we bail when we realize the "-" isn't part of any unit.
Myles C. Maxfield
Comment 5 2016-05-10 23:51:21 PDT
It looks like we already have handling for this, but it's behind a "if (m_context.mode == SVGAttributeMode)" guard.
Myles C. Maxfield
Comment 6 2016-05-10 23:53:53 PDT
The spec says: matrix3d() = matrix3d( <number> [, <number> ]{15,15} )[1] "When written literally, a number is either an integer, or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits and optionally an exponent composed of "e" or "E" and an integer."[2] [1] https://drafts.csswg.org/css-transforms/#funcdef-matrix3d [2] https://drafts.csswg.org/css-values-3/#number-value
Myles C. Maxfield
Comment 7 2016-05-11 00:10:47 PDT
Myles C. Maxfield
Comment 8 2016-05-11 00:20:10 PDT
(In reply to comment #7) > Created attachment 278600 [details] > WIP This patch causes many many tests to fail.
Myles C. Maxfield
Comment 9 2016-05-11 06:43:08 PDT
Most of the tests which fail are in css3/ and fast/
Simon Fraser (smfr)
Comment 10 2016-05-11 09:35:32 PDT
Simon Fraser (smfr)
Comment 11 2016-05-11 10:12:02 PDT
Dup of bug 127720?
Myles C. Maxfield
Comment 12 2016-05-11 12:19:41 PDT
*** This bug has been marked as a duplicate of bug 127720 ***
Note You need to log in before you can comment on or make changes to this bug.