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..5f2bd3f95b1ac0e0223b381e31b7b47e45dae9b3 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/frame/OrthogonalWritingModeRootList.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/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)) |
esprehn
2016/01/31 00:44:56
what is this? How can the list be mutated while it
kojii
2016/01/31 01:12:20
Just mimic'ed what LayoutSubtreeRootList does, I'l
|
+ return object; |
+ } |
+ |
+ m_isIterating = false; |
+ return nullptr; |
+} |
+ |
+} // namespace blink |