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