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

Unified Diff: Source/core/editing/PositionWithAffinity.h

Issue 1187073014: Templatize PositionWithAffinity class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-17T16:31:27 Created 5 years, 6 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: Source/core/editing/PositionWithAffinity.h
diff --git a/Source/core/editing/PositionWithAffinity.h b/Source/core/editing/PositionWithAffinity.h
index e5e59589828d10379f7f4f3f63f7a29d4ff65b46..38fb1f641e77ca045b928c7e8bcf77057af2dbc2 100644
--- a/Source/core/editing/PositionWithAffinity.h
+++ b/Source/core/editing/PositionWithAffinity.h
@@ -11,23 +11,33 @@
namespace blink {
-class CORE_EXPORT PositionWithAffinity {
+template <typename Position>
+class CORE_TEMPLATE_CLASS_EXPORT PositionWithAffinityTemplate {
DISALLOW_ALLOCATION();
public:
- PositionWithAffinity(const Position&, EAffinity = DOWNSTREAM);
- PositionWithAffinity();
- ~PositionWithAffinity();
+ typedef Position PositionType;
+
+ PositionWithAffinityTemplate(const PositionType&, EAffinity = DOWNSTREAM);
+ PositionWithAffinityTemplate();
+ ~PositionWithAffinityTemplate();
EAffinity affinity() const { return m_affinity; }
- const Position& position() const { return m_position; }
+ const PositionType& position() const { return m_position; }
- DECLARE_TRACE();
+ DEFINE_INLINE_TRACE()
+ {
+ visitor->trace(m_position);
+ }
private:
- Position m_position;
+ PositionType m_position;
EAffinity m_affinity;
};
+extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionWithAffinityTemplate<Position>;
+
+using PositionWithAffinity = PositionWithAffinityTemplate<Position>;
+
} // namespace blink
#endif // PositionWithAffinity_h

Powered by Google App Engine
This is Rietveld 408576698