| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 596 } |
| 597 default: | 597 default: |
| 598 NOTREACHED(); | 598 NOTREACHED(); |
| 599 return Position(); | 599 return Position(); |
| 600 } | 600 } |
| 601 } | 601 } |
| 602 | 602 |
| 603 #ifndef NDEBUG | 603 #ifndef NDEBUG |
| 604 | 604 |
| 605 template <typename Strategy> | 605 template <typename Strategy> |
| 606 void PositionTemplate<Strategy>::showAnchorTypeAndOffset() const | 606 String PositionTemplate<Strategy>::toAnchorTypeAndOffsetString() const |
| 607 { | 607 { |
| 608 StringBuilder builder; |
| 608 switch (anchorType()) { | 609 switch (anchorType()) { |
| 609 case PositionAnchorType::OffsetInAnchor: | 610 case PositionAnchorType::OffsetInAnchor: |
| 610 fputs("offset", stderr); | 611 builder.append("offset"); |
| 611 break; | 612 break; |
| 612 case PositionAnchorType::BeforeChildren: | 613 case PositionAnchorType::BeforeChildren: |
| 613 fputs("beforeChildren", stderr); | 614 builder.append("beforeChildren"); |
| 614 break; | 615 break; |
| 615 case PositionAnchorType::AfterChildren: | 616 case PositionAnchorType::AfterChildren: |
| 616 fputs("afterChildren", stderr); | 617 builder.append("afterChildren"); |
| 617 break; | 618 break; |
| 618 case PositionAnchorType::BeforeAnchor: | 619 case PositionAnchorType::BeforeAnchor: |
| 619 fputs("before", stderr); | 620 builder.append("before"); |
| 620 break; | 621 break; |
| 621 case PositionAnchorType::AfterAnchor: | 622 case PositionAnchorType::AfterAnchor: |
| 622 fputs("after", stderr); | 623 builder.append("after"); |
| 623 break; | 624 break; |
| 624 } | 625 } |
| 625 fprintf(stderr, ", offset:%d\n", m_offset); | 626 builder.append(", offset:"); |
| 627 builder.append(m_offset); |
| 628 return builder.toString(); |
| 626 } | 629 } |
| 627 | 630 |
| 628 template <typename Strategy> | 631 template <typename Strategy> |
| 629 void PositionTemplate<Strategy>::showTreeForThis() const | 632 void PositionTemplate<Strategy>::showTreeForThis() const |
| 630 { | 633 { |
| 631 if (!anchorNode()) | 634 if (!anchorNode()) |
| 632 return; | 635 return; |
| 633 // TODO(tkent): Replace WTFLogAlways with something else. | 636 LOG(INFO) << "\n" |
| 634 WTFLogAlways("%s", anchorNode()->toTreeStringForThis().utf8().data()); | 637 << anchorNode()->toTreeStringForThis().utf8().data() |
| 635 showAnchorTypeAndOffset(); | 638 << toAnchorTypeAndOffsetString().utf8().data(); |
| 636 } | 639 } |
| 637 | 640 |
| 638 template <typename Strategy> | 641 template <typename Strategy> |
| 639 void PositionTemplate<Strategy>::showTreeForThisInFlatTree() const | 642 void PositionTemplate<Strategy>::showTreeForThisInFlatTree() const |
| 640 { | 643 { |
| 641 if (!anchorNode()) | 644 if (!anchorNode()) |
| 642 return; | 645 return; |
| 643 // TODO(tkent): Replace WTFLogAlways with something else. | 646 LOG(INFO) << "\n" |
| 644 WTFLogAlways("%s", anchorNode()->toFlatTreeStringForThis().utf8().data()); | 647 << anchorNode()->toFlatTreeStringForThis().utf8().data() |
| 645 showAnchorTypeAndOffset(); | 648 << toAnchorTypeAndOffsetString().utf8().data(); |
| 646 } | 649 } |
| 647 | 650 |
| 648 #endif | 651 #endif |
| 649 | 652 |
| 650 template <typename PositionType> | 653 template <typename PositionType> |
| 651 static std::ostream& printPosition(std::ostream& ostream, const PositionType& po
sition) | 654 static std::ostream& printPosition(std::ostream& ostream, const PositionType& po
sition) |
| 652 { | 655 { |
| 653 if (position.isNull()) | 656 if (position.isNull()) |
| 654 return ostream << "null"; | 657 return ostream << "null"; |
| 655 ostream << position.anchorNode() << "@"; | 658 ostream << position.anchorNode() << "@"; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 703 |
| 701 void showTree(const blink::Position* pos) | 704 void showTree(const blink::Position* pos) |
| 702 { | 705 { |
| 703 if (pos) | 706 if (pos) |
| 704 pos->showTreeForThis(); | 707 pos->showTreeForThis(); |
| 705 else | 708 else |
| 706 fprintf(stderr, "Cannot showTree for (nil)\n"); | 709 fprintf(stderr, "Cannot showTree for (nil)\n"); |
| 707 } | 710 } |
| 708 | 711 |
| 709 #endif | 712 #endif |
| OLD | NEW |