| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return positionInParentAfterNode(*m_anchorNode); | 221 return positionInParentAfterNode(*m_anchorNode); |
| 222 } | 222 } |
| 223 | 223 |
| 224 return Position(containerNode(), computeOffsetInContainerNode(), PositionIsO
ffsetInAnchor); | 224 return Position(containerNode(), computeOffsetInContainerNode(), PositionIsO
ffsetInAnchor); |
| 225 } | 225 } |
| 226 | 226 |
| 227 Node* Position::computeNodeBeforePosition() const | 227 Node* Position::computeNodeBeforePosition() const |
| 228 { | 228 { |
| 229 if (!m_anchorNode) | 229 if (!m_anchorNode) |
| 230 return 0; | 230 return 0; |
| 231 | |
| 232 switch (anchorType()) { | 231 switch (anchorType()) { |
| 233 case PositionIsBeforeChildren: | 232 case PositionIsBeforeChildren: |
| 234 return 0; | 233 return 0; |
| 235 case PositionIsAfterChildren: | 234 case PositionIsAfterChildren: |
| 236 return m_anchorNode->lastChild(); | 235 return m_anchorNode->lastChild(); |
| 237 case PositionIsOffsetInAnchor: | 236 case PositionIsOffsetInAnchor: |
| 238 return m_anchorNode->traverseToChildAt(m_offset - 1); // -1 converts to
traverseToChildAt((unsigned)-1) and returns null. | 237 return m_anchorNode->traverseToChildAt(m_offset - 1); // -1 converts to
traverseToChildAt((unsigned)-1) and returns null. |
| 239 case PositionIsBeforeAnchor: | 238 case PositionIsBeforeAnchor: |
| 240 return m_anchorNode->previousSibling(); | 239 return m_anchorNode->previousSibling(); |
| 241 case PositionIsAfterAnchor: | 240 case PositionIsAfterAnchor: |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 } | 1252 } |
| 1254 } else { | 1253 } else { |
| 1255 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak(); | 1254 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak(); |
| 1256 if (!nextBox || nextBox->bidiLevel() < level) { | 1255 if (!nextBox || nextBox->bidiLevel() < level) { |
| 1257 // Right edge of a secondary run. Set to the left edge of the entire
run. | 1256 // Right edge of a secondary run. Set to the left edge of the entire
run. |
| 1258 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea
k()) { | 1257 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea
k()) { |
| 1259 if (prevBox->bidiLevel() < level) | 1258 if (prevBox->bidiLevel() < level) |
| 1260 break; | 1259 break; |
| 1261 inlineBox = prevBox; | 1260 inlineBox = prevBox; |
| 1262 } | 1261 } |
| 1263 caretOffset = inlineBox->caretLeftmostOffset(); | 1262 if (m_anchorNode->selfOrAncestorHasDirAutoAttribute()) |
| 1263 caretOffset = inlineBox->bidiLevel() < level ? inlineBox->caretL
eftmostOffset() : inlineBox->caretRightmostOffset(); |
| 1264 else |
| 1265 caretOffset = inlineBox->caretLeftmostOffset(); |
| 1264 } else if (nextBox->bidiLevel() > level) { | 1266 } else if (nextBox->bidiLevel() > level) { |
| 1265 // Left edge of a "tertiary" run. Set to the right edge of that run. | 1267 // Left edge of a "tertiary" run. Set to the right edge of that run. |
| 1266 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine
Break()) { | 1268 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine
Break()) { |
| 1267 if (tertiaryBox->bidiLevel() <= level) | 1269 if (tertiaryBox->bidiLevel() <= level) |
| 1268 break; | 1270 break; |
| 1269 inlineBox = tertiaryBox; | 1271 inlineBox = tertiaryBox; |
| 1270 } | 1272 } |
| 1271 caretOffset = inlineBox->caretRightmostOffset(); | 1273 caretOffset = inlineBox->caretRightmostOffset(); |
| 1272 } | 1274 } |
| 1273 } | 1275 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 pos.showTreeForThis(); | 1366 pos.showTreeForThis(); |
| 1365 } | 1367 } |
| 1366 | 1368 |
| 1367 void showTree(const WebCore::Position* pos) | 1369 void showTree(const WebCore::Position* pos) |
| 1368 { | 1370 { |
| 1369 if (pos) | 1371 if (pos) |
| 1370 pos->showTreeForThis(); | 1372 pos->showTreeForThis(); |
| 1371 } | 1373 } |
| 1372 | 1374 |
| 1373 #endif | 1375 #endif |
| OLD | NEW |