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 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2261 const int textOffset = offsetInNode - textLayoutObject->textStartOffset(); | 2261 const int textOffset = offsetInNode - textLayoutObject->textStartOffset(); |
| 2262 for (InlineTextBox *box = textLayoutObject->firstTextBox(); box; box = box-> nextTextBox()) { | 2262 for (InlineTextBox *box = textLayoutObject->firstTextBox(); box; box = box-> nextTextBox()) { |
| 2263 if (textOffset < static_cast<int>(box->start()) && !textLayoutObject->co ntainsReversedText()) { | 2263 if (textOffset < static_cast<int>(box->start()) && !textLayoutObject->co ntainsReversedText()) { |
| 2264 // The offset we're looking for is before this node | 2264 // The offset we're looking for is before this node |
| 2265 // this means the offset must be in content that is | 2265 // this means the offset must be in content that is |
| 2266 // not laid out. Return false. | 2266 // not laid out. Return false. |
| 2267 return false; | 2267 return false; |
| 2268 } | 2268 } |
| 2269 if (box->containsCaretOffset(textOffset)) { | 2269 if (box->containsCaretOffset(textOffset)) { |
| 2270 // Return false for offsets inside composed characters. | 2270 // Return false for offsets inside composed characters. |
| 2271 return textOffset == 0 || textOffset == textLayoutObject->nextOffset (textLayoutObject->previousOffset(textOffset)); | 2271 return textOffset == 0 || textOffset == uncheckedNextOffset(anchorNo de, uncheckedPreviousOffset(anchorNode, textOffset)); |
| 2272 } | 2272 } |
| 2273 } | 2273 } |
| 2274 | 2274 |
| 2275 return false; | 2275 return false; |
| 2276 } | 2276 } |
| 2277 | 2277 |
| 2278 bool rendersInDifferentPosition(const Position& position1, const Position& posit ion2) | 2278 bool rendersInDifferentPosition(const Position& position1, const Position& posit ion2) |
| 2279 { | 2279 { |
| 2280 if (position1.isNull() || position2.isNull()) | 2280 if (position1.isNull() || position2.isNull()) |
| 2281 return false; | 2281 return false; |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2844 | 2844 |
| 2845 if (!lineLayoutItem.node()) { | 2845 if (!lineLayoutItem.node()) { |
| 2846 box = box->prevLeafChild(); | 2846 box = box->prevLeafChild(); |
| 2847 if (!box) | 2847 if (!box) |
| 2848 return primaryDirection == LTR ? previousVisuallyDistinctCan didate(deepPosition) : nextVisuallyDistinctCandidate(deepPosition); | 2848 return primaryDirection == LTR ? previousVisuallyDistinctCan didate(deepPosition) : nextVisuallyDistinctCandidate(deepPosition); |
| 2849 lineLayoutItem = box->getLineLayoutItem(); | 2849 lineLayoutItem = box->getLineLayoutItem(); |
| 2850 offset = box->caretRightmostOffset(); | 2850 offset = box->caretRightmostOffset(); |
| 2851 continue; | 2851 continue; |
| 2852 } | 2852 } |
| 2853 | 2853 |
| 2854 offset = box->isLeftToRightDirection() ? lineLayoutItem.previousOffs et(offset) : lineLayoutItem.nextOffset(offset); | 2854 offset = box->isLeftToRightDirection() ? uncheckedPreviousOffset(li neLayoutItem.node(), offset) : uncheckedNextOffset(lineLayoutItem.node(), offset ); |
|
tkent
2016/03/25 04:34:08
nit: no need to add an extra space before |box|.
Seigo Nonaka
2016/03/25 05:11:22
Done.
| |
| 2855 | 2855 |
| 2856 int caretMinOffset = box->caretMinOffset(); | 2856 int caretMinOffset = box->caretMinOffset(); |
| 2857 int caretMaxOffset = box->caretMaxOffset(); | 2857 int caretMaxOffset = box->caretMaxOffset(); |
| 2858 | 2858 |
| 2859 if (offset > caretMinOffset && offset < caretMaxOffset) | 2859 if (offset > caretMinOffset && offset < caretMaxOffset) |
| 2860 break; | 2860 break; |
| 2861 | 2861 |
| 2862 if (box->isLeftToRightDirection() ? offset < caretMinOffset : offset > caretMaxOffset) { | 2862 if (box->isLeftToRightDirection() ? offset < caretMinOffset : offset > caretMaxOffset) { |
| 2863 // Overshot to the left. | 2863 // Overshot to the left. |
| 2864 InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); | 2864 InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3019 | 3019 |
| 3020 if (!layoutObject->node()) { | 3020 if (!layoutObject->node()) { |
| 3021 box = box->nextLeafChild(); | 3021 box = box->nextLeafChild(); |
| 3022 if (!box) | 3022 if (!box) |
| 3023 return primaryDirection == LTR ? nextVisuallyDistinctCandida te(deepPosition) : previousVisuallyDistinctCandidate(deepPosition); | 3023 return primaryDirection == LTR ? nextVisuallyDistinctCandida te(deepPosition) : previousVisuallyDistinctCandidate(deepPosition); |
| 3024 layoutObject = LineLayoutAPIShim::layoutObjectFrom(box->getLineL ayoutItem()); | 3024 layoutObject = LineLayoutAPIShim::layoutObjectFrom(box->getLineL ayoutItem()); |
| 3025 offset = box->caretLeftmostOffset(); | 3025 offset = box->caretLeftmostOffset(); |
| 3026 continue; | 3026 continue; |
| 3027 } | 3027 } |
| 3028 | 3028 |
| 3029 offset = box->isLeftToRightDirection() ? layoutObject->nextOffset(of fset) : layoutObject->previousOffset(offset); | 3029 offset = box->isLeftToRightDirection() ? uncheckedNextOffset(layout Object->node(), offset) : uncheckedPreviousOffset(layoutObject->node(), offset); |
|
tkent
2016/03/25 04:34:08
nit: no need to add an extra space before |uncheck
Seigo Nonaka
2016/03/25 05:11:22
Done.
| |
| 3030 | 3030 |
| 3031 int caretMinOffset = box->caretMinOffset(); | 3031 int caretMinOffset = box->caretMinOffset(); |
| 3032 int caretMaxOffset = box->caretMaxOffset(); | 3032 int caretMaxOffset = box->caretMaxOffset(); |
| 3033 | 3033 |
| 3034 if (offset > caretMinOffset && offset < caretMaxOffset) | 3034 if (offset > caretMinOffset && offset < caretMaxOffset) |
| 3035 break; | 3035 break; |
| 3036 | 3036 |
| 3037 if (box->isLeftToRightDirection() ? offset > caretMaxOffset : offset < caretMinOffset) { | 3037 if (box->isLeftToRightDirection() ? offset > caretMaxOffset : offset < caretMinOffset) { |
| 3038 // Overshot to the right. | 3038 // Overshot to the right. |
| 3039 InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); | 3039 InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3254 { | 3254 { |
| 3255 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); | 3255 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); |
| 3256 } | 3256 } |
| 3257 | 3257 |
| 3258 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) | 3258 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) |
| 3259 { | 3259 { |
| 3260 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); | 3260 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); |
| 3261 } | 3261 } |
| 3262 | 3262 |
| 3263 } // namespace blink | 3263 } // namespace blink |
| OLD | NEW |