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 reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 for (Node* n = firstChild(); n; n = n->nextSibling()) { | 360 for (Node* n = firstChild(); n; n = n->nextSibling()) { |
361 if (n->isTextNode()) | 361 if (n->isTextNode()) |
362 value += static_cast<Text*>(n)->data(); | 362 value += static_cast<Text*>(n)->data(); |
363 } | 363 } |
364 | 364 |
365 return value; | 365 return value; |
366 } | 366 } |
367 | 367 |
368 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) | 368 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) |
369 { | 369 { |
| 370 RefPtr<Node> protectFromMutationEvents(this); |
| 371 |
370 // To preserve comments, remove only the text nodes, then add a single text
node. | 372 // To preserve comments, remove only the text nodes, then add a single text
node. |
371 | |
372 Vector<RefPtr<Node> > textNodes; | 373 Vector<RefPtr<Node> > textNodes; |
373 for (Node* n = firstChild(); n; n = n->nextSibling()) { | 374 for (Node* n = firstChild(); n; n = n->nextSibling()) { |
374 if (n->isTextNode()) | 375 if (n->isTextNode()) |
375 textNodes.append(n); | 376 textNodes.append(n); |
376 } | 377 } |
377 ExceptionCode ec; | 378 ExceptionCode ec; |
378 size_t size = textNodes.size(); | 379 size_t size = textNodes.size(); |
379 for (size_t i = 0; i < size; ++i) | 380 for (size_t i = 0; i < size; ++i) |
380 removeChild(textNodes[i].get(), ec); | 381 removeChild(textNodes[i].get(), ec); |
381 | 382 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 m_placeholder = HTMLDivElement::create(document()); | 465 m_placeholder = HTMLDivElement::create(document()); |
465 m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); | 466 m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); |
466 shadowRoot()->insertBefore(m_placeholder, shadowRoot()->firstChild()->ne
xtSibling(), ec); | 467 shadowRoot()->insertBefore(m_placeholder, shadowRoot()->firstChild()->ne
xtSibling(), ec); |
467 ASSERT(!ec); | 468 ASSERT(!ec); |
468 } | 469 } |
469 m_placeholder->setInnerText(placeholderText, ec); | 470 m_placeholder->setInnerText(placeholderText, ec); |
470 ASSERT(!ec); | 471 ASSERT(!ec); |
471 } | 472 } |
472 | 473 |
473 } | 474 } |
OLD | NEW |