| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 switch (position.anchorType()) { | 467 switch (position.anchorType()) { |
| 468 case PositionAnchorType::AfterChildren: | 468 case PositionAnchorType::AfterChildren: |
| 469 // FIXME: When anchorNode is <img>, assertion fails in the constructor. | 469 // FIXME: When anchorNode is <img>, assertion fails in the constructor. |
| 470 return Position(anchorNode, PositionAnchorType::AfterChildren); | 470 return Position(anchorNode, PositionAnchorType::AfterChildren); |
| 471 case PositionAnchorType::AfterAnchor: | 471 case PositionAnchorType::AfterAnchor: |
| 472 return Position::afterNode(anchorNode); | 472 return Position::afterNode(anchorNode); |
| 473 case PositionAnchorType::BeforeChildren: | 473 case PositionAnchorType::BeforeChildren: |
| 474 return Position(anchorNode, PositionAnchorType::BeforeChildren); | 474 return Position(anchorNode, PositionAnchorType::BeforeChildren); |
| 475 case PositionAnchorType::BeforeAnchor: | 475 case PositionAnchorType::BeforeAnchor: |
| 476 return positionBeforeNode(anchorNode); | 476 return Position::beforeNode(anchorNode); |
| 477 case PositionAnchorType::OffsetInAnchor: { | 477 case PositionAnchorType::OffsetInAnchor: { |
| 478 int offset = position.offsetInContainerNode(); | 478 int offset = position.offsetInContainerNode(); |
| 479 if (anchorNode->offsetInCharacters()) | 479 if (anchorNode->offsetInCharacters()) |
| 480 return Position(anchorNode, offset); | 480 return Position(anchorNode, offset); |
| 481 Node* child = FlatTreeTraversal::childAt(*anchorNode, offset); | 481 Node* child = FlatTreeTraversal::childAt(*anchorNode, offset); |
| 482 if (child) | 482 if (child) |
| 483 return Position(child->parentNode(), child->nodeIndex()); | 483 return Position(child->parentNode(), child->nodeIndex()); |
| 484 if (!position.offsetInContainerNode()) | 484 if (!position.offsetInContainerNode()) |
| 485 return Position(anchorNode, PositionAnchorType::BeforeChildren); | 485 return Position(anchorNode, PositionAnchorType::BeforeChildren); |
| 486 | 486 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 void showTree(const blink::Position* pos) | 612 void showTree(const blink::Position* pos) |
| 613 { | 613 { |
| 614 if (pos) | 614 if (pos) |
| 615 pos->showTreeForThis(); | 615 pos->showTreeForThis(); |
| 616 else | 616 else |
| 617 fprintf(stderr, "Cannot showTree for (nil)\n"); | 617 fprintf(stderr, "Cannot showTree for (nil)\n"); |
| 618 } | 618 } |
| 619 | 619 |
| 620 #endif | 620 #endif |
| OLD | NEW |