OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. | 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 VisiblePosition createVisiblePosition(const Position& position, TextAffinity aff
inity) | 80 VisiblePosition createVisiblePosition(const Position& position, TextAffinity aff
inity) |
81 { | 81 { |
82 return createVisiblePosition(PositionWithAffinity(position, affinity)); | 82 return createVisiblePosition(PositionWithAffinity(position, affinity)); |
83 } | 83 } |
84 | 84 |
85 VisiblePosition createVisiblePosition(const PositionWithAffinity& positionWithAf
finity) | 85 VisiblePosition createVisiblePosition(const PositionWithAffinity& positionWithAf
finity) |
86 { | 86 { |
87 return VisiblePosition::create(positionWithAffinity); | 87 return VisiblePosition::create(positionWithAffinity); |
88 } | 88 } |
89 | 89 |
90 VisiblePositionInComposedTree createVisiblePosition(const PositionInComposedTree
& position, TextAffinity affinity) | 90 VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTree& positi
on, TextAffinity affinity) |
91 { | 91 { |
92 return VisiblePositionInComposedTree::create(PositionInComposedTreeWithAffin
ity(position, affinity)); | 92 return VisiblePositionInFlatTree::create(PositionInFlatTreeWithAffinity(posi
tion, affinity)); |
93 } | 93 } |
94 | 94 |
95 VisiblePositionInComposedTree createVisiblePosition(const PositionInComposedTree
WithAffinity& positionWithAffinity) | 95 VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTreeWithAffi
nity& positionWithAffinity) |
96 { | 96 { |
97 return VisiblePositionInComposedTree::create(positionWithAffinity); | 97 return VisiblePositionInFlatTree::create(positionWithAffinity); |
98 } | 98 } |
99 | 99 |
100 VisiblePosition createVisiblePositionInDOMTree(const Position& position, TextAff
inity affinity) | 100 VisiblePosition createVisiblePositionInDOMTree(const Position& position, TextAff
inity affinity) |
101 { | 101 { |
102 return createVisiblePosition(position, affinity); | 102 return createVisiblePosition(position, affinity); |
103 } | 103 } |
104 | 104 |
105 VisiblePosition createVisiblePositionInDOMTree(const PositionInComposedTree& pos
ition, TextAffinity affinity) | 105 VisiblePosition createVisiblePositionInDOMTree(const PositionInFlatTree& positio
n, TextAffinity affinity) |
106 { | 106 { |
107 const VisiblePositionInComposedTree visiblePosition = createVisiblePosition(
position); | 107 const VisiblePositionInFlatTree visiblePosition = createVisiblePosition(posi
tion); |
108 return createVisiblePosition(toPositionInDOMTree(visiblePosition.deepEquival
ent()), affinity); | 108 return createVisiblePosition(toPositionInDOMTree(visiblePosition.deepEquival
ent()), affinity); |
109 } | 109 } |
110 | 110 |
111 #ifndef NDEBUG | 111 #ifndef NDEBUG |
112 | 112 |
113 template<typename Strategy> | 113 template<typename Strategy> |
114 void VisiblePositionTemplate<Strategy>::debugPosition(const char* msg) const | 114 void VisiblePositionTemplate<Strategy>::debugPosition(const char* msg) const |
115 { | 115 { |
116 if (isNull()) { | 116 if (isNull()) { |
117 fprintf(stderr, "Position [%s]: null\n", msg); | 117 fprintf(stderr, "Position [%s]: null\n", msg); |
(...skipping 10 matching lines...) Expand all Loading... |
128 | 128 |
129 template<typename Strategy> | 129 template<typename Strategy> |
130 void VisiblePositionTemplate<Strategy>::showTreeForThis() const | 130 void VisiblePositionTemplate<Strategy>::showTreeForThis() const |
131 { | 131 { |
132 deepEquivalent().showTreeForThis(); | 132 deepEquivalent().showTreeForThis(); |
133 } | 133 } |
134 | 134 |
135 #endif | 135 #endif |
136 | 136 |
137 template class CORE_TEMPLATE_EXPORT VisiblePositionTemplate<EditingStrategy>; | 137 template class CORE_TEMPLATE_EXPORT VisiblePositionTemplate<EditingStrategy>; |
138 template class CORE_TEMPLATE_EXPORT VisiblePositionTemplate<EditingInComposedTre
eStrategy>; | 138 template class CORE_TEMPLATE_EXPORT VisiblePositionTemplate<EditingInFlatTreeStr
ategy>; |
139 | 139 |
140 } // namespace blink | 140 } // namespace blink |
141 | 141 |
142 #ifndef NDEBUG | 142 #ifndef NDEBUG |
143 | 143 |
144 void showTree(const blink::VisiblePosition* vpos) | 144 void showTree(const blink::VisiblePosition* vpos) |
145 { | 145 { |
146 if (vpos) | 146 if (vpos) |
147 vpos->showTreeForThis(); | 147 vpos->showTreeForThis(); |
148 else | 148 else |
149 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); | 149 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); |
150 } | 150 } |
151 | 151 |
152 void showTree(const blink::VisiblePosition& vpos) | 152 void showTree(const blink::VisiblePosition& vpos) |
153 { | 153 { |
154 vpos.showTreeForThis(); | 154 vpos.showTreeForThis(); |
155 } | 155 } |
156 | 156 |
157 #endif | 157 #endif |
OLD | NEW |