Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: Source/WebCore/html/HTMLTextAreaElement.cpp

Issue 9569046: Merge 109362 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/html/HTMLTableElement.cpp ('k') | Source/WebCore/html/HTMLTitleElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 for (Node* n = firstChild(); n; n = n->nextSibling()) { 347 for (Node* n = firstChild(); n; n = n->nextSibling()) {
348 if (n->isTextNode()) 348 if (n->isTextNode())
349 value += static_cast<Text*>(n)->data(); 349 value += static_cast<Text*>(n)->data();
350 } 350 }
351 351
352 return value; 352 return value;
353 } 353 }
354 354
355 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) 355 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
356 { 356 {
357 RefPtr<Node> protectFromMutationEvents(this);
358
357 // To preserve comments, remove only the text nodes, then add a single text node. 359 // To preserve comments, remove only the text nodes, then add a single text node.
358
359 Vector<RefPtr<Node> > textNodes; 360 Vector<RefPtr<Node> > textNodes;
360 for (Node* n = firstChild(); n; n = n->nextSibling()) { 361 for (Node* n = firstChild(); n; n = n->nextSibling()) {
361 if (n->isTextNode()) 362 if (n->isTextNode())
362 textNodes.append(n); 363 textNodes.append(n);
363 } 364 }
364 ExceptionCode ec; 365 ExceptionCode ec;
365 size_t size = textNodes.size(); 366 size_t size = textNodes.size();
366 for (size_t i = 0; i < size; ++i) 367 for (size_t i = 0; i < size; ++i)
367 removeChild(textNodes[i].get(), ec); 368 removeChild(textNodes[i].get(), ec);
368 369
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 m_placeholder = HTMLDivElement::create(document()); 452 m_placeholder = HTMLDivElement::create(document());
452 m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); 453 m_placeholder->setShadowPseudoId("-webkit-input-placeholder");
453 shadowRoot()->insertBefore(m_placeholder, shadowRoot()->firstChild()->ne xtSibling(), ec); 454 shadowRoot()->insertBefore(m_placeholder, shadowRoot()->firstChild()->ne xtSibling(), ec);
454 ASSERT(!ec); 455 ASSERT(!ec);
455 } 456 }
456 m_placeholder->setInnerText(placeholderText, ec); 457 m_placeholder->setInnerText(placeholderText, ec);
457 ASSERT(!ec); 458 ASSERT(!ec);
458 } 459 }
459 460
460 } 461 }
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLTableElement.cpp ('k') | Source/WebCore/html/HTMLTitleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698