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

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

Issue 9567036: Merge 109362 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
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