| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCur
rentWord.deepEquivalent() == previousWordPosition(nextWordPosition(originalPosit
ion)).deepEquivalent(); | 169 bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCur
rentWord.deepEquivalent() == previousWordPosition(nextWordPosition(originalPosit
ion)).deepEquivalent(); |
| 170 if (movingBackwardsMovedPositionToStartOfCurrentWord) | 170 if (movingBackwardsMovedPositionToStartOfCurrentWord) |
| 171 positionAfterCurrentWord = positionAfterSpacingAndFollowingWord; | 171 positionAfterCurrentWord = positionAfterSpacingAndFollowingWord; |
| 172 } | 172 } |
| 173 return positionAfterCurrentWord; | 173 return positionAfterCurrentWord; |
| 174 } | 174 } |
| 175 | 175 |
| 176 static void adjustPositionForUserSelectAll(VisiblePosition& pos, bool isForward) | 176 static void adjustPositionForUserSelectAll(VisiblePosition& pos, bool isForward) |
| 177 { | 177 { |
| 178 if (Node* rootUserSelectAll = EditingStrategy::rootUserSelectAllForNode(pos.
deepEquivalent().anchorNode())) | 178 if (Node* rootUserSelectAll = EditingStrategy::rootUserSelectAllForNode(pos.
deepEquivalent().anchorNode())) |
| 179 pos = createVisiblePosition(isForward ? mostForwardCaretPosition(Positio
n::afterNode(rootUserSelectAll), CanCrossEditingBoundary) : mostBackwardCaretPos
ition(Position::beforeNode(rootUserSelectAll), CanCrossEditingBoundary)); | 179 pos = createVisiblePositionDeprecated(isForward ? mostForwardCaretPositi
on(Position::afterNode(rootUserSelectAll), CanCrossEditingBoundary) : mostBackwa
rdCaretPosition(Position::beforeNode(rootUserSelectAll), CanCrossEditingBoundary
)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 VisiblePosition SelectionModifier::modifyExtendingRight(TextGranularity granular
ity) | 182 VisiblePosition SelectionModifier::modifyExtendingRight(TextGranularity granular
ity) |
| 183 { | 183 { |
| 184 VisiblePosition pos = createVisiblePosition(m_selection.extent(), m_selectio
n.affinity()); | 184 VisiblePosition pos = createVisiblePositionDeprecated(m_selection.extent(),
m_selection.affinity()); |
| 185 | 185 |
| 186 // The difference between modifyExtendingRight and modifyExtendingForward is
: | 186 // The difference between modifyExtendingRight and modifyExtendingForward is
: |
| 187 // modifyExtendingForward always extends forward logically. | 187 // modifyExtendingForward always extends forward logically. |
| 188 // modifyExtendingRight behaves the same as modifyExtendingForward except fo
r extending character or word, | 188 // modifyExtendingRight behaves the same as modifyExtendingForward except fo
r extending character or word, |
| 189 // it extends forward logically if the enclosing block is LTR direction, | 189 // it extends forward logically if the enclosing block is LTR direction, |
| 190 // but it extends backward logically if the enclosing block is RTL direction
. | 190 // but it extends backward logically if the enclosing block is RTL direction
. |
| 191 switch (granularity) { | 191 switch (granularity) { |
| 192 case CharacterGranularity: | 192 case CharacterGranularity: |
| 193 if (directionOfEnclosingBlock() == LTR) | 193 if (directionOfEnclosingBlock() == LTR) |
| 194 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); | 194 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 216 // FIXME: implement all of the above? | 216 // FIXME: implement all of the above? |
| 217 pos = modifyExtendingForward(granularity); | 217 pos = modifyExtendingForward(granularity); |
| 218 break; | 218 break; |
| 219 } | 219 } |
| 220 adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR); | 220 adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR); |
| 221 return pos; | 221 return pos; |
| 222 } | 222 } |
| 223 | 223 |
| 224 VisiblePosition SelectionModifier::modifyExtendingForward(TextGranularity granul
arity) | 224 VisiblePosition SelectionModifier::modifyExtendingForward(TextGranularity granul
arity) |
| 225 { | 225 { |
| 226 VisiblePosition pos = createVisiblePosition(m_selection.extent(), m_selectio
n.affinity()); | 226 VisiblePosition pos = createVisiblePositionDeprecated(m_selection.extent(),
m_selection.affinity()); |
| 227 switch (granularity) { | 227 switch (granularity) { |
| 228 case CharacterGranularity: | 228 case CharacterGranularity: |
| 229 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); | 229 pos = nextPositionOf(pos, CanSkipOverEditingBoundary); |
| 230 break; | 230 break; |
| 231 case WordGranularity: | 231 case WordGranularity: |
| 232 pos = nextWordPositionForPlatform(pos); | 232 pos = nextWordPositionForPlatform(pos); |
| 233 break; | 233 break; |
| 234 case SentenceGranularity: | 234 case SentenceGranularity: |
| 235 pos = nextSentencePosition(pos); | 235 pos = nextSentencePosition(pos); |
| 236 break; | 236 break; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 261 return pos; | 261 return pos; |
| 262 } | 262 } |
| 263 | 263 |
| 264 VisiblePosition SelectionModifier::modifyMovingRight(TextGranularity granularity
) | 264 VisiblePosition SelectionModifier::modifyMovingRight(TextGranularity granularity
) |
| 265 { | 265 { |
| 266 VisiblePosition pos; | 266 VisiblePosition pos; |
| 267 switch (granularity) { | 267 switch (granularity) { |
| 268 case CharacterGranularity: | 268 case CharacterGranularity: |
| 269 if (m_selection.isRange()) { | 269 if (m_selection.isRange()) { |
| 270 if (directionOfSelection() == LTR) | 270 if (directionOfSelection() == LTR) |
| 271 pos = createVisiblePosition(m_selection.end(), m_selection.affin
ity()); | 271 pos = createVisiblePositionDeprecated(m_selection.end(), m_selec
tion.affinity()); |
| 272 else | 272 else |
| 273 pos = createVisiblePosition(m_selection.start(), m_selection.aff
inity()); | 273 pos = createVisiblePositionDeprecated(m_selection.start(), m_sel
ection.affinity()); |
| 274 } else { | 274 } else { |
| 275 pos = rightPositionOf(createVisiblePosition(m_selection.extent(), m_
selection.affinity())); | 275 pos = rightPositionOf(createVisiblePositionDeprecated(m_selection.ex
tent(), m_selection.affinity())); |
| 276 } | 276 } |
| 277 break; | 277 break; |
| 278 case WordGranularity: { | 278 case WordGranularity: { |
| 279 bool skipsSpaceWhenMovingRight = frame() && frame()->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); | 279 bool skipsSpaceWhenMovingRight = frame() && frame()->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); |
| 280 pos = rightWordPosition(createVisiblePosition(m_selection.extent(), m_se
lection.affinity()), skipsSpaceWhenMovingRight); | 280 pos = rightWordPosition(createVisiblePositionDeprecated(m_selection.exte
nt(), m_selection.affinity()), skipsSpaceWhenMovingRight); |
| 281 break; | 281 break; |
| 282 } | 282 } |
| 283 case SentenceGranularity: | 283 case SentenceGranularity: |
| 284 case LineGranularity: | 284 case LineGranularity: |
| 285 case ParagraphGranularity: | 285 case ParagraphGranularity: |
| 286 case SentenceBoundary: | 286 case SentenceBoundary: |
| 287 case ParagraphBoundary: | 287 case ParagraphBoundary: |
| 288 case DocumentBoundary: | 288 case DocumentBoundary: |
| 289 // FIXME: Implement all of the above. | 289 // FIXME: Implement all of the above. |
| 290 pos = modifyMovingForward(granularity); | 290 pos = modifyMovingForward(granularity); |
| 291 break; | 291 break; |
| 292 case LineBoundary: | 292 case LineBoundary: |
| 293 pos = rightBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock(
)); | 293 pos = rightBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock(
)); |
| 294 break; | 294 break; |
| 295 } | 295 } |
| 296 return pos; | 296 return pos; |
| 297 } | 297 } |
| 298 | 298 |
| 299 VisiblePosition SelectionModifier::modifyMovingForward(TextGranularity granulari
ty) | 299 VisiblePosition SelectionModifier::modifyMovingForward(TextGranularity granulari
ty) |
| 300 { | 300 { |
| 301 VisiblePosition pos; | 301 VisiblePosition pos; |
| 302 // FIXME: Stay in editable content for the less common granularities. | 302 // FIXME: Stay in editable content for the less common granularities. |
| 303 switch (granularity) { | 303 switch (granularity) { |
| 304 case CharacterGranularity: | 304 case CharacterGranularity: |
| 305 if (m_selection.isRange()) | 305 if (m_selection.isRange()) |
| 306 pos = createVisiblePosition(m_selection.end(), m_selection.affinity(
)); | 306 pos = createVisiblePositionDeprecated(m_selection.end(), m_selection
.affinity()); |
| 307 else | 307 else |
| 308 pos = nextPositionOf(createVisiblePosition(m_selection.extent(), m_s
election.affinity()), CanSkipOverEditingBoundary); | 308 pos = nextPositionOf(createVisiblePositionDeprecated(m_selection.ext
ent(), m_selection.affinity()), CanSkipOverEditingBoundary); |
| 309 break; | 309 break; |
| 310 case WordGranularity: | 310 case WordGranularity: |
| 311 pos = nextWordPositionForPlatform(createVisiblePosition(m_selection.exte
nt(), m_selection.affinity())); | 311 pos = nextWordPositionForPlatform(createVisiblePositionDeprecated(m_sele
ction.extent(), m_selection.affinity())); |
| 312 break; | 312 break; |
| 313 case SentenceGranularity: | 313 case SentenceGranularity: |
| 314 pos = nextSentencePosition(createVisiblePosition(m_selection.extent(), m
_selection.affinity())); | 314 pos = nextSentencePosition(createVisiblePositionDeprecated(m_selection.e
xtent(), m_selection.affinity())); |
| 315 break; | 315 break; |
| 316 case LineGranularity: { | 316 case LineGranularity: { |
| 317 // down-arrowing from a range selection that ends at the start of a line
needs | 317 // down-arrowing from a range selection that ends at the start of a line
needs |
| 318 // to leave the selection at that line start (no need to call nextLinePo
sition!) | 318 // to leave the selection at that line start (no need to call nextLinePo
sition!) |
| 319 pos = endForPlatform(); | 319 pos = endForPlatform(); |
| 320 if (!m_selection.isRange() || !isStartOfLine(pos)) | 320 if (!m_selection.isRange() || !isStartOfLine(pos)) |
| 321 pos = nextLinePosition(pos, lineDirectionPointForBlockDirectionNavig
ation(START)); | 321 pos = nextLinePosition(pos, lineDirectionPointForBlockDirectionNavig
ation(START)); |
| 322 break; | 322 break; |
| 323 } | 323 } |
| 324 case ParagraphGranularity: | 324 case ParagraphGranularity: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 339 pos = endOfEditableContent(pos); | 339 pos = endOfEditableContent(pos); |
| 340 else | 340 else |
| 341 pos = endOfDocument(pos); | 341 pos = endOfDocument(pos); |
| 342 break; | 342 break; |
| 343 } | 343 } |
| 344 return pos; | 344 return pos; |
| 345 } | 345 } |
| 346 | 346 |
| 347 VisiblePosition SelectionModifier::modifyExtendingLeft(TextGranularity granulari
ty) | 347 VisiblePosition SelectionModifier::modifyExtendingLeft(TextGranularity granulari
ty) |
| 348 { | 348 { |
| 349 VisiblePosition pos = createVisiblePosition(m_selection.extent(), m_selectio
n.affinity()); | 349 VisiblePosition pos = createVisiblePositionDeprecated(m_selection.extent(),
m_selection.affinity()); |
| 350 | 350 |
| 351 // The difference between modifyExtendingLeft and modifyExtendingBackward is
: | 351 // The difference between modifyExtendingLeft and modifyExtendingBackward is
: |
| 352 // modifyExtendingBackward always extends backward logically. | 352 // modifyExtendingBackward always extends backward logically. |
| 353 // modifyExtendingLeft behaves the same as modifyExtendingBackward except fo
r extending character or word, | 353 // modifyExtendingLeft behaves the same as modifyExtendingBackward except fo
r extending character or word, |
| 354 // it extends backward logically if the enclosing block is LTR direction, | 354 // it extends backward logically if the enclosing block is LTR direction, |
| 355 // but it extends forward logically if the enclosing block is RTL direction. | 355 // but it extends forward logically if the enclosing block is RTL direction. |
| 356 switch (granularity) { | 356 switch (granularity) { |
| 357 case CharacterGranularity: | 357 case CharacterGranularity: |
| 358 if (directionOfEnclosingBlock() == LTR) | 358 if (directionOfEnclosingBlock() == LTR) |
| 359 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); | 359 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 380 case DocumentBoundary: | 380 case DocumentBoundary: |
| 381 pos = modifyExtendingBackward(granularity); | 381 pos = modifyExtendingBackward(granularity); |
| 382 break; | 382 break; |
| 383 } | 383 } |
| 384 adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == LTR)); | 384 adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == LTR)); |
| 385 return pos; | 385 return pos; |
| 386 } | 386 } |
| 387 | 387 |
| 388 VisiblePosition SelectionModifier::modifyExtendingBackward(TextGranularity granu
larity) | 388 VisiblePosition SelectionModifier::modifyExtendingBackward(TextGranularity granu
larity) |
| 389 { | 389 { |
| 390 VisiblePosition pos = createVisiblePosition(m_selection.extent(), m_selectio
n.affinity()); | 390 VisiblePosition pos = createVisiblePositionDeprecated(m_selection.extent(),
m_selection.affinity()); |
| 391 | 391 |
| 392 // Extending a selection backward by word or character from just after a tab
le selects | 392 // Extending a selection backward by word or character from just after a tab
le selects |
| 393 // the table. This "makes sense" from the user perspective, esp. when delet
ing. | 393 // the table. This "makes sense" from the user perspective, esp. when delet
ing. |
| 394 // It was done here instead of in VisiblePosition because we want VPs to ite
rate | 394 // It was done here instead of in VisiblePosition because we want VPs to ite
rate |
| 395 // over everything. | 395 // over everything. |
| 396 switch (granularity) { | 396 switch (granularity) { |
| 397 case CharacterGranularity: | 397 case CharacterGranularity: |
| 398 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); | 398 pos = previousPositionOf(pos, CanSkipOverEditingBoundary); |
| 399 break; | 399 break; |
| 400 case WordGranularity: | 400 case WordGranularity: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 430 return pos; | 430 return pos; |
| 431 } | 431 } |
| 432 | 432 |
| 433 VisiblePosition SelectionModifier::modifyMovingLeft(TextGranularity granularity) | 433 VisiblePosition SelectionModifier::modifyMovingLeft(TextGranularity granularity) |
| 434 { | 434 { |
| 435 VisiblePosition pos; | 435 VisiblePosition pos; |
| 436 switch (granularity) { | 436 switch (granularity) { |
| 437 case CharacterGranularity: | 437 case CharacterGranularity: |
| 438 if (m_selection.isRange()) { | 438 if (m_selection.isRange()) { |
| 439 if (directionOfSelection() == LTR) | 439 if (directionOfSelection() == LTR) |
| 440 pos = createVisiblePosition(m_selection.start(), m_selection.aff
inity()); | 440 pos = createVisiblePositionDeprecated(m_selection.start(), m_sel
ection.affinity()); |
| 441 else | 441 else |
| 442 pos = createVisiblePosition(m_selection.end(), m_selection.affin
ity()); | 442 pos = createVisiblePositionDeprecated(m_selection.end(), m_selec
tion.affinity()); |
| 443 } else { | 443 } else { |
| 444 pos = leftPositionOf(createVisiblePosition(m_selection.extent(), m_s
election.affinity())); | 444 pos = leftPositionOf(createVisiblePositionDeprecated(m_selection.ext
ent(), m_selection.affinity())); |
| 445 } | 445 } |
| 446 break; | 446 break; |
| 447 case WordGranularity: { | 447 case WordGranularity: { |
| 448 bool skipsSpaceWhenMovingRight = frame() && frame()->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); | 448 bool skipsSpaceWhenMovingRight = frame() && frame()->editor().behavior()
.shouldSkipSpaceWhenMovingRight(); |
| 449 pos = leftWordPosition(createVisiblePosition(m_selection.extent(), m_sel
ection.affinity()), skipsSpaceWhenMovingRight); | 449 pos = leftWordPosition(createVisiblePositionDeprecated(m_selection.exten
t(), m_selection.affinity()), skipsSpaceWhenMovingRight); |
| 450 break; | 450 break; |
| 451 } | 451 } |
| 452 case SentenceGranularity: | 452 case SentenceGranularity: |
| 453 case LineGranularity: | 453 case LineGranularity: |
| 454 case ParagraphGranularity: | 454 case ParagraphGranularity: |
| 455 case SentenceBoundary: | 455 case SentenceBoundary: |
| 456 case ParagraphBoundary: | 456 case ParagraphBoundary: |
| 457 case DocumentBoundary: | 457 case DocumentBoundary: |
| 458 // FIXME: Implement all of the above. | 458 // FIXME: Implement all of the above. |
| 459 pos = modifyMovingBackward(granularity); | 459 pos = modifyMovingBackward(granularity); |
| 460 break; | 460 break; |
| 461 case LineBoundary: | 461 case LineBoundary: |
| 462 pos = leftBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock()
); | 462 pos = leftBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock()
); |
| 463 break; | 463 break; |
| 464 } | 464 } |
| 465 return pos; | 465 return pos; |
| 466 } | 466 } |
| 467 | 467 |
| 468 VisiblePosition SelectionModifier::modifyMovingBackward(TextGranularity granular
ity) | 468 VisiblePosition SelectionModifier::modifyMovingBackward(TextGranularity granular
ity) |
| 469 { | 469 { |
| 470 VisiblePosition pos; | 470 VisiblePosition pos; |
| 471 switch (granularity) { | 471 switch (granularity) { |
| 472 case CharacterGranularity: | 472 case CharacterGranularity: |
| 473 if (m_selection.isRange()) | 473 if (m_selection.isRange()) |
| 474 pos = createVisiblePosition(m_selection.start(), m_selection.affinit
y()); | 474 pos = createVisiblePositionDeprecated(m_selection.start(), m_selecti
on.affinity()); |
| 475 else | 475 else |
| 476 pos = previousPositionOf(createVisiblePosition(m_selection.extent(),
m_selection.affinity()), CanSkipOverEditingBoundary); | 476 pos = previousPositionOf(createVisiblePositionDeprecated(m_selection
.extent(), m_selection.affinity()), CanSkipOverEditingBoundary); |
| 477 break; | 477 break; |
| 478 case WordGranularity: | 478 case WordGranularity: |
| 479 pos = previousWordPosition(createVisiblePosition(m_selection.extent(), m
_selection.affinity())); | 479 pos = previousWordPosition(createVisiblePositionDeprecated(m_selection.e
xtent(), m_selection.affinity())); |
| 480 break; | 480 break; |
| 481 case SentenceGranularity: | 481 case SentenceGranularity: |
| 482 pos = previousSentencePosition(createVisiblePosition(m_selection.extent(
), m_selection.affinity())); | 482 pos = previousSentencePosition(createVisiblePositionDeprecated(m_selecti
on.extent(), m_selection.affinity())); |
| 483 break; | 483 break; |
| 484 case LineGranularity: | 484 case LineGranularity: |
| 485 pos = previousLinePosition(startForPlatform(), lineDirectionPointForBloc
kDirectionNavigation(START)); | 485 pos = previousLinePosition(startForPlatform(), lineDirectionPointForBloc
kDirectionNavigation(START)); |
| 486 break; | 486 break; |
| 487 case ParagraphGranularity: | 487 case ParagraphGranularity: |
| 488 pos = previousParagraphPosition(startForPlatform(), lineDirectionPointFo
rBlockDirectionNavigation(START)); | 488 pos = previousParagraphPosition(startForPlatform(), lineDirectionPointFo
rBlockDirectionNavigation(START)); |
| 489 break; | 489 break; |
| 490 case SentenceBoundary: | 490 case SentenceBoundary: |
| 491 pos = startOfSentence(startForPlatform()); | 491 pos = startOfSentence(startForPlatform()); |
| 492 break; | 492 break; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 { | 635 { |
| 636 if (!verticalDistance) | 636 if (!verticalDistance) |
| 637 return false; | 637 return false; |
| 638 | 638 |
| 639 willBeModified(alter, direction == FrameSelection::DirectionUp ? DirectionBa
ckward : DirectionForward); | 639 willBeModified(alter, direction == FrameSelection::DirectionUp ? DirectionBa
ckward : DirectionForward); |
| 640 | 640 |
| 641 VisiblePosition pos; | 641 VisiblePosition pos; |
| 642 LayoutUnit xPos; | 642 LayoutUnit xPos; |
| 643 switch (alter) { | 643 switch (alter) { |
| 644 case FrameSelection::AlterationMove: | 644 case FrameSelection::AlterationMove: |
| 645 pos = createVisiblePosition(direction == FrameSelection::DirectionUp ? m
_selection.start() : m_selection.end(), m_selection.affinity()); | 645 pos = createVisiblePositionDeprecated(direction == FrameSelection::Direc
tionUp ? m_selection.start() : m_selection.end(), m_selection.affinity()); |
| 646 xPos = lineDirectionPointForBlockDirectionNavigation(direction == FrameS
election::DirectionUp ? START : END); | 646 xPos = lineDirectionPointForBlockDirectionNavigation(direction == FrameS
election::DirectionUp ? START : END); |
| 647 m_selection.setAffinity(direction == FrameSelection::DirectionUp ? TextA
ffinity::Upstream : TextAffinity::Downstream); | 647 m_selection.setAffinity(direction == FrameSelection::DirectionUp ? TextA
ffinity::Upstream : TextAffinity::Downstream); |
| 648 break; | 648 break; |
| 649 case FrameSelection::AlterationExtend: | 649 case FrameSelection::AlterationExtend: |
| 650 pos = createVisiblePosition(m_selection.extent(), m_selection.affinity()
); | 650 pos = createVisiblePositionDeprecated(m_selection.extent(), m_selection.
affinity()); |
| 651 xPos = lineDirectionPointForBlockDirectionNavigation(EXTENT); | 651 xPos = lineDirectionPointForBlockDirectionNavigation(EXTENT); |
| 652 m_selection.setAffinity(TextAffinity::Downstream); | 652 m_selection.setAffinity(TextAffinity::Downstream); |
| 653 break; | 653 break; |
| 654 } | 654 } |
| 655 | 655 |
| 656 int startY; | 656 int startY; |
| 657 if (!absoluteCaretY(pos, startY)) | 657 if (!absoluteCaretY(pos, startY)) |
| 658 return false; | 658 return false; |
| 659 if (direction == FrameSelection::DirectionUp) | 659 if (direction == FrameSelection::DirectionUp) |
| 660 startY = -startY; | 660 startY = -startY; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 case EXTENT: | 743 case EXTENT: |
| 744 pos = m_selection.extent(); | 744 pos = m_selection.extent(); |
| 745 break; | 745 break; |
| 746 } | 746 } |
| 747 | 747 |
| 748 LocalFrame* frame = pos.document()->frame(); | 748 LocalFrame* frame = pos.document()->frame(); |
| 749 if (!frame) | 749 if (!frame) |
| 750 return x; | 750 return x; |
| 751 | 751 |
| 752 if (m_xPosForVerticalArrowNavigation == NoXPosForVerticalArrowNavigation())
{ | 752 if (m_xPosForVerticalArrowNavigation == NoXPosForVerticalArrowNavigation())
{ |
| 753 VisiblePosition visiblePosition = createVisiblePosition(pos, m_selection
.affinity()); | 753 VisiblePosition visiblePosition = createVisiblePositionDeprecated(pos, m
_selection.affinity()); |
| 754 // VisiblePosition creation can fail here if a node containing the selec
tion becomes visibility:hidden | 754 // VisiblePosition creation can fail here if a node containing the selec
tion becomes visibility:hidden |
| 755 // after the selection is created and before this function is called. | 755 // after the selection is created and before this function is called. |
| 756 x = lineDirectionPointForBlockDirectionNavigationOf(visiblePosition); | 756 x = lineDirectionPointForBlockDirectionNavigationOf(visiblePosition); |
| 757 m_xPosForVerticalArrowNavigation = x; | 757 m_xPosForVerticalArrowNavigation = x; |
| 758 } else { | 758 } else { |
| 759 x = m_xPosForVerticalArrowNavigation; | 759 x = m_xPosForVerticalArrowNavigation; |
| 760 } | 760 } |
| 761 | 761 |
| 762 return x; | 762 return x; |
| 763 } | 763 } |
| 764 | 764 |
| 765 DEFINE_TRACE(SelectionModifier) | 765 DEFINE_TRACE(SelectionModifier) |
| 766 { | 766 { |
| 767 visitor->trace(m_frame); | 767 visitor->trace(m_frame); |
| 768 visitor->trace(m_selection); | 768 visitor->trace(m_selection); |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace blink | 771 } // namespace blink |
| OLD | NEW |