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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 { | 488 { |
489 return visiblePositionOf(positionWithAffinity.position(), positionWithAffini
ty.affinity()); | 489 return visiblePositionOf(positionWithAffinity.position(), positionWithAffini
ty.affinity()); |
490 } | 490 } |
491 | 491 |
492 VisiblePosition visiblePositionOf(const PositionInComposedTree& position, TextAf
finity affinity) | 492 VisiblePosition visiblePositionOf(const PositionInComposedTree& position, TextAf
finity affinity) |
493 { | 493 { |
494 PositionInComposedTreeWithAffinity canonicalized = visiblePositionOfAlgorith
m<EditingInComposedTreeStrategy>(position, affinity); | 494 PositionInComposedTreeWithAffinity canonicalized = visiblePositionOfAlgorith
m<EditingInComposedTreeStrategy>(position, affinity); |
495 return VisiblePosition::createWithoutCanonicalization(PositionWithAffinity(t
oPositionInDOMTree(canonicalized.position()), canonicalized.affinity())); | 495 return VisiblePosition::createWithoutCanonicalization(PositionWithAffinity(t
oPositionInDOMTree(canonicalized.position()), canonicalized.affinity())); |
496 } | 496 } |
497 | 497 |
498 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition) | |
499 { | |
500 LayoutObject* layoutObject; | |
501 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); | |
502 if (localRect.isEmpty() || !layoutObject) | |
503 return IntRect(); | |
504 | |
505 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun
dingBox(); | |
506 } | |
507 | |
508 #ifndef NDEBUG | 498 #ifndef NDEBUG |
509 | 499 |
510 void VisiblePosition::debugPosition(const char* msg) const | 500 void VisiblePosition::debugPosition(const char* msg) const |
511 { | 501 { |
512 if (isNull()) { | 502 if (isNull()) { |
513 fprintf(stderr, "Position [%s]: null\n", msg); | 503 fprintf(stderr, "Position [%s]: null\n", msg); |
514 return; | 504 return; |
515 } | 505 } |
516 m_deepPosition.debugPosition(msg); | 506 m_deepPosition.debugPosition(msg); |
517 } | 507 } |
(...skipping 26 matching lines...) Expand all Loading... |
544 else | 534 else |
545 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); | 535 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); |
546 } | 536 } |
547 | 537 |
548 void showTree(const blink::VisiblePosition& vpos) | 538 void showTree(const blink::VisiblePosition& vpos) |
549 { | 539 { |
550 vpos.showTreeForThis(); | 540 vpos.showTreeForThis(); |
551 } | 541 } |
552 | 542 |
553 #endif | 543 #endif |
OLD | NEW |