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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::lastPositio
nInNode(Node* node) | 137 VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::lastPositio
nInNode(Node* node) |
138 { | 138 { |
139 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 139 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
140 // needs to be audited. See http://crbug.com/590369 for more details. | 140 // needs to be audited. See http://crbug.com/590369 for more details. |
141 if (node) | 141 if (node) |
142 node->document().updateStyleAndLayoutIgnorePendingStylesheets(); | 142 node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
143 | 143 |
144 return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strate
gy>::lastPositionInNode(node))); | 144 return create(PositionWithAffinityTemplate<Strategy>(PositionTemplate<Strate
gy>::lastPositionInNode(node))); |
145 } | 145 } |
146 | 146 |
147 VisiblePosition createVisiblePosition(const Position& position, TextAffinity aff
inity) | 147 VisiblePosition createVisiblePositionDeprecated(const Position& position, TextAf
finity affinity) |
148 { | |
149 return createVisiblePosition(PositionWithAffinity(position, affinity)); | |
150 } | |
151 | |
152 VisiblePosition createVisiblePosition(const PositionWithAffinity& positionWithAf
finity) | |
153 { | 148 { |
154 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 149 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
155 // needs to be audited. See http://crbug.com/590369 for more details. | 150 // needs to be audited. See http://crbug.com/590369 for more details. |
| 151 if (position.isNotNull()) |
| 152 position.document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 153 |
| 154 return VisiblePosition::create(PositionWithAffinity(position, affinity)); |
| 155 } |
| 156 |
| 157 VisiblePosition createVisiblePositionDeprecated(const PositionWithAffinity& posi
tionWithAffinity) |
| 158 { |
| 159 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 160 // needs to be audited. See http://crbug.com/590369 for more details. |
156 if (positionWithAffinity.isNotNull()) | 161 if (positionWithAffinity.isNotNull()) |
157 positionWithAffinity.position().document()->updateStyleAndLayoutIgnorePe
ndingStylesheets(); | 162 positionWithAffinity.position().document()->updateStyleAndLayoutIgnorePe
ndingStylesheets(); |
158 | 163 |
159 return VisiblePosition::create(positionWithAffinity); | 164 return VisiblePosition::create(positionWithAffinity); |
160 } | 165 } |
161 | 166 |
162 VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTree& positi
on, TextAffinity affinity) | 167 VisiblePositionInFlatTree createVisiblePositionDeprecated(const PositionInFlatTr
ee& position, TextAffinity affinity) |
163 { | 168 { |
| 169 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 170 // needs to be audited. See http://crbug.com/590369 for more details. |
| 171 if (position.isNotNull()) |
| 172 position.document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 173 |
164 return VisiblePositionInFlatTree::create(PositionInFlatTreeWithAffinity(posi
tion, affinity)); | 174 return VisiblePositionInFlatTree::create(PositionInFlatTreeWithAffinity(posi
tion, affinity)); |
165 } | 175 } |
166 | 176 |
167 VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTreeWithAffi
nity& positionWithAffinity) | 177 VisiblePositionInFlatTree createVisiblePositionDeprecated(const PositionInFlatTr
eeWithAffinity& positionWithAffinity) |
168 { | 178 { |
169 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 179 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
170 // needs to be audited. See http://crbug.com/590369 for more details. | 180 // needs to be audited. See http://crbug.com/590369 for more details. |
171 if (positionWithAffinity.isNotNull()) | 181 if (positionWithAffinity.isNotNull()) |
172 positionWithAffinity.position().document()->updateStyleAndLayoutIgnorePe
ndingStylesheets(); | 182 positionWithAffinity.position().document()->updateStyleAndLayoutIgnorePe
ndingStylesheets(); |
173 | 183 |
174 return VisiblePositionInFlatTree::create(positionWithAffinity); | 184 return VisiblePositionInFlatTree::create(positionWithAffinity); |
175 } | 185 } |
176 | 186 |
| 187 VisiblePosition createVisiblePosition(const Position& position, TextAffinity aff
inity) |
| 188 { |
| 189 return VisiblePosition::create(PositionWithAffinity(position, affinity)); |
| 190 } |
| 191 |
| 192 VisiblePosition createVisiblePosition(const PositionWithAffinity& positionWithAf
finity) |
| 193 { |
| 194 return VisiblePosition::create(positionWithAffinity); |
| 195 } |
| 196 |
| 197 VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTree& positi
on, TextAffinity affinity) |
| 198 { |
| 199 return VisiblePositionInFlatTree::create(PositionInFlatTreeWithAffinity(posi
tion, affinity)); |
| 200 } |
| 201 |
| 202 VisiblePositionInFlatTree createVisiblePosition(const PositionInFlatTreeWithAffi
nity& positionWithAffinity) |
| 203 { |
| 204 return VisiblePositionInFlatTree::create(positionWithAffinity); |
| 205 } |
| 206 |
177 #ifndef NDEBUG | 207 #ifndef NDEBUG |
178 | 208 |
179 template<typename Strategy> | 209 template<typename Strategy> |
180 void VisiblePositionTemplate<Strategy>::showTreeForThis() const | 210 void VisiblePositionTemplate<Strategy>::showTreeForThis() const |
181 { | 211 { |
182 deepEquivalent().showTreeForThis(); | 212 deepEquivalent().showTreeForThis(); |
183 } | 213 } |
184 | 214 |
185 #endif | 215 #endif |
186 | 216 |
(...skipping 22 matching lines...) Expand all Loading... |
209 } | 239 } |
210 DVLOG(0) << "Cannot showTree for (nil) VisiblePosition."; | 240 DVLOG(0) << "Cannot showTree for (nil) VisiblePosition."; |
211 } | 241 } |
212 | 242 |
213 void showTree(const blink::VisiblePosition& vpos) | 243 void showTree(const blink::VisiblePosition& vpos) |
214 { | 244 { |
215 vpos.showTreeForThis(); | 245 vpos.showTreeForThis(); |
216 } | 246 } |
217 | 247 |
218 #endif | 248 #endif |
OLD | NEW |