Chromium Code Reviews| 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 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2929 } | 2929 } |
| 2930 | 2930 |
| 2931 bool isVisuallyEquivalentCandidate(const PositionInFlatTree& position) | 2931 bool isVisuallyEquivalentCandidate(const PositionInFlatTree& position) |
| 2932 { | 2932 { |
| 2933 return isVisuallyEquivalentCandidateAlgorithm<EditingInFlatTreeStrategy>(pos ition); | 2933 return isVisuallyEquivalentCandidateAlgorithm<EditingInFlatTreeStrategy>(pos ition); |
| 2934 } | 2934 } |
| 2935 | 2935 |
| 2936 template <typename Strategy> | 2936 template <typename Strategy> |
| 2937 static IntRect absoluteCaretBoundsOfAlgorithm(const VisiblePositionTemplate<Stra tegy>& visiblePosition) | 2937 static IntRect absoluteCaretBoundsOfAlgorithm(const VisiblePositionTemplate<Stra tegy>& visiblePosition) |
| 2938 { | 2938 { |
| 2939 // TODO(xiaochengh): Ensure that this function is called with a valid | 2939 DCHECK(visiblePosition.isValid()) << visiblePosition; |
| 2940 // |visiblePosition|, and add |DCHECK(visiblePosition.isValid())|; | |
| 2941 LayoutObject* layoutObject; | 2940 LayoutObject* layoutObject; |
| 2942 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi thAffinity(), layoutObject); | 2941 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi thAffinity(), layoutObject); |
| 2943 if (localRect.isEmpty() || !layoutObject) | 2942 if (localRect.isEmpty() || !layoutObject) |
| 2944 return IntRect(); | 2943 return IntRect(); |
| 2945 | 2944 |
| 2946 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox(); | 2945 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox(); |
| 2947 } | 2946 } |
| 2948 | 2947 |
| 2949 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition) | 2948 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition) |
| 2950 { | 2949 { |
| 2951 return absoluteCaretBoundsOfAlgorithm<EditingStrategy>(visiblePosition); | 2950 return absoluteCaretBoundsOfAlgorithm<EditingStrategy>(visiblePosition); |
| 2952 } | 2951 } |
| 2953 | 2952 |
| 2954 IntRect absoluteCaretBoundsOf(const VisiblePositionInFlatTree& visiblePosition) | 2953 IntRect absoluteCaretBoundsOf(const VisiblePositionInFlatTree& visiblePosition) |
| 2955 { | 2954 { |
| 2956 return absoluteCaretBoundsOfAlgorithm<EditingInFlatTreeStrategy>(visiblePosi tion); | 2955 return absoluteCaretBoundsOfAlgorithm<EditingInFlatTreeStrategy>(visiblePosi tion); |
| 2957 } | 2956 } |
| 2958 | 2957 |
| 2959 template <typename Strategy> | 2958 template <typename Strategy> |
| 2959 static IntRect absoluteCaretBoundsOfAlgorithmDeprecated(const VisiblePositionTem plate<Strategy>& visiblePosition) | |
|
yosin_UTC9
2016/09/27 10:09:50
Let's make absoluteCaretBoundsOfAlgorithm to take
| |
| 2960 { | |
| 2961 LayoutObject* layoutObject; | |
| 2962 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi thAffinity(), layoutObject); | |
| 2963 if (localRect.isEmpty() || !layoutObject) | |
| 2964 return IntRect(); | |
| 2965 | |
| 2966 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox(); | |
| 2967 } | |
| 2968 | |
| 2969 IntRect absoluteCaretBoundsOfDeprecated(const VisiblePosition& visiblePosition) | |
| 2970 { | |
| 2971 return absoluteCaretBoundsOfAlgorithmDeprecated<EditingStrategy>(visiblePosi tion); | |
| 2972 } | |
| 2973 | |
| 2974 template <typename Strategy> | |
| 2960 static VisiblePositionTemplate<Strategy> skipToEndOfEditingBoundary(const Visibl ePositionTemplate<Strategy>& pos, const PositionTemplate<Strategy>& anchor) | 2975 static VisiblePositionTemplate<Strategy> skipToEndOfEditingBoundary(const Visibl ePositionTemplate<Strategy>& pos, const PositionTemplate<Strategy>& anchor) |
| 2961 { | 2976 { |
| 2962 DCHECK(pos.isValid()) << pos; | 2977 DCHECK(pos.isValid()) << pos; |
| 2963 if (pos.isNull()) | 2978 if (pos.isNull()) |
| 2964 return pos; | 2979 return pos; |
| 2965 | 2980 |
| 2966 ContainerNode* highestRoot = highestEditableRoot(anchor); | 2981 ContainerNode* highestRoot = highestEditableRoot(anchor); |
| 2967 ContainerNode* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); | 2982 ContainerNode* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); |
| 2968 | 2983 |
| 2969 // Return |pos| itself if the two are from the very same editable region, | 2984 // Return |pos| itself if the two are from the very same editable region, |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3480 { | 3495 { |
| 3481 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); | 3496 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); |
| 3482 } | 3497 } |
| 3483 | 3498 |
| 3484 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) | 3499 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) |
| 3485 { | 3500 { |
| 3486 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); | 3501 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); |
| 3487 } | 3502 } |
| 3488 | 3503 |
| 3489 } // namespace blink | 3504 } // namespace blink |
| OLD | NEW |