Bug 178061 - Fix bugs related to setting reflected floating point DOM attributes
Summary: Fix bugs related to setting reflected floating point DOM attributes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-07 23:02 PDT by Darin Adler
Modified: 2017-10-08 15:18 PDT (History)
5 users (show)

See Also:


Attachments
Patch (47.09 KB, patch)
2017-10-08 01:41 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (47.36 KB, patch)
2017-10-08 01:48 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (42.66 KB, patch)
2017-10-08 01:52 PDT, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2017-10-07 23:02:19 PDT
Fix bugs related to setting reflected floating point DOM attributes
Comment 1 Darin Adler 2017-10-08 01:41:35 PDT
Created attachment 323129 [details]
Patch
Comment 2 Darin Adler 2017-10-08 01:48:09 PDT
Created attachment 323130 [details]
Patch
Comment 3 Darin Adler 2017-10-08 01:52:50 PDT
Created attachment 323131 [details]
Patch
Comment 4 Chris Dumez 2017-10-08 10:10:28 PDT
Comment on attachment 323131 [details]
Patch

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

> Source/WebCore/ChangeLog:13
> +        (WebCore::HTMLProgressElement::setMax): Changed the semantics to match what

May want to mention:
https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#limited-to-numbers-greater-than-zero

> Source/WebCore/html/HTMLProgressElement.cpp:101
> +    setAttributeWithoutSynchronization(valueAttr, AtomicString::number(value));

The specification [1[ says to use the "best representation of the number as a floating-point number" [2]. It basically says to use Ecma's ToString(), so shouldn't it call String::numberToStringECMAScript() ?
Same for meter.value.

- https://html.spec.whatwg.org/multipage/form-elements.html#dom-progress-value
- https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#best-representation-of-the-number-as-a-floating-point-number
Comment 5 Darin Adler 2017-10-08 12:31:59 PDT
Comment on attachment 323131 [details]
Patch

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

>> Source/WebCore/ChangeLog:13
>> +        (WebCore::HTMLProgressElement::setMax): Changed the semantics to match what
> 
> May want to mention:
> https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#limited-to-numbers-greater-than-zero

OK

>> Source/WebCore/html/HTMLProgressElement.cpp:101
>> +    setAttributeWithoutSynchronization(valueAttr, AtomicString::number(value));
> 
> The specification [1[ says to use the "best representation of the number as a floating-point number" [2]. It basically says to use Ecma's ToString(), so shouldn't it call String::numberToStringECMAScript() ?
> Same for meter.value.
> 
> - https://html.spec.whatwg.org/multipage/form-elements.html#dom-progress-value
> - https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#best-representation-of-the-number-as-a-floating-point-number

Yes, exactly.

AtomicSstring::number does exactly the same thing as String::numberToStringECMAScript. The String::number function needs to be renamed to include the words “fixed precision” and we will not use it that much any more going forward. I am trying to make the ECMAScript behavior, which is a great default anyway, the default stringifying for doubles throughout WebKit over time.

So yes, this is what this patch does and that’s why the tests are passing now.

I could have renamed the AtomicStriing::number function to add the word ECMAScript, but then I would’ve had to change all the call sites, and all of them want the ECMAScript semantic. I chose to do it this way: it’s a bit more subtle but I think it’s good forward-looking.
Comment 6 Darin Adler 2017-10-08 12:37:15 PDT
Maybe I should add more tests; not sure every last behavior change is sufficiently covered.
Comment 7 Darin Adler 2017-10-08 14:25:20 PDT
Now that EWS has run: review anyone?
Comment 8 WebKit Commit Bot 2017-10-08 15:17:49 PDT
Comment on attachment 323131 [details]
Patch

Clearing flags on attachment: 323131

Committed r223035: <http://trac.webkit.org/changeset/223035>
Comment 9 WebKit Commit Bot 2017-10-08 15:17:51 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2017-10-08 15:18:24 PDT
<rdar://problem/34877132>