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

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

Issue 1191283002: Make VisiblePosition::init to not use being constructed object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-22T15:06:30 Change for float-list-changed-before-layout-crash.html 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 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/dom/Position.h" 9 #include "core/dom/Position.h"
10 #include "core/editing/TextAffinity.h" 10 #include "core/editing/TextAffinity.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 template <typename Position> 14 template <typename Position>
15 class CORE_TEMPLATE_CLASS_EXPORT PositionWithAffinityTemplate { 15 class CORE_TEMPLATE_CLASS_EXPORT PositionWithAffinityTemplate {
16 DISALLOW_ALLOCATION(); 16 DISALLOW_ALLOCATION();
17 public: 17 public:
18 typedef Position PositionType; 18 typedef Position PositionType;
19 19
20 PositionWithAffinityTemplate(const PositionType&, EAffinity = DOWNSTREAM); 20 PositionWithAffinityTemplate(const PositionType&, EAffinity = DOWNSTREAM);
21 PositionWithAffinityTemplate(); 21 PositionWithAffinityTemplate();
22 ~PositionWithAffinityTemplate(); 22 ~PositionWithAffinityTemplate();
23 23
24 EAffinity affinity() const { return m_affinity; } 24 EAffinity affinity() const { return m_affinity; }
25 const PositionType& position() const { return m_position; } 25 const PositionType& position() const { return m_position; }
26 26
27 bool operator==(const PositionWithAffinityTemplate& other) const;
28 bool operator!=(const PositionWithAffinityTemplate& other) const { return !o perator==(other); }
29
30 bool isNotNull() const { return m_position.isNotNull(); }
31 bool isNull() const { return m_position.isNull(); }
32
27 DEFINE_INLINE_TRACE() 33 DEFINE_INLINE_TRACE()
28 { 34 {
29 visitor->trace(m_position); 35 visitor->trace(m_position);
30 } 36 }
31 37
32 private: 38 private:
33 PositionType m_position; 39 PositionType m_position;
34 EAffinity m_affinity; 40 EAffinity m_affinity;
35 }; 41 };
36 42
37 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionWithAffinityTemplate<P osition>; 43 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionWithAffinityTemplate<P osition>;
38 44
39 using PositionWithAffinity = PositionWithAffinityTemplate<Position>; 45 using PositionWithAffinity = PositionWithAffinityTemplate<Position>;
40 46
41 } // namespace blink 47 } // namespace blink
42 48
43 #endif // PositionWithAffinity_h 49 #endif // PositionWithAffinity_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/PositionWithAffinity.cpp » ('j') | Source/core/editing/PositionWithAffinity.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698