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

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

Issue 1549153002: Fix preferred logical widths of orthogonal writing modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leviw review 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.h
diff --git a/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.h b/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.h
index 08f01ebe2c23ec9cc776679a3195eba70dabd92d..676c91e5008fd994e1c772fd207d291a6853206b 100644
--- a/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.h
+++ b/third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.h
@@ -5,14 +5,13 @@
#ifndef LayoutSubtreeRootList_h
#define LayoutSubtreeRootList_h
+#include "core/layout/DepthOrderedLayoutObjectList.h"
#include "wtf/Allocator.h"
#include "wtf/HashSet.h"
#include "wtf/Vector.h"
namespace blink {
-class LayoutObject;
-
// This class keeps track of layout objects that have identified to be
// independent layout roots meaning they won't affect other parts of the tree
// by their layout. This is an optimization to avoid doing extra work and tree
@@ -27,66 +26,21 @@ class LayoutObject;
// a higher root.
// TODO(leviw): This should really be something akin to a LayoutController
// that FrameView delegates layout work to.
-class LayoutSubtreeRootList {
+class LayoutSubtreeRootList : public DepthOrderedLayoutObjectList {
DISALLOW_NEW();
public:
LayoutSubtreeRootList()
{ }
- void addRoot(LayoutObject& object)
- {
- ASSERT(m_orderedRoots.isEmpty());
- m_roots.add(&object);
- }
- void removeRoot(LayoutObject&);
-
void clearAndMarkContainingBlocksForLayout();
- void clear() { m_roots.clear(); }
- int size() { return m_roots.size(); }
- bool isEmpty() const { return m_roots.isEmpty(); }
// TODO(leviw): Remove this once we stop exposing to DevTools one root
// for a layout crbug.com/460596
LayoutObject* randomRoot();
- LayoutObject* takeDeepestRoot();
-
void countObjectsNeedingLayout(unsigned& needsLayoutObjects, unsigned& totalObjects);
static void countObjectsNeedingLayoutInRoot(const LayoutObject* root, unsigned& needsLayoutObjects, unsigned& totalObjects);
-
-private:
- struct LayoutSubtree {
- LayoutSubtree(LayoutObject* inObject)
- : object(inObject)
- , depth(determineDepth(inObject))
- { }
-
- LayoutSubtree()
- : object(0)
- , depth(0)
- { }
-
- LayoutObject* object;
- unsigned depth;
-
- bool operator<(const LayoutSubtreeRootList::LayoutSubtree& other) const
- {
- return depth < other.depth;
- }
-
- private:
- static unsigned determineDepth(LayoutObject*);
- };
-
- // Layout roots sorted by depth (shallowest first). This structure is only
- // populated at the beginning of layout.
- Vector<LayoutSubtree> m_orderedRoots;
-
- // Outside of layout, roots can be added when marked as needing layout and
- // removed when removed when destroyed. They're kept in this hashset to
- // keep those operations fast.
- HashSet<LayoutObject*> m_roots;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/frame/LayoutSubtreeRootList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698