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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 464 |
465 return value.toString(); | 465 return value.toString(); |
466 } | 466 } |
467 | 467 |
468 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) { | 468 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) { |
469 // To preserve comments, remove only the text nodes, then add a single text | 469 // To preserve comments, remove only the text nodes, then add a single text |
470 // node. | 470 // node. |
471 HeapVector<Member<Node>> textNodes; | 471 HeapVector<Member<Node>> textNodes; |
472 for (Node* n = firstChild(); n; n = n->nextSibling()) { | 472 for (Node* n = firstChild(); n; n = n->nextSibling()) { |
473 if (n->isTextNode()) | 473 if (n->isTextNode()) |
474 textNodes.append(n); | 474 textNodes.push_back(n); |
475 } | 475 } |
476 for (const auto& text : textNodes) | 476 for (const auto& text : textNodes) |
477 removeChild(text.get(), IGNORE_EXCEPTION); | 477 removeChild(text.get(), IGNORE_EXCEPTION); |
478 | 478 |
479 // Normalize line endings. | 479 // Normalize line endings. |
480 String value = defaultValue; | 480 String value = defaultValue; |
481 value.replace("\r\n", "\n"); | 481 value.replace("\r\n", "\n"); |
482 value.replace('\r', '\n'); | 482 value.replace('\r', '\n'); |
483 | 483 |
484 insertBefore(document().createTextNode(value), firstChild(), | 484 insertBefore(document().createTextNode(value), firstChild(), |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( | 641 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( |
642 const Element& source) { | 642 const Element& source) { |
643 const HTMLTextAreaElement& sourceElement = | 643 const HTMLTextAreaElement& sourceElement = |
644 static_cast<const HTMLTextAreaElement&>(source); | 644 static_cast<const HTMLTextAreaElement&>(source); |
645 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); | 645 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); |
646 m_isDirty = sourceElement.m_isDirty; | 646 m_isDirty = sourceElement.m_isDirty; |
647 TextControlElement::copyNonAttributePropertiesFromElement(source); | 647 TextControlElement::copyNonAttributePropertiesFromElement(source); |
648 } | 648 } |
649 | 649 |
650 } // namespace blink | 650 } // namespace blink |
OLD | NEW |