Chromium Code Reviews| Index: Source/core/html/HTMLTextAreaElement.cpp |
| diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp |
| index cdf5e58ea41f9c85ccf238c1dedf433dc899722b..8234ff202da06b6a2eecc5a6856784af6ad0fd56 100644 |
| --- a/Source/core/html/HTMLTextAreaElement.cpp |
| +++ b/Source/core/html/HTMLTextAreaElement.cpp |
| @@ -413,40 +413,14 @@ void HTMLTextAreaElement::setInnerEditorValue(const String& value) |
| String HTMLTextAreaElement::defaultValue() const |
| { |
| - StringBuilder value; |
| - |
| - // Since there may be comments, ignore nodes other than text nodes. |
| - for (Node* n = firstChild(); n; n = n->nextSibling()) { |
| - if (n->isTextNode()) |
| - value.append(toText(n)->data()); |
| - } |
| - |
| - return value.toString(); |
| + return textContent(); |
| } |
| void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) |
| { |
| - RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this); |
| - |
| - // To preserve comments, remove only the text nodes, then add a single text node. |
| - WillBeHeapVector<RefPtrWillBeMember<Node>> textNodes; |
| - for (Node* n = firstChild(); n; n = n->nextSibling()) { |
| - if (n->isTextNode()) |
| - textNodes.append(n); |
| - } |
| - size_t size = textNodes.size(); |
| - for (size_t i = 0; i < size; ++i) |
| - removeChild(textNodes[i].get(), IGNORE_EXCEPTION); |
| - |
| - // Normalize line endings. |
| - String value = defaultValue; |
| - value.replace("\r\n", "\n"); |
| - value.replace('\r', '\n'); |
| - |
| - insertBefore(document().createTextNode(value), firstChild(), IGNORE_EXCEPTION); |
| - |
| + setTextContent(defaultValue); |
| if (!m_isDirty) |
|
Sunil Ratnu
2015/07/10 07:47:26
I tried using ImplementedAs=textContent in the idl
tkent
2015/07/10 07:59:40
Can you add test cases of ta.textContent = '...' t
|
| - setNonDirtyValue(value); |
| + setNonDirtyValue(defaultValue); |
| } |
| int HTMLTextAreaElement::maxLength() const |