| 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..596360819a6f786182da1614a48dfeb6adb36fbb
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/layout/DepthOrderedLayoutObjectList.h
|
| @@ -0,0 +1,60 @@
|
| +// 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.
|
| +
|
| +#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*);
|
| + };
|
| +
|
| + // Layout roots sorted by depth (shallowest first). This structure is only
|
| + // populated at the beginning of layout.
|
| + Vector<LayoutObjectWithDepth> 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
|
| +
|
| +#endif // DepthOrderedLayoutObjectList_h
|
|
|