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

Side by Side Diff: third_party/WebKit/Source/core/editing/PositionWithAffinity.h

Issue 2406163004: Simplify the usage of PositionWithAffinity (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file./* 3 // found in the LICENSE file./*
4 4
5 #ifndef PositionWithAffinity_h 5 #ifndef PositionWithAffinity_h
6 #define PositionWithAffinity_h 6 #define PositionWithAffinity_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/editing/Position.h" 9 #include "core/editing/Position.h"
10 #include "core/editing/TextAffinity.h" 10 #include "core/editing/TextAffinity.h"
(...skipping 18 matching lines...) Expand all
29 29
30 // Returns true if both |this| and |other| is null or both |m_position| 30 // Returns true if both |this| and |other| is null or both |m_position|
31 // and |m_affinity| equal. 31 // and |m_affinity| equal.
32 bool operator==(const PositionWithAffinityTemplate& other) const; 32 bool operator==(const PositionWithAffinityTemplate& other) const;
33 bool operator!=(const PositionWithAffinityTemplate& other) const { 33 bool operator!=(const PositionWithAffinityTemplate& other) const {
34 return !operator==(other); 34 return !operator==(other);
35 } 35 }
36 36
37 bool isNotNull() const { return m_position.isNotNull(); } 37 bool isNotNull() const { return m_position.isNotNull(); }
38 bool isNull() const { return m_position.isNull(); } 38 bool isNull() const { return m_position.isNull(); }
39 bool isOrphan() const { return m_position.isOrphan(); }
40 bool isConnected() const { return m_position.isConnected(); }
41
42 Node* anchorNode() const { return m_position.anchorNode(); }
43 Document* document() const { return m_position.document(); }
39 44
40 DEFINE_INLINE_TRACE() { visitor->trace(m_position); } 45 DEFINE_INLINE_TRACE() { visitor->trace(m_position); }
41 46
42 private: 47 private:
43 PositionTemplate<Strategy> m_position; 48 PositionTemplate<Strategy> m_position;
44 TextAffinity m_affinity; 49 TextAffinity m_affinity;
45 }; 50 };
46 51
47 extern template class CORE_EXTERN_TEMPLATE_EXPORT 52 extern template class CORE_EXTERN_TEMPLATE_EXPORT
48 PositionWithAffinityTemplate<EditingStrategy>; 53 PositionWithAffinityTemplate<EditingStrategy>;
(...skipping 24 matching lines...) Expand all
73 } 78 }
74 79
75 CORE_EXPORT std::ostream& operator<<(std::ostream&, 80 CORE_EXPORT std::ostream& operator<<(std::ostream&,
76 const PositionWithAffinity&); 81 const PositionWithAffinity&);
77 CORE_EXPORT std::ostream& operator<<(std::ostream&, 82 CORE_EXPORT std::ostream& operator<<(std::ostream&,
78 const PositionInFlatTreeWithAffinity&); 83 const PositionInFlatTreeWithAffinity&);
79 84
80 } // namespace blink 85 } // namespace blink
81 86
82 #endif // PositionWithAffinity_h 87 #endif // PositionWithAffinity_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | third_party/WebKit/Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698