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

Unified Diff: Source/core/html/HTMLOptionElement.cpp

Issue 692153002: Replace custom code by hasOneTextChild API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLOptionElement.cpp
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index 1bdde70b90d434be260de3938d7652317c9ab16a..c7ad4391cab026abc0592ebade6085088d0580a6 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -133,9 +133,8 @@ void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta
int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1;
// Handle the common special case where there's exactly 1 child node, and it's a text node.
adamk 2014/11/04 00:56:56 This comment is now very redundant with the code,
- Node* child = firstChild();
- if (child && child->isTextNode() && !child->nextSibling())
- toText(child)->setData(text);
+ if (hasOneTextChild())
+ toText(firstChild())->setData(text);
else {
removeChildren();
appendChild(Text::create(document(), text), exceptionState);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698