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

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

Issue 2533693002: [Editing] Add SelectionTemplate::showTreeForThis() (Closed)
Patch Set: update Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionTemplate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "core/editing/SelectionTemplate.h" 5 #include "core/editing/SelectionTemplate.h"
6 6
7 #include "core/editing/VisibleSelection.h"
yosin_UTC9 2016/11/30 02:34:31 We should not include "VisibleSelection.h" in Sele
yoichio 2016/11/30 04:45:41 Done.
7 #include "wtf/Assertions.h" 8 #include "wtf/Assertions.h"
8 #include <ostream> // NOLINT 9 #include <ostream> // NOLINT
9 10
10 namespace blink { 11 namespace blink {
11 12
12 template <typename Strategy> 13 template <typename Strategy>
13 SelectionTemplate<Strategy>::SelectionTemplate(const SelectionTemplate& other) 14 SelectionTemplate<Strategy>::SelectionTemplate(const SelectionTemplate& other)
14 : m_base(other.m_base), 15 : m_base(other.m_base),
15 m_extent(other.m_extent), 16 m_extent(other.m_extent),
16 m_affinity(other.m_affinity), 17 m_affinity(other.m_affinity),
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DCHECK_EQ(m_base.document(), m_extent.document()); 97 DCHECK_EQ(m_base.document(), m_extent.document());
97 return true; 98 return true;
98 } 99 }
99 #else 100 #else
100 template <typename Strategy> 101 template <typename Strategy>
101 bool SelectionTemplate<Strategy>::assertValid() const { 102 bool SelectionTemplate<Strategy>::assertValid() const {
102 return true; 103 return true;
103 } 104 }
104 #endif 105 #endif
105 106
107 #ifndef NDEBUG
108 template <typename Strategy>
109 void SelectionTemplate<Strategy>::showTreeForThis() const {
110 if (m_base.isNull()) {
111 LOG(INFO) << "\nbase is null";
112 return;
113 }
114
115 LOG(INFO) << "\n"
116 << m_base.anchorNode()
117 ->toMarkedTreeString(m_base.anchorNode(), "B",
118 m_extent.anchorNode(), "E")
119 .utf8()
120 .data()
121 << "base: " << m_base.toAnchorTypeAndOffsetString().utf8().data()
122 << "\n"
123 << "extent: "
124 << m_extent.toAnchorTypeAndOffsetString().utf8().data();
125 }
126 #endif
127
106 template <typename Strategy> 128 template <typename Strategy>
107 void SelectionTemplate<Strategy>::printTo(std::ostream* ostream, 129 void SelectionTemplate<Strategy>::printTo(std::ostream* ostream,
108 const char* type) const { 130 const char* type) const {
109 if (isNone()) { 131 if (isNone()) {
110 *ostream << "()"; 132 *ostream << "()";
111 return; 133 return;
112 } 134 }
113 *ostream << type << '('; 135 *ostream << type << '(';
114 #if DCHECK_IS_ON() 136 #if DCHECK_IS_ON()
115 if (m_domTreeVersion != m_base.document()->domTreeVersion()) { 137 if (m_domTreeVersion != m_base.document()->domTreeVersion()) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 SelectionTemplate<Strategy>::Builder::setIsDirectional(bool isDirectional) { 284 SelectionTemplate<Strategy>::Builder::setIsDirectional(bool isDirectional) {
263 m_selection.m_isDirectional = isDirectional; 285 m_selection.m_isDirectional = isDirectional;
264 return *this; 286 return *this;
265 } 287 }
266 288
267 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>; 289 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>;
268 template class CORE_TEMPLATE_EXPORT 290 template class CORE_TEMPLATE_EXPORT
269 SelectionTemplate<EditingInFlatTreeStrategy>; 291 SelectionTemplate<EditingInFlatTreeStrategy>;
270 292
271 } // namespace blink 293 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionTemplate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698