| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 DCHECK(!needsLayoutTreeUpdate(pos)); | 217 DCHECK(!needsLayoutTreeUpdate(pos)); |
| 218 return VisibleSelection::create(pos, pos, affinity, isDirectional); | 218 return VisibleSelection::create(pos, pos, affinity, isDirectional); |
| 219 } | 219 } |
| 220 | 220 |
| 221 VisibleSelection createVisibleSelection(const Position& base, | 221 VisibleSelection createVisibleSelection(const Position& base, |
| 222 const Position& extent, | 222 const Position& extent, |
| 223 TextAffinity affinity, | 223 TextAffinity affinity, |
| 224 bool isDirectional) { | 224 bool isDirectional) { |
| 225 DCHECK(!needsLayoutTreeUpdate(base)); | 225 DCHECK(!needsLayoutTreeUpdate(base)); |
| 226 DCHECK(!needsLayoutTreeUpdate(extent)); | 226 DCHECK(!needsLayoutTreeUpdate(extent)); |
| 227 DCHECK(base.isNotNull() || extent.isNull()); | 227 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()| |
| 228 // after all call sites have ensured that. |
| 228 return VisibleSelection::create(base, extent, affinity, isDirectional); | 229 return VisibleSelection::create(base, extent, affinity, isDirectional); |
| 229 } | 230 } |
| 230 | 231 |
| 231 VisibleSelection createVisibleSelection(const PositionWithAffinity& pos, | 232 VisibleSelection createVisibleSelection(const PositionWithAffinity& pos, |
| 232 bool isDirectional) { | 233 bool isDirectional) { |
| 233 DCHECK(!needsLayoutTreeUpdate(pos.position())); | 234 DCHECK(!needsLayoutTreeUpdate(pos.position())); |
| 234 return VisibleSelection::create(pos.position(), pos.position(), | 235 return VisibleSelection::create(pos.position(), pos.position(), |
| 235 pos.affinity(), isDirectional); | 236 pos.affinity(), isDirectional); |
| 236 } | 237 } |
| 237 | 238 |
| 238 VisibleSelection createVisibleSelection(const VisiblePosition& pos, | 239 VisibleSelection createVisibleSelection(const VisiblePosition& pos, |
| 239 bool isDirectional) { | 240 bool isDirectional) { |
| 240 DCHECK(pos.isValid()); | 241 DCHECK(pos.isValid()); |
| 241 return VisibleSelection::create(pos.deepEquivalent(), pos.deepEquivalent(), | 242 return VisibleSelection::create(pos.deepEquivalent(), pos.deepEquivalent(), |
| 242 pos.affinity(), isDirectional); | 243 pos.affinity(), isDirectional); |
| 243 } | 244 } |
| 244 | 245 |
| 245 VisibleSelection createVisibleSelection(const VisiblePosition& base, | 246 VisibleSelection createVisibleSelection(const VisiblePosition& base, |
| 246 const VisiblePosition& extent, | 247 const VisiblePosition& extent, |
| 247 bool isDirectional) { | 248 bool isDirectional) { |
| 248 DCHECK(base.isValid()); | 249 DCHECK(base.isValid()); |
| 249 DCHECK(extent.isValid()); | 250 DCHECK(extent.isValid()); |
| 250 DCHECK(base.isNotNull() || extent.isNull()); | 251 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()| |
| 252 // after all call sites have ensured that. |
| 251 return VisibleSelection::create(base.deepEquivalent(), | 253 return VisibleSelection::create(base.deepEquivalent(), |
| 252 extent.deepEquivalent(), base.affinity(), | 254 extent.deepEquivalent(), base.affinity(), |
| 253 isDirectional); | 255 isDirectional); |
| 254 } | 256 } |
| 255 | 257 |
| 256 VisibleSelection createVisibleSelection(const EphemeralRange& range, | 258 VisibleSelection createVisibleSelection(const EphemeralRange& range, |
| 257 TextAffinity affinity, | 259 TextAffinity affinity, |
| 258 bool isDirectional) { | 260 bool isDirectional) { |
| 259 DCHECK(!needsLayoutTreeUpdate(range.startPosition())); | 261 DCHECK(!needsLayoutTreeUpdate(range.startPosition())); |
| 260 DCHECK(!needsLayoutTreeUpdate(range.endPosition())); | 262 DCHECK(!needsLayoutTreeUpdate(range.endPosition())); |
| 261 return VisibleSelection::create(range.startPosition(), range.endPosition(), | 263 return VisibleSelection::create(range.startPosition(), range.endPosition(), |
| 262 affinity, isDirectional); | 264 affinity, isDirectional); |
| 263 } | 265 } |
| 264 | 266 |
| 265 VisibleSelectionInFlatTree createVisibleSelection(const PositionInFlatTree& pos, | 267 VisibleSelectionInFlatTree createVisibleSelection(const PositionInFlatTree& pos, |
| 266 TextAffinity affinity, | 268 TextAffinity affinity, |
| 267 bool isDirectional) { | 269 bool isDirectional) { |
| 268 DCHECK(!needsLayoutTreeUpdate(pos)); | 270 DCHECK(!needsLayoutTreeUpdate(pos)); |
| 269 return VisibleSelectionInFlatTree::create(pos, pos, affinity, isDirectional); | 271 return VisibleSelectionInFlatTree::create(pos, pos, affinity, isDirectional); |
| 270 } | 272 } |
| 271 | 273 |
| 272 VisibleSelectionInFlatTree createVisibleSelection( | 274 VisibleSelectionInFlatTree createVisibleSelection( |
| 273 const PositionInFlatTree& base, | 275 const PositionInFlatTree& base, |
| 274 const PositionInFlatTree& extent, | 276 const PositionInFlatTree& extent, |
| 275 TextAffinity affinity, | 277 TextAffinity affinity, |
| 276 bool isDirectional) { | 278 bool isDirectional) { |
| 277 DCHECK(!needsLayoutTreeUpdate(base)); | 279 DCHECK(!needsLayoutTreeUpdate(base)); |
| 278 DCHECK(!needsLayoutTreeUpdate(extent)); | 280 DCHECK(!needsLayoutTreeUpdate(extent)); |
| 279 DCHECK(base.isNotNull() || extent.isNull()); | 281 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()| |
| 282 // after all call sites have ensured that. |
| 280 return VisibleSelectionInFlatTree::create(base, extent, affinity, | 283 return VisibleSelectionInFlatTree::create(base, extent, affinity, |
| 281 isDirectional); | 284 isDirectional); |
| 282 } | 285 } |
| 283 | 286 |
| 284 VisibleSelectionInFlatTree createVisibleSelection( | 287 VisibleSelectionInFlatTree createVisibleSelection( |
| 285 const PositionInFlatTreeWithAffinity& pos, | 288 const PositionInFlatTreeWithAffinity& pos, |
| 286 bool isDirectional) { | 289 bool isDirectional) { |
| 287 DCHECK(!needsLayoutTreeUpdate(pos.position())); | 290 DCHECK(!needsLayoutTreeUpdate(pos.position())); |
| 288 return VisibleSelectionInFlatTree::create(pos.position(), pos.position(), | 291 return VisibleSelectionInFlatTree::create(pos.position(), pos.position(), |
| 289 pos.affinity(), isDirectional); | 292 pos.affinity(), isDirectional); |
| 290 } | 293 } |
| 291 | 294 |
| 292 VisibleSelectionInFlatTree createVisibleSelection( | 295 VisibleSelectionInFlatTree createVisibleSelection( |
| 293 const VisiblePositionInFlatTree& pos, | 296 const VisiblePositionInFlatTree& pos, |
| 294 bool isDirectional) { | 297 bool isDirectional) { |
| 295 DCHECK(pos.isValid()); | 298 DCHECK(pos.isValid()); |
| 296 return VisibleSelectionInFlatTree::create(pos.deepEquivalent(), | 299 return VisibleSelectionInFlatTree::create(pos.deepEquivalent(), |
| 297 pos.deepEquivalent(), | 300 pos.deepEquivalent(), |
| 298 pos.affinity(), isDirectional); | 301 pos.affinity(), isDirectional); |
| 299 } | 302 } |
| 300 | 303 |
| 301 VisibleSelectionInFlatTree createVisibleSelection( | 304 VisibleSelectionInFlatTree createVisibleSelection( |
| 302 const VisiblePositionInFlatTree& base, | 305 const VisiblePositionInFlatTree& base, |
| 303 const VisiblePositionInFlatTree& extent, | 306 const VisiblePositionInFlatTree& extent, |
| 304 bool isDirectional) { | 307 bool isDirectional) { |
| 305 DCHECK(base.isValid()); | 308 DCHECK(base.isValid()); |
| 306 DCHECK(extent.isValid()); | 309 DCHECK(extent.isValid()); |
| 307 DCHECK(base.isNotNull() || extent.isNull()); | 310 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()| |
| 311 // after all call sites have ensured that. |
| 308 return VisibleSelectionInFlatTree::create(base.deepEquivalent(), | 312 return VisibleSelectionInFlatTree::create(base.deepEquivalent(), |
| 309 extent.deepEquivalent(), | 313 extent.deepEquivalent(), |
| 310 base.affinity(), isDirectional); | 314 base.affinity(), isDirectional); |
| 311 } | 315 } |
| 312 | 316 |
| 313 VisibleSelectionInFlatTree createVisibleSelection( | 317 VisibleSelectionInFlatTree createVisibleSelection( |
| 314 const EphemeralRangeInFlatTree& range, | 318 const EphemeralRangeInFlatTree& range, |
| 315 TextAffinity affinity, | 319 TextAffinity affinity, |
| 316 bool isDirectional) { | 320 bool isDirectional) { |
| 317 DCHECK(!needsLayoutTreeUpdate(range.startPosition())); | 321 DCHECK(!needsLayoutTreeUpdate(range.startPosition())); |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 | 1122 |
| 1119 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 1123 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 1120 sel.showTreeForThis(); | 1124 sel.showTreeForThis(); |
| 1121 } | 1125 } |
| 1122 | 1126 |
| 1123 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 1127 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 1124 if (sel) | 1128 if (sel) |
| 1125 sel->showTreeForThis(); | 1129 sel->showTreeForThis(); |
| 1126 } | 1130 } |
| 1127 #endif | 1131 #endif |
| OLD | NEW |