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

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: Patch for landing Created 6 years, 1 month 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..8750085da165560bc0837b0bb5c24bec32a3b5f8 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -132,11 +132,9 @@ void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta
bool selectIsMenuList = select && select->usesMenuList();
int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1;
- // Handle the common special case where there's exactly 1 child node, and it's a text node.
- Node* child = firstChild();
- if (child && child->isTextNode() && !child->nextSibling())
- toText(child)->setData(text);
- else {
+ 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