| 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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ASSERT(!isActiveInsertionPoint(*anchor)); | 1411 ASSERT(!isActiveInsertionPoint(*anchor)); |
| 1412 int offset = pos.computeOffsetInContainerNode(); | 1412 int offset = pos.computeOffsetInContainerNode(); |
| 1413 Node* child = NodeTraversal::childAt(*anchor, offset); | 1413 Node* child = NodeTraversal::childAt(*anchor, offset); |
| 1414 if (!child) | 1414 if (!child) { |
| 1415 if (anchor->isShadowRoot()) |
| 1416 return PositionInComposedTree(anchor->shadowHost(), PositionInCo
mposedTree::PositionIsAfterChildren); |
| 1415 return PositionInComposedTree(anchor, PositionInComposedTree::Positi
onIsAfterChildren); | 1417 return PositionInComposedTree(anchor, PositionInComposedTree::Positi
onIsAfterChildren); |
| 1418 } |
| 1416 child->updateDistribution(); | 1419 child->updateDistribution(); |
| 1417 if (isActiveInsertionPoint(*child)) | 1420 if (isActiveInsertionPoint(*child)) { |
| 1421 if (anchor->isShadowRoot()) |
| 1422 return PositionInComposedTree(anchor->shadowHost(), offset, Posi
tionInComposedTree::PositionIsOffsetInAnchor); |
| 1418 return PositionInComposedTree(anchor, offset, PositionInComposedTree
::PositionIsOffsetInAnchor); | 1423 return PositionInComposedTree(anchor, offset, PositionInComposedTree
::PositionIsOffsetInAnchor); |
| 1424 } |
| 1419 return PositionInComposedTree(ComposedTreeTraversal::parent(*child), Com
posedTreeTraversal::index(*child), PositionInComposedTree::PositionIsOffsetInAnc
hor); | 1425 return PositionInComposedTree(ComposedTreeTraversal::parent(*child), Com
posedTreeTraversal::index(*child), PositionInComposedTree::PositionIsOffsetInAnc
hor); |
| 1420 } | 1426 } |
| 1421 | 1427 |
| 1422 return PositionInComposedTree(pos.anchorNode(), static_cast<PositionInCompos
edTree::AnchorType>(pos.anchorType())); | 1428 return PositionInComposedTree(pos.anchorNode(), static_cast<PositionInCompos
edTree::AnchorType>(pos.anchorType())); |
| 1423 } | 1429 } |
| 1424 | 1430 |
| 1425 Position toPositionInDOMTree(const PositionInComposedTree& position) | 1431 Position toPositionInDOMTree(const PositionInComposedTree& position) |
| 1426 { | 1432 { |
| 1427 if (position.isNull()) | 1433 if (position.isNull()) |
| 1428 return Position(); | 1434 return Position(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 | 1545 |
| 1540 void showTree(const blink::Position* pos) | 1546 void showTree(const blink::Position* pos) |
| 1541 { | 1547 { |
| 1542 if (pos) | 1548 if (pos) |
| 1543 pos->showTreeForThis(); | 1549 pos->showTreeForThis(); |
| 1544 else | 1550 else |
| 1545 fprintf(stderr, "Cannot showTree for (nil)\n"); | 1551 fprintf(stderr, "Cannot showTree for (nil)\n"); |
| 1546 } | 1552 } |
| 1547 | 1553 |
| 1548 #endif | 1554 #endif |
| OLD | NEW |