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

Unified Diff: third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp

Issue 1549153002: Fix preferred logical widths of orthogonal writing modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow call to remove() while iterating as long as it doesn't actually remove Created 4 years, 11 months 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
Index: third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp
diff --git a/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp b/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp
index d41fc493325a74c4d71f16896957959420efdaac..1a6375308f47085286a24454dfad6f7c69f0af17 100644
--- a/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp
+++ b/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp
@@ -6,51 +6,20 @@
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutView.h"
-#include <algorithm>
namespace blink {
-unsigned LayoutSubtreeRootList::LayoutSubtree::determineDepth(LayoutObject* object)
-{
- unsigned depth = 1;
- for (LayoutObject* parent = object->parent(); parent; parent = parent->parent())
- ++depth;
- return depth;
-}
-
-void LayoutSubtreeRootList::removeRoot(LayoutObject& object)
-{
- auto root = m_roots.find(&object);
- ASSERT(root == m_roots.end() || m_orderedRoots.isEmpty());
- m_roots.remove(root);
-}
-
void LayoutSubtreeRootList::clearAndMarkContainingBlocksForLayout()
{
- for (auto& iter : m_roots)
+ for (auto& iter : unordered())
iter->markContainerChainForLayout(false);
- m_roots.clear();
+ clear();
}
LayoutObject* LayoutSubtreeRootList::randomRoot()
{
ASSERT(!isEmpty());
- return *m_roots.begin();
-}
-
-LayoutObject* LayoutSubtreeRootList::takeDeepestRoot()
-{
- if (m_orderedRoots.isEmpty()) {
- if (m_roots.isEmpty())
- return 0;
-
- copyToVector(m_roots, m_orderedRoots);
- std::sort(m_orderedRoots.begin(), m_orderedRoots.end());
- m_roots.clear();
- }
- LayoutObject* root = m_orderedRoots.last().object;
- m_orderedRoots.removeLast();
- return root;
+ return *unordered().begin();
}
void LayoutSubtreeRootList::countObjectsNeedingLayoutInRoot(const LayoutObject* object, unsigned& needsLayoutObjects, unsigned& totalObjects)
@@ -65,7 +34,7 @@ void LayoutSubtreeRootList::countObjectsNeedingLayoutInRoot(const LayoutObject*
void LayoutSubtreeRootList::countObjectsNeedingLayout(unsigned& needsLayoutObjects, unsigned& totalObjects)
{
// TODO(leviw): This will double-count nested roots crbug.com/509141
- for (auto& root : m_roots)
+ for (auto& root : unordered())
countObjectsNeedingLayoutInRoot(root, needsLayoutObjects, totalObjects);
}

Powered by Google App Engine
This is Rietveld 408576698