Commit 449c0265 authored by yoichio's avatar yoichio Committed by Commit bot

[Editing] Add SelectionTemplate::showTreeForThis()

This CL copies from |VisibleSelection::showTreeForThis()| and renames
 following "base" and "extend".

TEST=No change in behavior

Review-Url: https://codereview.chromium.org/2533693002
Cr-Commit-Position: refs/heads/master@{#442836}
parent 2ea32a80
...@@ -103,6 +103,27 @@ bool SelectionTemplate<Strategy>::assertValid() const { ...@@ -103,6 +103,27 @@ bool SelectionTemplate<Strategy>::assertValid() const {
} }
#endif #endif
#ifndef NDEBUG
template <typename Strategy>
void SelectionTemplate<Strategy>::showTreeForThis() const {
if (m_base.isNull()) {
LOG(INFO) << "\nbase is null";
return;
}
LOG(INFO) << "\n"
<< m_base.anchorNode()
->toMarkedTreeString(m_base.anchorNode(), "B",
m_extent.anchorNode(), "E")
.utf8()
.data()
<< "base: " << m_base.toAnchorTypeAndOffsetString().utf8().data()
<< "\n"
<< "extent: "
<< m_extent.toAnchorTypeAndOffsetString().utf8().data();
}
#endif
template <typename Strategy> template <typename Strategy>
void SelectionTemplate<Strategy>::printTo(std::ostream* ostream, void SelectionTemplate<Strategy>::printTo(std::ostream* ostream,
const char* type) const { const char* type) const {
......
...@@ -100,6 +100,9 @@ class CORE_EXPORT SelectionTemplate final { ...@@ -100,6 +100,9 @@ class CORE_EXPORT SelectionTemplate final {
} }
void printTo(std::ostream*, const char* type) const; void printTo(std::ostream*, const char* type) const;
#ifndef NDEBUG
void showTreeForThis() const;
#endif
private: private:
friend class SelectionEditor; friend class SelectionEditor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment