Commit 72f8919b authored by Amos Lim's avatar Amos Lim Committed by Commit Bot

Remove [TreatNullAs=NullString] from data attribute on CharacterData

Replace NullString with EmptyString of data atrribute as per spec[1].
[1]: https://dom.spec.whatwg.org/#dom-characterdata-data

Remove the null check in setData() because binding-generated code
has the null check on data.

Bug: 497307
Change-Id: I35ff0e0f864c2bc300f551bef6f25c1908c8a2ac
Reviewed-on: https://chromium-review.googlesource.com/1172308
Commit-Queue: Amos Lim <eui-sang.lim@samsung.com>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583011}
parent c0d5967e
...@@ -41,11 +41,9 @@ void CharacterData::Atomize() { ...@@ -41,11 +41,9 @@ void CharacterData::Atomize() {
} }
void CharacterData::setData(const String& data) { void CharacterData::setData(const String& data) {
const String& non_null_data = !data.IsNull() ? data : g_empty_string;
unsigned old_length = length(); unsigned old_length = length();
SetDataAndUpdate(non_null_data, 0, old_length, non_null_data.length(), SetDataAndUpdate(data, 0, old_length, data.length(), kUpdateFromNonParser);
kUpdateFromNonParser);
GetDocument().DidRemoveText(*this, 0, old_length); GetDocument().DidRemoveText(*this, 0, old_length);
} }
...@@ -171,7 +169,7 @@ bool CharacterData::ContainsOnlyWhitespace() const { ...@@ -171,7 +169,7 @@ bool CharacterData::ContainsOnlyWhitespace() const {
} }
void CharacterData::setNodeValue(const String& node_value) { void CharacterData::setNodeValue(const String& node_value) {
setData(node_value); setData(!node_value.IsNull() ? node_value : g_empty_string);
} }
void CharacterData::SetDataAndUpdate(const String& new_data, void CharacterData::SetDataAndUpdate(const String& new_data,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// https://dom.spec.whatwg.org/#interface-characterdata // https://dom.spec.whatwg.org/#interface-characterdata
interface CharacterData : Node { interface CharacterData : Node {
attribute [TreatNullAs=NullString] DOMString data; attribute [TreatNullAs=EmptyString] DOMString data;
readonly attribute unsigned long length; readonly attribute unsigned long length;
[RaisesException] DOMString substringData(unsigned long offset, unsigned long count); [RaisesException] DOMString substringData(unsigned long offset, unsigned long count);
void appendData(DOMString data); void appendData(DOMString data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment