| 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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 PositionInComposedTree toPositionInComposedTree(const Position& pos) | 1401 PositionInComposedTree toPositionInComposedTree(const Position& pos) |
| 1402 { | 1402 { |
| 1403 if (pos.isNull()) | 1403 if (pos.isNull()) |
| 1404 return PositionInComposedTree(); | 1404 return PositionInComposedTree(); |
| 1405 | 1405 |
| 1406 PositionInComposedTree position; | 1406 PositionInComposedTree position; |
| 1407 if (pos.anchorType() == Position::PositionIsOffsetInAnchor) { | 1407 if (pos.anchorType() == Position::PositionIsOffsetInAnchor) { |
| 1408 Node* anchor = pos.anchorNode(); | 1408 Node* anchor = pos.anchorNode(); |
| 1409 if (anchor->offsetInCharacters()) | 1409 if (anchor->offsetInCharacters()) |
| 1410 return PositionInComposedTree(anchor, pos.computeOffsetInContainerNo
de(), PositionInComposedTree::PositionIsOffsetInAnchor); | 1410 return PositionInComposedTree(anchor, pos.computeOffsetInContainerNo
de(), PositionInComposedTree::PositionIsOffsetInAnchor); |
| 1411 Node* child = NodeTraversal::childAt(*anchor, pos.computeOffsetInContain
erNode()); | 1411 ASSERT(!isActiveInsertionPoint(*anchor)); |
| 1412 int offset = pos.computeOffsetInContainerNode(); |
| 1413 Node* child = NodeTraversal::childAt(*anchor, offset); |
| 1412 if (!child) | 1414 if (!child) |
| 1413 return PositionInComposedTree(anchor, PositionInComposedTree::Positi
onIsAfterChildren); | 1415 return PositionInComposedTree(anchor, PositionInComposedTree::Positi
onIsAfterChildren); |
| 1414 child->updateDistribution(); | 1416 child->updateDistribution(); |
| 1417 if (isActiveInsertionPoint(*child)) |
| 1418 return PositionInComposedTree(anchor, offset, PositionInComposedTree
::PositionIsOffsetInAnchor); |
| 1415 return PositionInComposedTree(ComposedTreeTraversal::parent(*child), Com
posedTreeTraversal::index(*child), PositionInComposedTree::PositionIsOffsetInAnc
hor); | 1419 return PositionInComposedTree(ComposedTreeTraversal::parent(*child), Com
posedTreeTraversal::index(*child), PositionInComposedTree::PositionIsOffsetInAnc
hor); |
| 1416 } | 1420 } |
| 1417 | 1421 |
| 1418 return PositionInComposedTree(pos.anchorNode(), static_cast<PositionInCompos
edTree::AnchorType>(pos.anchorType())); | 1422 return PositionInComposedTree(pos.anchorNode(), static_cast<PositionInCompos
edTree::AnchorType>(pos.anchorType())); |
| 1419 } | 1423 } |
| 1420 | 1424 |
| 1421 Position toPositionInDOMTree(const PositionInComposedTree& position) | 1425 Position toPositionInDOMTree(const PositionInComposedTree& position) |
| 1422 { | 1426 { |
| 1423 if (position.isNull()) | 1427 if (position.isNull()) |
| 1424 return Position(); | 1428 return Position(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 | 1539 |
| 1536 void showTree(const blink::Position* pos) | 1540 void showTree(const blink::Position* pos) |
| 1537 { | 1541 { |
| 1538 if (pos) | 1542 if (pos) |
| 1539 pos->showTreeForThis(); | 1543 pos->showTreeForThis(); |
| 1540 else | 1544 else |
| 1541 fprintf(stderr, "Cannot showTree for (nil)\n"); | 1545 fprintf(stderr, "Cannot showTree for (nil)\n"); |
| 1542 } | 1546 } |
| 1543 | 1547 |
| 1544 #endif | 1548 #endif |
| OLD | NEW |