| Index: third_party/WebKit/Source/core/frame/OrthogonalWritingModeRootList.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/OrthogonalWritingModeRootList.cpp b/third_party/WebKit/Source/core/frame/OrthogonalWritingModeRootList.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7b8b1eae7c2724c5214b3a49e346f034c296d3a7
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/frame/OrthogonalWritingModeRootList.cpp
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2015 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/frame/OrthogonalWritingModeRootList.h"
|
| +
|
| +#include "core/layout/LayoutObject.h"
|
| +#include <algorithm>
|
| +
|
| +namespace blink {
|
| +
|
| +LayoutObject* OrthogonalWritingModeRootList::takeDeepestRoot()
|
| +{
|
| + if (!m_isIterating) {
|
| + if (m_roots.isEmpty())
|
| + return nullptr;
|
| +
|
| + if (m_isOrderedListDirty) {
|
| + copyToVector(m_roots, m_orderedRoots);
|
| + std::sort(m_orderedRoots.begin(), m_orderedRoots.end());
|
| + m_isOrderedListDirty = m_isAnyRemoved = false;
|
| + }
|
| +
|
| + m_isIterating = true;
|
| + m_lastTaken = m_orderedRoots.rbegin();
|
| + return m_lastTaken->object;
|
| + }
|
| +
|
| + for (++m_lastTaken; m_lastTaken != m_orderedRoots.rend(); ++m_lastTaken) {
|
| + LayoutObject* object = m_lastTaken->object;
|
| + // Check removals while iterating.
|
| + if (!m_isAnyRemoved || m_roots.contains(object))
|
| + return object;
|
| + }
|
| +
|
| + m_isIterating = false;
|
| + return nullptr;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|