Changeset 195237 in webkit
- Timestamp:
- Jan 18, 2016 1:27:53 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195235 r195237 1 2016-01-18 Simon Fraser <simon.fraser@apple.com> 2 3 Add TextStream-based logging for Position and VisiblePosition 4 https://bugs.webkit.org/show_bug.cgi?id=153195 5 6 Reviewed by Ryosuke Niwa. 7 8 Make it easy to dump Positions and VisiblePositions with a TextStream. 9 10 * dom/Position.cpp: 11 (WebCore::operator<<): 12 * dom/Position.h: 13 * editing/VisiblePosition.cpp: 14 (WebCore::operator<<): 15 * editing/VisiblePosition.h: 16 1 17 2016-01-18 Zan Dobersek <zdobersek@igalia.com> 2 18 -
trunk/Source/WebCore/dom/Position.cpp
r192170 r195237 45 45 #include "Text.h" 46 46 #include "TextIterator.h" 47 #include "TextStream.h" 47 48 #include "VisiblePosition.h" 48 49 #include "VisibleUnits.h" … … 1550 1551 } 1551 1552 1553 static TextStream& operator<<(TextStream& stream, Position::AnchorType anchorType) 1554 { 1555 switch (anchorType) { 1556 case Position::PositionIsOffsetInAnchor: 1557 stream << "offset in anchor"; 1558 break; 1559 case Position::PositionIsBeforeAnchor: 1560 stream << "before anchor"; 1561 break; 1562 case Position::PositionIsAfterAnchor: 1563 stream << "after anchor"; 1564 break; 1565 case Position::PositionIsBeforeChildren: 1566 stream << "before children"; 1567 break; 1568 case Position::PositionIsAfterChildren: 1569 stream << "after children"; 1570 break; 1571 } 1572 return stream; 1573 } 1574 1575 TextStream& operator<<(TextStream& stream, const Position& position) 1576 { 1577 TextStream::GroupScope scope(stream); 1578 stream << "Position " << &position; 1579 1580 stream.dumpProperty("anchor node", position.anchorNode()); 1581 stream.dumpProperty("offset", position.offsetInContainerNode()); 1582 stream.dumpProperty("anchor type", position.anchorType()); 1583 1584 return stream; 1585 } 1586 1552 1587 } // namespace WebCore 1553 1588 -
trunk/Source/WebCore/dom/Position.h
r192170 r195237 45 45 class RenderObject; 46 46 class Text; 47 class TextStream; 47 48 48 49 enum PositionMoveType { … … 344 345 } 345 346 347 TextStream& operator<<(TextStream&, const Position&); 348 346 349 } // namespace WebCore 347 350 -
trunk/Source/WebCore/editing/VisiblePosition.cpp
r192170 r195237 38 38 #include "RootInlineBox.h" 39 39 #include "Text.h" 40 #include "TextStream.h" 40 41 #include "VisibleUnits.h" 41 42 #include "htmlediting.h" … … 749 750 } 750 751 752 TextStream& operator<<(TextStream& stream, EAffinity affinity) 753 { 754 switch (affinity) { 755 case UPSTREAM: 756 stream << "upstream"; 757 break; 758 case DOWNSTREAM: 759 stream << "downstream"; 760 break; 761 } 762 return stream; 763 } 764 765 TextStream& operator<<(TextStream& stream, const VisiblePosition& visiblePosition) 766 { 767 TextStream::GroupScope scope(stream); 768 stream << "VisiblePosition " << &visiblePosition; 769 770 stream.dumpProperty("position", visiblePosition.deepEquivalent()); 771 stream.dumpProperty("affinity", visiblePosition.affinity()); 772 773 return stream; 774 } 775 751 776 } // namespace WebCore 752 777 -
trunk/Source/WebCore/editing/VisiblePosition.h
r192170 r195237 48 48 class InlineBox; 49 49 class Node; 50 class TextStream; 50 51 51 52 class VisiblePosition { … … 164 165 bool isLastVisiblePositionInNode(const VisiblePosition&, const Node*); 165 166 167 TextStream& operator<<(TextStream&, EAffinity); 168 TextStream& operator<<(TextStream&, const VisiblePosition&); 169 166 170 } // namespace WebCore 167 171
Note: See TracChangeset
for help on using the changeset viewer.