OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 m_affinity = other.m_affinity; | 129 m_affinity = other.m_affinity; |
130 m_changeObserver = 0; | 130 m_changeObserver = 0; |
131 m_selectionType = other.m_selectionType; | 131 m_selectionType = other.m_selectionType; |
132 m_baseIsFirst = other.m_baseIsFirst; | 132 m_baseIsFirst = other.m_baseIsFirst; |
133 m_isDirectional = other.m_isDirectional; | 133 m_isDirectional = other.m_isDirectional; |
134 return *this; | 134 return *this; |
135 } | 135 } |
136 | 136 |
137 VisibleSelection::~VisibleSelection() | 137 VisibleSelection::~VisibleSelection() |
138 { | 138 { |
139 didChange(); | 139 didChange(); |
haraken
2014/05/28 15:35:25
This touches another on-heap object. If you make m
sof
2014/05/28 22:06:06
I'm not sure the generality of a WeakMember is war
| |
140 } | 140 } |
141 | 141 |
142 VisibleSelection VisibleSelection::selectionFromContentsOfNode(Node* node) | 142 VisibleSelection VisibleSelection::selectionFromContentsOfNode(Node* node) |
143 { | 143 { |
144 ASSERT(!editingIgnoresContent(node)); | 144 ASSERT(!editingIgnoresContent(node)); |
145 return VisibleSelection(firstPositionInNode(node), lastPositionInNode(node), DOWNSTREAM); | 145 return VisibleSelection(firstPositionInNode(node), lastPositionInNode(node), DOWNSTREAM); |
146 } | 146 } |
147 | 147 |
148 void VisibleSelection::setBase(const Position& position) | 148 void VisibleSelection::setBase(const Position& position) |
149 { | 149 { |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
753 ASSERT(m_changeObserver); | 753 ASSERT(m_changeObserver); |
754 m_changeObserver = 0; | 754 m_changeObserver = 0; |
755 } | 755 } |
756 | 756 |
757 void VisibleSelection::didChange() | 757 void VisibleSelection::didChange() |
758 { | 758 { |
759 if (m_changeObserver) | 759 if (m_changeObserver) |
760 m_changeObserver->didChangeVisibleSelection(); | 760 m_changeObserver->didChangeVisibleSelection(); |
761 } | 761 } |
762 | 762 |
763 void VisibleSelection::trace(Visitor* visitor) | |
764 { | |
765 visitor->trace(m_base); | |
766 visitor->trace(m_extent); | |
767 visitor->trace(m_start); | |
768 visitor->trace(m_end); | |
769 } | |
770 | |
763 #ifndef NDEBUG | 771 #ifndef NDEBUG |
764 | 772 |
765 void VisibleSelection::debugPosition() const | 773 void VisibleSelection::debugPosition() const |
766 { | 774 { |
767 fprintf(stderr, "VisibleSelection ===============\n"); | 775 fprintf(stderr, "VisibleSelection ===============\n"); |
768 | 776 |
769 if (!m_start.anchorNode()) | 777 if (!m_start.anchorNode()) |
770 fputs("pos: null", stderr); | 778 fputs("pos: null", stderr); |
771 else if (m_start == m_end) { | 779 else if (m_start == m_end) { |
772 fprintf(stderr, "pos: %s ", m_start.anchorNode()->nodeName().utf8().da ta()); | 780 fprintf(stderr, "pos: %s ", m_start.anchorNode()->nodeName().utf8().da ta()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 sel.showTreeForThis(); | 832 sel.showTreeForThis(); |
825 } | 833 } |
826 | 834 |
827 void showTree(const WebCore::VisibleSelection* sel) | 835 void showTree(const WebCore::VisibleSelection* sel) |
828 { | 836 { |
829 if (sel) | 837 if (sel) |
830 sel->showTreeForThis(); | 838 sel->showTreeForThis(); |
831 } | 839 } |
832 | 840 |
833 #endif | 841 #endif |
OLD | NEW |