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 * | 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 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 bool isVisuallyEquivalentCandidate(const Position& position) | 2430 bool isVisuallyEquivalentCandidate(const Position& position) |
2431 { | 2431 { |
2432 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); | 2432 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); |
2433 } | 2433 } |
2434 | 2434 |
2435 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) | 2435 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) |
2436 { | 2436 { |
2437 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy>
(position); | 2437 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy>
(position); |
2438 } | 2438 } |
2439 | 2439 |
| 2440 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition) |
| 2441 { |
| 2442 LayoutObject* layoutObject; |
| 2443 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); |
| 2444 if (localRect.isEmpty() || !layoutObject) |
| 2445 return IntRect(); |
| 2446 |
| 2447 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun
dingBox(); |
| 2448 } |
| 2449 |
2440 static VisiblePosition skipToEndOfEditingBoundary(const VisiblePosition& pos, co
nst Position& anchor) | 2450 static VisiblePosition skipToEndOfEditingBoundary(const VisiblePosition& pos, co
nst Position& anchor) |
2441 { | 2451 { |
2442 if (pos.isNull()) | 2452 if (pos.isNull()) |
2443 return pos; | 2453 return pos; |
2444 | 2454 |
2445 ContainerNode* highestRoot = highestEditableRoot(anchor); | 2455 ContainerNode* highestRoot = highestEditableRoot(anchor); |
2446 ContainerNode* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); | 2456 ContainerNode* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); |
2447 | 2457 |
2448 // Return |pos| itself if the two are from the very same editable region, or | 2458 // Return |pos| itself if the two are from the very same editable region, or |
2449 // both are non-editable. | 2459 // both are non-editable. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale
nt()); | 2560 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale
nt()); |
2551 case CanSkipOverEditingBoundary: | 2561 case CanSkipOverEditingBoundary: |
2552 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent
()); | 2562 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent
()); |
2553 } | 2563 } |
2554 | 2564 |
2555 ASSERT_NOT_REACHED(); | 2565 ASSERT_NOT_REACHED(); |
2556 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent()
); | 2566 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent()
); |
2557 } | 2567 } |
2558 | 2568 |
2559 } // namespace blink | 2569 } // namespace blink |
OLD | NEW |