| 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 if (Strategy::editingIgnoresContent(currentNode) || isRenderedHTMLTableE
lement(currentNode)) { | 835 if (Strategy::editingIgnoresContent(currentNode) || isRenderedHTMLTableE
lement(currentNode)) { |
| 836 if (currentPos.offsetInLeafNode() <= layoutObject->caretMinOffset()) | 836 if (currentPos.offsetInLeafNode() <= layoutObject->caretMinOffset()) |
| 837 return createLegacyEditingPosition(currentNode, layoutObject->ca
retMinOffset()); | 837 return createLegacyEditingPosition(currentNode, layoutObject->ca
retMinOffset()); |
| 838 continue; | 838 continue; |
| 839 } | 839 } |
| 840 | 840 |
| 841 // return current position if it is in laid out text | 841 // return current position if it is in laid out text |
| 842 if (layoutObject->isText() && toLayoutText(layoutObject)->firstTextBox()
) { | 842 if (layoutObject->isText() && toLayoutText(layoutObject)->firstTextBox()
) { |
| 843 if (currentNode != startNode) { | 843 if (currentNode != startNode) { |
| 844 ASSERT(currentPos.atStartOfNode()); | 844 ASSERT(currentPos.atStartOfNode()); |
| 845 return createLegacyEditingPosition(currentNode, layoutObject->ca
retMinOffset()); | 845 return PositionAlgorithm<Strategy>(currentNode, layoutObject->ca
retMinOffset()); |
| 846 } | 846 } |
| 847 | 847 |
| 848 unsigned textOffset = currentPos.offsetInLeafNode(); | 848 unsigned textOffset = currentPos.offsetInLeafNode(); |
| 849 LayoutText* textLayoutObject = toLayoutText(layoutObject); | 849 LayoutText* textLayoutObject = toLayoutText(layoutObject); |
| 850 InlineTextBox* lastTextBox = textLayoutObject->lastTextBox(); | 850 InlineTextBox* lastTextBox = textLayoutObject->lastTextBox(); |
| 851 for (InlineTextBox* box = textLayoutObject->firstTextBox(); box; box
= box->nextTextBox()) { | 851 for (InlineTextBox* box = textLayoutObject->firstTextBox(); box; box
= box->nextTextBox()) { |
| 852 if (textOffset <= box->end()) { | 852 if (textOffset <= box->end()) { |
| 853 if (textOffset >= box->start()) | 853 if (textOffset >= box->start()) |
| 854 return currentPos.deprecatedComputePosition(); | 854 return currentPos.deprecatedComputePosition(); |
| 855 continue; | 855 continue; |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 | 1538 |
| 1539 void showTree(const blink::Position* pos) | 1539 void showTree(const blink::Position* pos) |
| 1540 { | 1540 { |
| 1541 if (pos) | 1541 if (pos) |
| 1542 pos->showTreeForThis(); | 1542 pos->showTreeForThis(); |
| 1543 else | 1543 else |
| 1544 fprintf(stderr, "Cannot showTree for (nil)\n"); | 1544 fprintf(stderr, "Cannot showTree for (nil)\n"); |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 #endif | 1547 #endif |
| OLD | NEW |