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

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

Issue 2973583002: Get rid of SelectionTemplate::has_trailing_whitespace_ (Closed)
Patch Set: 2017-07-05T15:40:09 Created 3 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 SelectionTemplate_h 5 #ifndef SelectionTemplate_h
6 #define SelectionTemplate_h 6 #define SelectionTemplate_h
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // |extent| can be non-null while |base| is null, which is undesired. 59 // |extent| can be non-null while |base| is null, which is undesired.
60 // Note: This function should be used only in "core/editing/commands". 60 // Note: This function should be used only in "core/editing/commands".
61 // TODO(yosin): Once all we get rid of all call sites, we remove this. 61 // TODO(yosin): Once all we get rid of all call sites, we remove this.
62 Builder& SetBaseAndExtentDeprecated( 62 Builder& SetBaseAndExtentDeprecated(
63 const PositionTemplate<Strategy>& base, 63 const PositionTemplate<Strategy>& base,
64 const PositionTemplate<Strategy>& extent); 64 const PositionTemplate<Strategy>& extent);
65 65
66 Builder& SetAffinity(TextAffinity); 66 Builder& SetAffinity(TextAffinity);
67 Builder& SetGranularity(TextGranularity); 67 Builder& SetGranularity(TextGranularity);
68 Builder& SetHasTrailingWhitespace(bool);
69 Builder& SetIsDirectional(bool); 68 Builder& SetIsDirectional(bool);
70 Builder& SetIsHandleVisible(bool); 69 Builder& SetIsHandleVisible(bool);
71 70
72 private: 71 private:
73 SelectionTemplate selection_; 72 SelectionTemplate selection_;
74 73
75 DISALLOW_COPY_AND_ASSIGN(Builder); 74 DISALLOW_COPY_AND_ASSIGN(Builder);
76 }; 75 };
77 76
78 SelectionTemplate(const SelectionTemplate& other); 77 SelectionTemplate(const SelectionTemplate& other);
79 SelectionTemplate(); 78 SelectionTemplate();
80 79
81 SelectionTemplate& operator=(const SelectionTemplate&) = default; 80 SelectionTemplate& operator=(const SelectionTemplate&) = default;
82 81
83 bool operator==(const SelectionTemplate&) const; 82 bool operator==(const SelectionTemplate&) const;
84 bool operator!=(const SelectionTemplate&) const; 83 bool operator!=(const SelectionTemplate&) const;
85 84
86 const PositionTemplate<Strategy>& Base() const; 85 const PositionTemplate<Strategy>& Base() const;
87 const PositionTemplate<Strategy>& Extent() const; 86 const PositionTemplate<Strategy>& Extent() const;
88 TextAffinity Affinity() const { return affinity_; } 87 TextAffinity Affinity() const { return affinity_; }
89 TextGranularity Granularity() const { return granularity_; } 88 TextGranularity Granularity() const { return granularity_; }
90 bool HasTrailingWhitespace() const { return has_trailing_whitespace_; }
91 bool IsCaret() const; 89 bool IsCaret() const;
92 bool IsDirectional() const { return is_directional_; } 90 bool IsDirectional() const { return is_directional_; }
93 bool IsHandleVisible() const { return is_handle_visible_; } 91 bool IsHandleVisible() const { return is_handle_visible_; }
94 bool IsNone() const { return base_.IsNull(); } 92 bool IsNone() const { return base_.IsNull(); }
95 bool IsRange() const; 93 bool IsRange() const;
96 94
97 // Returns true if |this| selection holds valid values otherwise it causes 95 // Returns true if |this| selection holds valid values otherwise it causes
98 // assertion failure. 96 // assertion failure.
99 bool AssertValid() const; 97 bool AssertValid() const;
100 bool AssertValidFor(const Document&) const; 98 bool AssertValidFor(const Document&) const;
(...skipping 17 matching lines...) Expand all
118 116
119 private: 117 private:
120 friend class SelectionEditor; 118 friend class SelectionEditor;
121 119
122 Document* GetDocument() const; 120 Document* GetDocument() const;
123 121
124 PositionTemplate<Strategy> base_; 122 PositionTemplate<Strategy> base_;
125 PositionTemplate<Strategy> extent_; 123 PositionTemplate<Strategy> extent_;
126 TextAffinity affinity_ = TextAffinity::kDownstream; 124 TextAffinity affinity_ = TextAffinity::kDownstream;
127 TextGranularity granularity_ = kCharacterGranularity; 125 TextGranularity granularity_ = kCharacterGranularity;
128 bool has_trailing_whitespace_ = false;
129 bool is_directional_ = false; 126 bool is_directional_ = false;
130 bool is_handle_visible_ = false; 127 bool is_handle_visible_ = false;
131 #if DCHECK_IS_ON() 128 #if DCHECK_IS_ON()
132 uint64_t dom_tree_version_; 129 uint64_t dom_tree_version_;
133 #endif 130 #endif
134 }; 131 };
135 132
136 extern template class CORE_EXTERN_TEMPLATE_EXPORT 133 extern template class CORE_EXTERN_TEMPLATE_EXPORT
137 SelectionTemplate<EditingStrategy>; 134 SelectionTemplate<EditingStrategy>;
138 extern template class CORE_EXTERN_TEMPLATE_EXPORT 135 extern template class CORE_EXTERN_TEMPLATE_EXPORT
139 SelectionTemplate<EditingInFlatTreeStrategy>; 136 SelectionTemplate<EditingInFlatTreeStrategy>;
140 137
141 using SelectionInDOMTree = SelectionTemplate<EditingStrategy>; 138 using SelectionInDOMTree = SelectionTemplate<EditingStrategy>;
142 using SelectionInFlatTree = SelectionTemplate<EditingInFlatTreeStrategy>; 139 using SelectionInFlatTree = SelectionTemplate<EditingInFlatTreeStrategy>;
143 140
144 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInDOMTree&); 141 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInDOMTree&);
145 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInFlatTree&); 142 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInFlatTree&);
146 143
147 } // namespace blink 144 } // namespace blink
148 145
149 #endif // SelectionTemplate_h 146 #endif // SelectionTemplate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698