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

Unified Diff: Source/wtf/RefVector.h

Issue 219633002: Proper support for multiple text decorations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix jchaffraix' issues. Created 6 years, 7 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
« no previous file with comments | « Source/core/rendering/style/StyleRareInheritedData.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/RefVector.h
diff --git a/Source/wtf/RefVector.h b/Source/wtf/RefVector.h
new file mode 100644
index 0000000000000000000000000000000000000000..1ba8c996e47373bca570bcf2afac02e8cde4ec5c
--- /dev/null
+++ b/Source/wtf/RefVector.h
@@ -0,0 +1,38 @@
+// Copyright 2014 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 RefVector_h
+#define RefVector_h
+
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+template <typename T>
+class RefVector : public RefCounted<RefVector<T> > {
+public:
+ static PassRefPtr<RefVector> create() { return adoptRef(new RefVector<T>); }
+ PassRefPtr<RefVector> copy() { return adoptRef(new RefVector<T>(*this)); }
+
+ const T& operator[](size_t i) const { return m_vector[i]; }
+ T& operator[](size_t i) { return m_vector[i]; }
+
+ bool operator==(const RefVector& o) const { return m_vector == o.m_vector; }
+ bool operator!=(const RefVector& o) const { return m_vector != o.m_vector; }
+
+ size_t size() const { return m_vector.size(); }
+ void append(const T& decoration) { m_vector.append(decoration); }
+ const Vector<T>& vector() const { return m_vector; }
+
+private:
+ Vector<T> m_vector;
+ RefVector() { }
+ RefVector(const RefVector& o) : m_vector(o.m_vector) { }
+};
+
+} // namespace WebCore
+
+#endif // RefVector_h
« no previous file with comments | « Source/core/rendering/style/StyleRareInheritedData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698