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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 bool isVisuallyEquivalentCandidate(const Position& position) | 2493 bool isVisuallyEquivalentCandidate(const Position& position) |
2494 { | 2494 { |
2495 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); | 2495 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); |
2496 } | 2496 } |
2497 | 2497 |
2498 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) | 2498 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) |
2499 { | 2499 { |
2500 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy>
(position); | 2500 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy>
(position); |
2501 } | 2501 } |
2502 | 2502 |
2503 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition) | 2503 template <typename Strategy> |
| 2504 static IntRect absoluteCaretBoundsOfAlgorithm(const VisiblePositionTemplate<Stra
tegy>& visiblePosition) |
2504 { | 2505 { |
2505 LayoutObject* layoutObject; | 2506 LayoutObject* layoutObject; |
2506 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); | 2507 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); |
2507 if (localRect.isEmpty() || !layoutObject) | 2508 if (localRect.isEmpty() || !layoutObject) |
2508 return IntRect(); | 2509 return IntRect(); |
2509 | 2510 |
2510 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun
dingBox(); | 2511 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun
dingBox(); |
2511 } | 2512 } |
2512 | 2513 |
| 2514 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition) |
| 2515 { |
| 2516 return absoluteCaretBoundsOfAlgorithm<EditingStrategy>(visiblePosition); |
| 2517 } |
| 2518 |
| 2519 IntRect absoluteCaretBoundsOf(const VisiblePositionInComposedTree& visiblePositi
on) |
| 2520 { |
| 2521 return absoluteCaretBoundsOfAlgorithm<EditingInComposedTreeStrategy>(visible
Position); |
| 2522 } |
| 2523 |
2513 static VisiblePosition skipToEndOfEditingBoundary(const VisiblePosition& pos, co
nst Position& anchor) | 2524 static VisiblePosition skipToEndOfEditingBoundary(const VisiblePosition& pos, co
nst Position& anchor) |
2514 { | 2525 { |
2515 if (pos.isNull()) | 2526 if (pos.isNull()) |
2516 return pos; | 2527 return pos; |
2517 | 2528 |
2518 ContainerNode* highestRoot = highestEditableRoot(anchor); | 2529 ContainerNode* highestRoot = highestEditableRoot(anchor); |
2519 ContainerNode* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); | 2530 ContainerNode* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); |
2520 | 2531 |
2521 // Return |pos| itself if the two are from the very same editable region, or | 2532 // Return |pos| itself if the two are from the very same editable region, or |
2522 // both are non-editable. | 2533 // both are non-editable. |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2952 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale
nt()); | 2963 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale
nt()); |
2953 case CanSkipOverEditingBoundary: | 2964 case CanSkipOverEditingBoundary: |
2954 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent
()); | 2965 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent
()); |
2955 } | 2966 } |
2956 | 2967 |
2957 ASSERT_NOT_REACHED(); | 2968 ASSERT_NOT_REACHED(); |
2958 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent()
); | 2969 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent()
); |
2959 } | 2970 } |
2960 | 2971 |
2961 } // namespace blink | 2972 } // namespace blink |
OLD | NEW |