| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights |
| 6 * reserved. | 6 * reserved. |
| 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) { | 467 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) { |
| 468 // To preserve comments, remove only the text nodes, then add a single text | 468 // To preserve comments, remove only the text nodes, then add a single text |
| 469 // node. | 469 // node. |
| 470 HeapVector<Member<Node>> textNodes; | 470 HeapVector<Member<Node>> textNodes; |
| 471 for (Node* n = firstChild(); n; n = n->nextSibling()) { | 471 for (Node* n = firstChild(); n; n = n->nextSibling()) { |
| 472 if (n->isTextNode()) | 472 if (n->isTextNode()) |
| 473 textNodes.push_back(n); | 473 textNodes.push_back(n); |
| 474 } | 474 } |
| 475 for (const auto& text : textNodes) | 475 for (const auto& text : textNodes) |
| 476 removeChild(text.get(), IGNORE_EXCEPTION); | 476 removeChild(text.get(), IGNORE_EXCEPTION_FOR_TESTING); |
| 477 | 477 |
| 478 // Normalize line endings. | 478 // Normalize line endings. |
| 479 String value = defaultValue; | 479 String value = defaultValue; |
| 480 value.replace("\r\n", "\n"); | 480 value.replace("\r\n", "\n"); |
| 481 value.replace('\r', '\n'); | 481 value.replace('\r', '\n'); |
| 482 | 482 |
| 483 insertBefore(document().createTextNode(value), firstChild(), | 483 insertBefore(document().createTextNode(value), firstChild(), |
| 484 IGNORE_EXCEPTION); | 484 IGNORE_EXCEPTION_FOR_TESTING); |
| 485 | 485 |
| 486 if (!m_isDirty) | 486 if (!m_isDirty) |
| 487 setNonDirtyValue(value); | 487 setNonDirtyValue(value); |
| 488 } | 488 } |
| 489 | 489 |
| 490 String HTMLTextAreaElement::suggestedValue() const { | 490 String HTMLTextAreaElement::suggestedValue() const { |
| 491 return m_suggestedValue; | 491 return m_suggestedValue; |
| 492 } | 492 } |
| 493 | 493 |
| 494 void HTMLTextAreaElement::setSuggestedValue(const String& value) { | 494 void HTMLTextAreaElement::setSuggestedValue(const String& value) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( | 640 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( |
| 641 const Element& source) { | 641 const Element& source) { |
| 642 const HTMLTextAreaElement& sourceElement = | 642 const HTMLTextAreaElement& sourceElement = |
| 643 static_cast<const HTMLTextAreaElement&>(source); | 643 static_cast<const HTMLTextAreaElement&>(source); |
| 644 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); | 644 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); |
| 645 m_isDirty = sourceElement.m_isDirty; | 645 m_isDirty = sourceElement.m_isDirty; |
| 646 TextControlElement::copyNonAttributePropertiesFromElement(source); | 646 TextControlElement::copyNonAttributePropertiesFromElement(source); |
| 647 } | 647 } |
| 648 | 648 |
| 649 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |