| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 VisiblePosition visiblePos = createVisiblePosition(original); | 1534 VisiblePosition visiblePos = createVisiblePosition(original); |
| 1535 Element* enclosingAnchor = enclosingAnchorElement(original); | 1535 Element* enclosingAnchor = enclosingAnchorElement(original); |
| 1536 Position result = original; | 1536 Position result = original; |
| 1537 | 1537 |
| 1538 if (!enclosingAnchor) | 1538 if (!enclosingAnchor) |
| 1539 return result; | 1539 return result; |
| 1540 | 1540 |
| 1541 // Don't avoid block level anchors, because that would insert content into t
he wrong paragraph. | 1541 // Don't avoid block level anchors, because that would insert content into t
he wrong paragraph. |
| 1542 if (enclosingAnchor && !isEnclosingBlock(enclosingAnchor)) { | 1542 if (enclosingAnchor && !isEnclosingBlock(enclosingAnchor)) { |
| 1543 VisiblePosition firstInAnchor = VisiblePosition::firstPositionInNode(enc
losingAnchor); | 1543 VisiblePosition firstInAnchor = VisiblePosition::firstPositionInNode(enc
losingAnchor); |
| 1544 VisiblePosition lastInAnchor = createVisiblePosition(lastPositionInNode(
enclosingAnchor)); | 1544 VisiblePosition lastInAnchor = createVisiblePosition(Position::lastPosit
ionInNode(enclosingAnchor)); |
| 1545 // If visually just after the anchor, insert *inside* the anchor unless
it's the last | 1545 // If visually just after the anchor, insert *inside* the anchor unless
it's the last |
| 1546 // VisiblePosition in the document, to match NSTextView. | 1546 // VisiblePosition in the document, to match NSTextView. |
| 1547 if (visiblePos.deepEquivalent() == lastInAnchor.deepEquivalent()) { | 1547 if (visiblePos.deepEquivalent() == lastInAnchor.deepEquivalent()) { |
| 1548 // Make sure anchors are pushed down before avoiding them so that we
don't | 1548 // Make sure anchors are pushed down before avoiding them so that we
don't |
| 1549 // also avoid structural elements like lists and blocks (5142012). | 1549 // also avoid structural elements like lists and blocks (5142012). |
| 1550 if (original.anchorNode() != enclosingAnchor && original.anchorNode(
)->parentNode() != enclosingAnchor) { | 1550 if (original.anchorNode() != enclosingAnchor && original.anchorNode(
)->parentNode() != enclosingAnchor) { |
| 1551 pushAnchorElementDown(enclosingAnchor, editingState); | 1551 pushAnchorElementDown(enclosingAnchor, editingState); |
| 1552 if (editingState->isAborted()) | 1552 if (editingState->isAborted()) |
| 1553 return original; | 1553 return original; |
| 1554 enclosingAnchor = enclosingAnchorElement(original); | 1554 enclosingAnchor = enclosingAnchorElement(original); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 DEFINE_TRACE(CompositeEditCommand) | 1619 DEFINE_TRACE(CompositeEditCommand) |
| 1620 { | 1620 { |
| 1621 visitor->trace(m_commands); | 1621 visitor->trace(m_commands); |
| 1622 visitor->trace(m_composition); | 1622 visitor->trace(m_composition); |
| 1623 EditCommand::trace(visitor); | 1623 EditCommand::trace(visitor); |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 } // namespace blink | 1626 } // namespace blink |
| OLD | NEW |