| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return i; | 200 return i; |
| 201 } | 201 } |
| 202 return 0; | 202 return 0; |
| 203 } | 203 } |
| 204 | 204 |
| 205 static const InlineTextBox* logicallyPreviousBox(const VisiblePosition& visibleP
osition, const InlineTextBox* textBox, | 205 static const InlineTextBox* logicallyPreviousBox(const VisiblePosition& visibleP
osition, const InlineTextBox* textBox, |
| 206 bool& previousBoxInDifferentBlock, CachedLogicallyOrderedLeafBoxes& leafBoxe
s) | 206 bool& previousBoxInDifferentBlock, CachedLogicallyOrderedLeafBoxes& leafBoxe
s) |
| 207 { | 207 { |
| 208 const InlineBox* startBox = textBox; | 208 const InlineBox* startBox = textBox; |
| 209 | 209 |
| 210 const InlineTextBox* previousBox = leafBoxes.previousTextBox(startBox->root(
), textBox); | 210 const InlineTextBox* previousBox = leafBoxes.previousTextBox(&startBox->root
(), textBox); |
| 211 if (previousBox) | 211 if (previousBox) |
| 212 return previousBox; | 212 return previousBox; |
| 213 | 213 |
| 214 previousBox = leafBoxes.previousTextBox(startBox->root()->prevRootBox(), 0); | 214 previousBox = leafBoxes.previousTextBox(startBox->root().prevRootBox(), 0); |
| 215 if (previousBox) | 215 if (previousBox) |
| 216 return previousBox; | 216 return previousBox; |
| 217 | 217 |
| 218 while (1) { | 218 while (1) { |
| 219 Node* startNode = startBox->renderer().nonPseudoNode(); | 219 Node* startNode = startBox->renderer().nonPseudoNode(); |
| 220 if (!startNode) | 220 if (!startNode) |
| 221 break; | 221 break; |
| 222 | 222 |
| 223 Position position = previousRootInlineBoxCandidatePosition(startNode, vi
siblePosition, ContentIsEditable); | 223 Position position = previousRootInlineBoxCandidatePosition(startNode, vi
siblePosition, ContentIsEditable); |
| 224 if (position.isNull()) | 224 if (position.isNull()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 } | 241 } |
| 242 return 0; | 242 return 0; |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 static const InlineTextBox* logicallyNextBox(const VisiblePosition& visiblePosit
ion, const InlineTextBox* textBox, | 246 static const InlineTextBox* logicallyNextBox(const VisiblePosition& visiblePosit
ion, const InlineTextBox* textBox, |
| 247 bool& nextBoxInDifferentBlock, CachedLogicallyOrderedLeafBoxes& leafBoxes) | 247 bool& nextBoxInDifferentBlock, CachedLogicallyOrderedLeafBoxes& leafBoxes) |
| 248 { | 248 { |
| 249 const InlineBox* startBox = textBox; | 249 const InlineBox* startBox = textBox; |
| 250 | 250 |
| 251 const InlineTextBox* nextBox = leafBoxes.nextTextBox(startBox->root(), textB
ox); | 251 const InlineTextBox* nextBox = leafBoxes.nextTextBox(&startBox->root(), text
Box); |
| 252 if (nextBox) | 252 if (nextBox) |
| 253 return nextBox; | 253 return nextBox; |
| 254 | 254 |
| 255 nextBox = leafBoxes.nextTextBox(startBox->root()->nextRootBox(), 0); | 255 nextBox = leafBoxes.nextTextBox(startBox->root().nextRootBox(), 0); |
| 256 if (nextBox) | 256 if (nextBox) |
| 257 return nextBox; | 257 return nextBox; |
| 258 | 258 |
| 259 while (1) { | 259 while (1) { |
| 260 Node* startNode =startBox->renderer().nonPseudoNode(); | 260 Node* startNode =startBox->renderer().nonPseudoNode(); |
| 261 if (!startNode) | 261 if (!startNode) |
| 262 break; | 262 break; |
| 263 | 263 |
| 264 Position position = nextRootInlineBoxCandidatePosition(startNode, visibl
ePosition, ContentIsEditable); | 264 Position position = nextRootInlineBoxCandidatePosition(startNode, visibl
ePosition, ContentIsEditable); |
| 265 if (position.isNull()) | 265 if (position.isNull()) |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 922 |
| 923 RenderObject* renderer = node->renderer(); | 923 RenderObject* renderer = node->renderer(); |
| 924 if (!renderer) | 924 if (!renderer) |
| 925 return VisiblePosition(); | 925 return VisiblePosition(); |
| 926 | 926 |
| 927 RootInlineBox* root = 0; | 927 RootInlineBox* root = 0; |
| 928 InlineBox* box; | 928 InlineBox* box; |
| 929 int ignoredCaretOffset; | 929 int ignoredCaretOffset; |
| 930 visiblePosition.getInlineBoxAndOffset(box, ignoredCaretOffset); | 930 visiblePosition.getInlineBoxAndOffset(box, ignoredCaretOffset); |
| 931 if (box) { | 931 if (box) { |
| 932 root = box->root()->prevRootBox(); | 932 root = box->root().prevRootBox(); |
| 933 // We want to skip zero height boxes. | 933 // We want to skip zero height boxes. |
| 934 // This could happen in case it is a TrailingFloatsRootInlineBox. | 934 // This could happen in case it is a TrailingFloatsRootInlineBox. |
| 935 if (!root || !root->logicalHeight() || !root->firstLeafChild()) | 935 if (!root || !root->logicalHeight() || !root->firstLeafChild()) |
| 936 root = 0; | 936 root = 0; |
| 937 } | 937 } |
| 938 | 938 |
| 939 if (!root) { | 939 if (!root) { |
| 940 Position position = previousRootInlineBoxCandidatePosition(node, visible
Position, editableType); | 940 Position position = previousRootInlineBoxCandidatePosition(node, visible
Position, editableType); |
| 941 if (position.isNotNull()) { | 941 if (position.isNotNull()) { |
| 942 RenderedPosition renderedPosition((VisiblePosition(position))); | 942 RenderedPosition renderedPosition((VisiblePosition(position))); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 977 |
| 978 RenderObject* renderer = node->renderer(); | 978 RenderObject* renderer = node->renderer(); |
| 979 if (!renderer) | 979 if (!renderer) |
| 980 return VisiblePosition(); | 980 return VisiblePosition(); |
| 981 | 981 |
| 982 RootInlineBox* root = 0; | 982 RootInlineBox* root = 0; |
| 983 InlineBox* box; | 983 InlineBox* box; |
| 984 int ignoredCaretOffset; | 984 int ignoredCaretOffset; |
| 985 visiblePosition.getInlineBoxAndOffset(box, ignoredCaretOffset); | 985 visiblePosition.getInlineBoxAndOffset(box, ignoredCaretOffset); |
| 986 if (box) { | 986 if (box) { |
| 987 root = box->root()->nextRootBox(); | 987 root = box->root().nextRootBox(); |
| 988 // We want to skip zero height boxes. | 988 // We want to skip zero height boxes. |
| 989 // This could happen in case it is a TrailingFloatsRootInlineBox. | 989 // This could happen in case it is a TrailingFloatsRootInlineBox. |
| 990 if (!root || !root->logicalHeight() || !root->firstLeafChild()) | 990 if (!root || !root->logicalHeight() || !root->firstLeafChild()) |
| 991 root = 0; | 991 root = 0; |
| 992 } | 992 } |
| 993 | 993 |
| 994 if (!root) { | 994 if (!root) { |
| 995 // FIXME: We need do the same in previousLinePosition. | 995 // FIXME: We need do the same in previousLinePosition. |
| 996 Node* child = node->traverseToChildAt(p.deprecatedEditingOffset()); | 996 Node* child = node->traverseToChildAt(p.deprecatedEditingOffset()); |
| 997 node = child ? child : &node->lastDescendant(); | 997 node = child ? child : &node->lastDescendant(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 { | 1384 { |
| 1385 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1385 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1388 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
| 1389 { | 1389 { |
| 1390 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1390 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 } | 1393 } |
| OLD | NEW |