Settings a reflected DOMString attribute to null should set it to the "null" string rather than the empty string
https://bugs.webkit.org/show_bug.cgi?id=153504
<rdar://problem/24353072>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Settings a reflected DOMString attribute to null should set it to the "null"
string rather than the empty string:
- https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes
- http://heycam.github.io/webidl/#es-DOMString
- http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring

Firefox and Chrome match the specification here.

This is causing a lot of W3C HTML reflection tests to fail on WebKit, e.g.:
- http://w3c-test.org/html/dom/reflection-text.html

No new tests, already covered by existing tests.

* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
Call toString() instead of valueToStringWithNullCheck() for reflected
attributes. This way, null gets converted to the string "null", as
expected, instead of a null String object.

* html/HTMLInputElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
input.defaultValue, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmlinputelement

Without this change, assigning null to input.defaultValue would not
set to to the "null" string, as is expected.

* html/HTMLTextAreaElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
textArea.defaultValue, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmltextareaelement

Without this change, assigning null to textArea.defaultValue would not
set to to the "null" string, as is expected.

* html/HTMLTitleElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
title.text, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmltitleelement

Without this change, assigning null to title.text would not
set to to the "null" string, as is expected.

LayoutTests:

Update existing tests as a lot of them were expecting that setting
a reflected DOMString attribute to null would set it to the empty
string instead of the string "null".

* fast/dom/domstring-attribute-reflection-expected.txt:
* fast/dom/domstring-attribute-reflection.html:
* fast/dom/element-attribute-js-null-expected.txt:
* fast/dom/element-attribute-js-null.html:
* fast/dom/ping-attribute-dom-binding-expected.txt:
* fast/dom/ping-attribute-dom-binding.html:
* fast/forms/fieldset/fieldset-name-expected.txt:
* fast/forms/fieldset/fieldset-name.html:
* fast/forms/input-minmax-expected.txt:
* fast/forms/input-minmax.html:
* fast/forms/input-pattern-expected.txt:
* fast/forms/input-pattern.html:
* fast/forms/submit-form-attributes-expected.txt:
* fast/forms/submit-form-attributes.html:
* fast/shadow-dom/HTMLSlotElement-interface.html:
* fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html:
* fast/shadow-dom/shadow-layout-after-slot-changes.html:
* svg/dom/svg-element-attribute-js-null-expected.txt:
* svg/dom/svg-element-attribute-js-null.xhtml:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@195700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed