Commit a5c6b2bb authored by rob.buis@samsung.com's avatar rob.buis@samsung.com

Replace custom code by hasOneTextChild API

This code just is the hasOneTextChild logic, so
to avoid confusion use that instead.

Review URL: https://codereview.chromium.org/692153002

git-svn-id: svn://svn.chromium.org/blink/trunk@184843 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9da3ced7
...@@ -132,11 +132,9 @@ void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta ...@@ -132,11 +132,9 @@ void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta
bool selectIsMenuList = select && select->usesMenuList(); bool selectIsMenuList = select && select->usesMenuList();
int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1; int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1;
// Handle the common special case where there's exactly 1 child node, and it's a text node. if (hasOneTextChild()) {
Node* child = firstChild(); toText(firstChild())->setData(text);
if (child && child->isTextNode() && !child->nextSibling()) } else {
toText(child)->setData(text);
else {
removeChildren(); removeChildren();
appendChild(Text::create(document(), text), exceptionState); appendChild(Text::create(document(), text), exceptionState);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment