Bug 154506 - WebKit considers exponential notation invalid when used inside CSS transforms.
Summary: WebKit considers exponential notation invalid when used inside CSS transforms.
Status: RESOLVED DUPLICATE of bug 127720
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified All
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-02-20 14:01 PST by Andrei
Modified: 2016-05-11 12:19 PDT (History)
9 users (show)

See Also:


Attachments
transform bug demo (234.79 KB, image/png)
2016-02-20 14:01 PST, Andrei
no flags Details
Reduction test case (584 bytes, text/html)
2016-05-10 21:54 PDT, Myles C. Maxfield
no flags Details
WIP (6.20 KB, patch)
2016-05-11 00:10 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei 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
Comment 1 Radar WebKit Bug Importer 2016-03-02 18:33:14 PST
<rdar://problem/24945902>
Comment 2 Myles C. Maxfield 2016-05-10 21:54:40 PDT
Created attachment 278583 [details]
Reduction test case
Comment 3 Myles C. Maxfield 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
Comment 4 Myles C. Maxfield 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.
Comment 5 Myles C. Maxfield 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.
Comment 6 Myles C. Maxfield 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
Comment 7 Myles C. Maxfield 2016-05-11 00:10:47 PDT
Created attachment 278600 [details]
WIP
Comment 8 Myles C. Maxfield 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.
Comment 9 Myles C. Maxfield 2016-05-11 06:43:08 PDT
Most of the tests which fail are in css3/ and fast/
Comment 10 Simon Fraser (smfr) 2016-05-11 09:35:32 PDT
See also bug 127720, bug 130542
Comment 11 Simon Fraser (smfr) 2016-05-11 10:12:02 PDT
Dup of bug 127720?
Comment 12 Myles C. Maxfield 2016-05-11 12:19:41 PDT

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