| Index: third_party/WebKit/Source/core/html/forms/OptionList.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/forms/OptionList.cpp b/third_party/WebKit/Source/core/html/forms/OptionList.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..06f4f6fe6cef9715d830be5e4e85c81303e910bf
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/html/forms/OptionList.cpp
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/html/forms/OptionList.h"
|
| +
|
| +#include "core/dom/ElementTraversal.h"
|
| +#include "core/html/HTMLOptionElement.h"
|
| +#include "core/html/HTMLSelectElement.h"
|
| +
|
| +namespace blink {
|
| +
|
| +void OptionListIterator::advance(HTMLOptionElement* previous)
|
| +{
|
| + // This function returns only
|
| + // - An OPTION child of m_select, or
|
| + // - An OPTION child of an OPTGROUP child of m_select.
|
| +
|
| + Element* current;
|
| + if (previous) {
|
| + DCHECK_EQ(previous->ownerSelectElement(), m_select);
|
| + current = ElementTraversal::nextSkippingChildren(*previous, m_select);
|
| + } else {
|
| + current = ElementTraversal::firstChild(*m_select);
|
| + }
|
| + while (current) {
|
| + if (isHTMLOptionElement(current)) {
|
| + m_current = toHTMLOptionElement(current);
|
| + return;
|
| + }
|
| + if (isHTMLOptGroupElement(current) && current->parentNode() == m_select) {
|
| + if ((m_current = Traversal<HTMLOptionElement>::firstChild(*current)))
|
| + return;
|
| + }
|
| + current = ElementTraversal::nextSkippingChildren(*current, m_select);
|
| + }
|
| + m_current = nullptr;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|