| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 unsigned positionOffset = static_cast<unsigned>(position.offsetInContainerNo
de()); | 372 unsigned positionOffset = static_cast<unsigned>(position.offsetInContainerNo
de()); |
| 373 // Replacing text can be viewed as a deletion followed by insertion. | 373 // Replacing text can be viewed as a deletion followed by insertion. |
| 374 if (positionOffset >= offset && positionOffset <= offset + oldLength) | 374 if (positionOffset >= offset && positionOffset <= offset + oldLength) |
| 375 positionOffset = offset; | 375 positionOffset = offset; |
| 376 | 376 |
| 377 // Adjust the offset if the position is after the end of the deleted content
s | 377 // Adjust the offset if the position is after the end of the deleted content
s |
| 378 // (positionOffset > offset + oldLength) to avoid having a stale offset. | 378 // (positionOffset > offset + oldLength) to avoid having a stale offset. |
| 379 if (positionOffset > offset + oldLength) | 379 if (positionOffset > offset + oldLength) |
| 380 positionOffset = positionOffset - oldLength + newLength; | 380 positionOffset = positionOffset - oldLength + newLength; |
| 381 | 381 |
| 382 ASSERT(positionOffset <= node->length()); | 382 ASSERT_WITH_SECURITY_IMPLICATION(positionOffset <= node->length()); |
| 383 // CharacterNode in VisibleSelection must be Text node, because Comment | 383 // CharacterNode in VisibleSelection must be Text node, because Comment |
| 384 // and ProcessingInstruction node aren't visible. | 384 // and ProcessingInstruction node aren't visible. |
| 385 return Position(toText(node), positionOffset); | 385 return Position(toText(node), positionOffset); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void FrameSelection::didUpdateCharacterData(CharacterData* node, unsigned offset
, unsigned oldLength, unsigned newLength) | 388 void FrameSelection::didUpdateCharacterData(CharacterData* node, unsigned offset
, unsigned oldLength, unsigned newLength) |
| 389 { | 389 { |
| 390 // The fragment check is a performance optimization. See http://trac.webkit.
org/changeset/30062. | 390 // The fragment check is a performance optimization. See http://trac.webkit.
org/changeset/30062. |
| 391 if (isNone() || !node || !node->inDocument()) | 391 if (isNone() || !node || !node->inDocument()) |
| 392 return; | 392 return; |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 sel.showTreeForThis(); | 1824 sel.showTreeForThis(); |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 void showTree(const WebCore::FrameSelection* sel) | 1827 void showTree(const WebCore::FrameSelection* sel) |
| 1828 { | 1828 { |
| 1829 if (sel) | 1829 if (sel) |
| 1830 sel->showTreeForThis(); | 1830 sel->showTreeForThis(); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 #endif | 1833 #endif |
| OLD | NEW |