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

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 "wtf/Assertions.h" 7 #include "wtf/Assertions.h"
8 #include <ostream> // NOLINT 8 #include <ostream> // NOLINT
9 9
10 namespace blink { 10 namespace blink {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DCHECK_EQ(m_base.document(), m_extent.document()); 96 DCHECK_EQ(m_base.document(), m_extent.document());
97 return true; 97 return true;
98 } 98 }
99 #else 99 #else
100 template <typename Strategy> 100 template <typename Strategy>
101 bool SelectionTemplate<Strategy>::assertValid() const { 101 bool SelectionTemplate<Strategy>::assertValid() const {
102 return true; 102 return true;
103 } 103 }
104 #endif 104 #endif
105 105
106 #ifndef NDEBUG
107 template <typename Strategy>
108 void SelectionTemplate<Strategy>::showTreeForThis() const {
109 if (m_base.isNull()) {
110 LOG(INFO) << "\nbase is null";
111 return;
112 }
113
114 LOG(INFO) << "\n"
115 << m_base.anchorNode()
116 ->toMarkedTreeString(m_base.anchorNode(), "B",
117 m_extent.anchorNode(), "E")
118 .utf8()
119 .data()
120 << "base: " << m_base.toAnchorTypeAndOffsetString().utf8().data()
121 << "\n"
122 << "extent: "
123 << m_extent.toAnchorTypeAndOffsetString().utf8().data();
124 }
125 #endif
126
106 template <typename Strategy> 127 template <typename Strategy>
107 void SelectionTemplate<Strategy>::printTo(std::ostream* ostream, 128 void SelectionTemplate<Strategy>::printTo(std::ostream* ostream,
108 const char* type) const { 129 const char* type) const {
109 if (isNone()) { 130 if (isNone()) {
110 *ostream << "()"; 131 *ostream << "()";
111 return; 132 return;
112 } 133 }
113 *ostream << type << '('; 134 *ostream << type << '(';
114 #if DCHECK_IS_ON() 135 #if DCHECK_IS_ON()
115 if (m_domTreeVersion != m_base.document()->domTreeVersion()) { 136 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) { 283 SelectionTemplate<Strategy>::Builder::setIsDirectional(bool isDirectional) {
263 m_selection.m_isDirectional = isDirectional; 284 m_selection.m_isDirectional = isDirectional;
264 return *this; 285 return *this;
265 } 286 }
266 287
267 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>; 288 template class CORE_TEMPLATE_EXPORT SelectionTemplate<EditingStrategy>;
268 template class CORE_TEMPLATE_EXPORT 289 template class CORE_TEMPLATE_EXPORT
269 SelectionTemplate<EditingInFlatTreeStrategy>; 290 SelectionTemplate<EditingInFlatTreeStrategy>;
270 291
271 } // namespace blink 292 } // 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