| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/editing/Position.h" | |
| 6 #include <ios> | |
| 7 #include <ostream> // NOLINT | |
| 8 | |
| 9 namespace blink { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 template <typename PositionType> | |
| 14 std::ostream& printPosition(std::ostream& ostream, const PositionType& position) | |
| 15 { | |
| 16 if (position.isNull()) | |
| 17 return ostream << "null"; | |
| 18 ostream << position.anchorNode() << "@"; | |
| 19 if (position.isOffsetInAnchor()) | |
| 20 return ostream << position.offsetInContainerNode(); | |
| 21 return ostream << position.anchorType(); | |
| 22 } | |
| 23 | |
| 24 } // namespace | |
| 25 | |
| 26 std::ostream& operator<<(std::ostream& ostream, PositionAnchorType anchorType) | |
| 27 { | |
| 28 switch (anchorType) { | |
| 29 case PositionAnchorType::AfterAnchor: | |
| 30 return ostream << "afterAnchor"; | |
| 31 case PositionAnchorType::AfterChildren: | |
| 32 return ostream << "afterChildren"; | |
| 33 case PositionAnchorType::BeforeAnchor: | |
| 34 return ostream << "beforeAnchor"; | |
| 35 case PositionAnchorType::BeforeChildren: | |
| 36 return ostream << "beforeChildren"; | |
| 37 case PositionAnchorType::OffsetInAnchor: | |
| 38 return ostream << "offsetInAnchor"; | |
| 39 } | |
| 40 ASSERT_NOT_REACHED(); | |
| 41 return ostream << "anchorType=" << static_cast<int>(anchorType); | |
| 42 } | |
| 43 | |
| 44 std::ostream& operator<<(std::ostream& ostream, const Position& position) | |
| 45 { | |
| 46 return printPosition(ostream, position); | |
| 47 } | |
| 48 | |
| 49 std::ostream& operator<<(std::ostream& ostream, const PositionInFlatTree& positi
on) | |
| 50 { | |
| 51 return printPosition(ostream, position); | |
| 52 } | |
| 53 | |
| 54 } // namespace blink | |
| OLD | NEW |