| 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 { | 1198 { |
| 1199 m_visibleSelection.appendTrailingWhitespace(); | 1199 m_visibleSelection.appendTrailingWhitespace(); |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 template <typename Strategy> | 1202 template <typename Strategy> |
| 1203 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::selection
FromContentsOfNode(Node* node) | 1203 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::selection
FromContentsOfNode(Node* node) |
| 1204 { | 1204 { |
| 1205 return VisibleSelectionTemplate<Strategy>(VisibleSelection::selectionFromCon
tentsOfNode(node)); | 1205 return VisibleSelectionTemplate<Strategy>(VisibleSelection::selectionFromCon
tentsOfNode(node)); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 template <> | 1208 template <> CORE_TEMPLATE_EXPORT |
| 1209 bool VisibleSelectionTemplate<EditingStrategy>::operator==(const VisibleSelectio
nTemplate<EditingStrategy>& other) const | 1209 bool VisibleSelectionTemplate<EditingStrategy>::operator==(const VisibleSelectio
nTemplate<EditingStrategy>& other) const |
| 1210 { | 1210 { |
| 1211 return equalSelectionsInDOMTree(m_visibleSelection, other.m_visibleSelection
); | 1211 return equalSelectionsInDOMTree(m_visibleSelection, other.m_visibleSelection
); |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 template <> | 1214 template <> CORE_TEMPLATE_EXPORT |
| 1215 Position VisibleSelectionTemplate<EditingStrategy>::base() const | 1215 Position VisibleSelectionTemplate<EditingStrategy>::base() const |
| 1216 { | 1216 { |
| 1217 return m_visibleSelection.base(); | 1217 return m_visibleSelection.base(); |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 template <> | 1220 template <> CORE_TEMPLATE_EXPORT |
| 1221 Position VisibleSelectionTemplate<EditingStrategy>::extent() const | 1221 Position VisibleSelectionTemplate<EditingStrategy>::extent() const |
| 1222 { | 1222 { |
| 1223 return m_visibleSelection.extent(); | 1223 return m_visibleSelection.extent(); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 template <> | 1226 template <> CORE_TEMPLATE_EXPORT |
| 1227 Position VisibleSelectionTemplate<EditingStrategy>::start() const | 1227 Position VisibleSelectionTemplate<EditingStrategy>::start() const |
| 1228 { | 1228 { |
| 1229 return m_visibleSelection.start(); | 1229 return m_visibleSelection.start(); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 template <> | 1232 template <> CORE_TEMPLATE_EXPORT |
| 1233 Position VisibleSelectionTemplate<EditingStrategy>::end() const | 1233 Position VisibleSelectionTemplate<EditingStrategy>::end() const |
| 1234 { | 1234 { |
| 1235 return m_visibleSelection.end(); | 1235 return m_visibleSelection.end(); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 template <> | 1238 template <> CORE_TEMPLATE_EXPORT |
| 1239 VisiblePosition VisibleSelectionTemplate<EditingStrategy>::visibleStart() const | 1239 VisiblePosition VisibleSelectionTemplate<EditingStrategy>::visibleStart() const |
| 1240 { | 1240 { |
| 1241 return m_visibleSelection.visibleStart(); | 1241 return m_visibleSelection.visibleStart(); |
| 1242 } | 1242 } |
| 1243 | 1243 |
| 1244 template <> | 1244 template <> CORE_TEMPLATE_EXPORT |
| 1245 VisiblePosition VisibleSelectionTemplate<EditingStrategy>::visibleEnd() const | 1245 VisiblePosition VisibleSelectionTemplate<EditingStrategy>::visibleEnd() const |
| 1246 { | 1246 { |
| 1247 return m_visibleSelection.visibleEnd(); | 1247 return m_visibleSelection.visibleEnd(); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 template <> | 1250 template <> CORE_TEMPLATE_EXPORT |
| 1251 void VisibleSelectionTemplate<EditingStrategy>::setBase(const Position& newBase) | 1251 void VisibleSelectionTemplate<EditingStrategy>::setBase(const Position& newBase) |
| 1252 { | 1252 { |
| 1253 m_visibleSelection.setBase(newBase); | 1253 m_visibleSelection.setBase(newBase); |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 template <> | 1256 template <> CORE_TEMPLATE_EXPORT |
| 1257 void VisibleSelectionTemplate<EditingStrategy>::setExtent(const Position& newExt
ent) | 1257 void VisibleSelectionTemplate<EditingStrategy>::setExtent(const Position& newExt
ent) |
| 1258 { | 1258 { |
| 1259 m_visibleSelection.setExtent(newExtent); | 1259 m_visibleSelection.setExtent(newExtent); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 template <> | 1262 template <> CORE_TEMPLATE_EXPORT |
| 1263 bool VisibleSelectionTemplate<EditingStrategy>::expandUsingGranularity(TextGranu
larity granularity) | 1263 bool VisibleSelectionTemplate<EditingStrategy>::expandUsingGranularity(TextGranu
larity granularity) |
| 1264 { | 1264 { |
| 1265 return m_visibleSelection.expandUsingGranularity(granularity); | 1265 return m_visibleSelection.expandUsingGranularity(granularity); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 template <> | 1268 template <> CORE_TEMPLATE_EXPORT |
| 1269 bool VisibleSelectionTemplate<EditingInComposedTreeStrategy>::operator==(const V
isibleSelectionTemplate<EditingInComposedTreeStrategy>& other) const | 1269 bool VisibleSelectionTemplate<EditingInComposedTreeStrategy>::operator==(const V
isibleSelectionTemplate<EditingInComposedTreeStrategy>& other) const |
| 1270 { | 1270 { |
| 1271 return equalSelectionsInComposedTree(m_visibleSelection, other.m_visibleSele
ction); | 1271 return equalSelectionsInComposedTree(m_visibleSelection, other.m_visibleSele
ction); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 template <> | 1274 template <> CORE_TEMPLATE_EXPORT |
| 1275 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
base() const | 1275 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
base() const |
| 1276 { | 1276 { |
| 1277 return m_visibleSelection.baseInComposedTree(); | 1277 return m_visibleSelection.baseInComposedTree(); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 template <> | 1280 template <> CORE_TEMPLATE_EXPORT |
| 1281 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
extent() const | 1281 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
extent() const |
| 1282 { | 1282 { |
| 1283 return m_visibleSelection.extentInComposedTree(); | 1283 return m_visibleSelection.extentInComposedTree(); |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 template <> | 1286 template <> CORE_TEMPLATE_EXPORT |
| 1287 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
start() const | 1287 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
start() const |
| 1288 { | 1288 { |
| 1289 return m_visibleSelection.startInComposedTree(); | 1289 return m_visibleSelection.startInComposedTree(); |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 template <> | 1292 template <> CORE_TEMPLATE_EXPORT |
| 1293 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
end() const | 1293 PositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStrategy>::
end() const |
| 1294 { | 1294 { |
| 1295 return m_visibleSelection.endInComposedTree(); | 1295 return m_visibleSelection.endInComposedTree(); |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 template <> | 1298 template <> CORE_TEMPLATE_EXPORT |
| 1299 VisiblePositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStra
tegy>::visibleStart() const | 1299 VisiblePositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStra
tegy>::visibleStart() const |
| 1300 { | 1300 { |
| 1301 return createVisiblePosition(m_visibleSelection.startInComposedTree(), isRan
ge() ? TextAffinity::Downstream : affinity()); | 1301 return createVisiblePosition(m_visibleSelection.startInComposedTree(), isRan
ge() ? TextAffinity::Downstream : affinity()); |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 template <> | 1304 template <> CORE_TEMPLATE_EXPORT |
| 1305 VisiblePositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStra
tegy>::visibleEnd() const | 1305 VisiblePositionInComposedTree VisibleSelectionTemplate<EditingInComposedTreeStra
tegy>::visibleEnd() const |
| 1306 { | 1306 { |
| 1307 return createVisiblePosition(m_visibleSelection.endInComposedTree(), isRange
() ? TextAffinity::Upstream : affinity()); | 1307 return createVisiblePosition(m_visibleSelection.endInComposedTree(), isRange
() ? TextAffinity::Upstream : affinity()); |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 template <> | 1310 template <> CORE_TEMPLATE_EXPORT |
| 1311 void VisibleSelectionTemplate<EditingInComposedTreeStrategy>::setBase(const Posi
tionInComposedTree& newBase) | 1311 void VisibleSelectionTemplate<EditingInComposedTreeStrategy>::setBase(const Posi
tionInComposedTree& newBase) |
| 1312 { | 1312 { |
| 1313 m_visibleSelection.setBase(newBase); | 1313 m_visibleSelection.setBase(newBase); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 template <> | 1316 template <> CORE_TEMPLATE_EXPORT |
| 1317 void VisibleSelectionTemplate<EditingInComposedTreeStrategy>::setExtent(const Po
sitionInComposedTree& newExtent) | 1317 void VisibleSelectionTemplate<EditingInComposedTreeStrategy>::setExtent(const Po
sitionInComposedTree& newExtent) |
| 1318 { | 1318 { |
| 1319 m_visibleSelection.setExtent(newExtent); | 1319 m_visibleSelection.setExtent(newExtent); |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 template <> | 1322 template <> CORE_TEMPLATE_EXPORT |
| 1323 bool VisibleSelectionTemplate<EditingInComposedTreeStrategy>::expandUsingGranula
rity(TextGranularity granularity) | 1323 bool VisibleSelectionTemplate<EditingInComposedTreeStrategy>::expandUsingGranula
rity(TextGranularity granularity) |
| 1324 { | 1324 { |
| 1325 return m_visibleSelection.expandUsingGranularityInComposedTree(granularity); | 1325 return m_visibleSelection.expandUsingGranularityInComposedTree(granularity); |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 #ifndef NDEBUG | 1328 #ifndef NDEBUG |
| 1329 | 1329 |
| 1330 void VisibleSelection::debugPosition(const char* message) const | 1330 void VisibleSelection::debugPosition(const char* message) const |
| 1331 { | 1331 { |
| 1332 fprintf(stderr, "VisibleSelection (%s) ===============\n", message); | 1332 fprintf(stderr, "VisibleSelection (%s) ===============\n", message); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 sel.showTreeForThis(); | 1405 sel.showTreeForThis(); |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 void showTree(const blink::VisibleSelection* sel) | 1408 void showTree(const blink::VisibleSelection* sel) |
| 1409 { | 1409 { |
| 1410 if (sel) | 1410 if (sel) |
| 1411 sel->showTreeForThis(); | 1411 sel->showTreeForThis(); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 #endif | 1414 #endif |
| OLD | NEW |