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

Unified Diff: third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.h

Issue 1549153002: Fix preferred logical widths of orthogonal writing modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (merge conflict resolved) 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/layout/DepthOrderedLayoutObjectList.h
diff --git a/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.h b/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.h
new file mode 100644
index 0000000000000000000000000000000000000000..25be824a499d6dd60e1daf65713d41181e918020
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.h
@@ -0,0 +1,62 @@
+// 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.
+
+#ifndef DepthOrderedLayoutObjectList_h
+#define DepthOrderedLayoutObjectList_h
+
+#include "wtf/Allocator.h"
+#include "wtf/HashSet.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+class LayoutObject;
+
+class DepthOrderedLayoutObjectList {
+public:
+ DepthOrderedLayoutObjectList()
+ { }
+
+ int size() { return m_roots.size(); }
+ bool isEmpty() const { return m_roots.isEmpty(); }
+
+protected:
+ struct LayoutObjectWithDepth {
+ LayoutObjectWithDepth(LayoutObject* inObject)
+ : object(inObject)
+ , depth(determineDepth(inObject))
+ { }
+
+ LayoutObjectWithDepth()
+ : object(0)
+ , depth(0)
+ { }
+
+ LayoutObject* object;
+ unsigned depth;
+
+ bool operator<(const DepthOrderedLayoutObjectList::LayoutObjectWithDepth& other) const
+ {
+ return depth < other.depth;
+ }
+
+ private:
+ static unsigned determineDepth(LayoutObject*);
+ };
+
+ // LayoutObjects sorted by depth (shallowest first). This structure is only
+ // populated at the beginning of enumerations. See takeDeepestRoot() in
+ // subclasses such as LayoutSubtreeRootList or
+ // OrthogonalWritingModeRootList.
esprehn 2016/01/31 00:44:56 just merge them into a single class, DepthOrderedL
+ Vector<LayoutObjectWithDepth> m_orderedRoots;
+
+ // Outside of layout, LayoutObjects can be added and removed as needed such
+ // as when style was changed or destroyed. They're kept in this hashset to
+ // keep those operations fast.
+ HashSet<LayoutObject*> m_roots;
+};
+
+} // namespace blink
+
+#endif // DepthOrderedLayoutObjectList_h

Powered by Google App Engine
This is Rietveld 408576698