| 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 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 | 1794 |
| 1795 if (!enclosing_anchor) | 1795 if (!enclosing_anchor) |
| 1796 return result; | 1796 return result; |
| 1797 | 1797 |
| 1798 // Don't avoid block level anchors, because that would insert content into the | 1798 // Don't avoid block level anchors, because that would insert content into the |
| 1799 // wrong paragraph. | 1799 // wrong paragraph. |
| 1800 if (enclosing_anchor && !IsEnclosingBlock(enclosing_anchor)) { | 1800 if (enclosing_anchor && !IsEnclosingBlock(enclosing_anchor)) { |
| 1801 VisiblePosition first_in_anchor = | 1801 VisiblePosition first_in_anchor = |
| 1802 VisiblePosition::FirstPositionInNode(*enclosing_anchor); | 1802 VisiblePosition::FirstPositionInNode(*enclosing_anchor); |
| 1803 VisiblePosition last_in_anchor = | 1803 VisiblePosition last_in_anchor = |
| 1804 VisiblePosition::LastPositionInNode(enclosing_anchor); | 1804 VisiblePosition::LastPositionInNode(*enclosing_anchor); |
| 1805 // If visually just after the anchor, insert *inside* the anchor unless it's | 1805 // If visually just after the anchor, insert *inside* the anchor unless it's |
| 1806 // the last VisiblePosition in the document, to match NSTextView. | 1806 // the last VisiblePosition in the document, to match NSTextView. |
| 1807 if (visible_pos.DeepEquivalent() == last_in_anchor.DeepEquivalent()) { | 1807 if (visible_pos.DeepEquivalent() == last_in_anchor.DeepEquivalent()) { |
| 1808 // Make sure anchors are pushed down before avoiding them so that we don't | 1808 // Make sure anchors are pushed down before avoiding them so that we don't |
| 1809 // also avoid structural elements like lists and blocks (5142012). | 1809 // also avoid structural elements like lists and blocks (5142012). |
| 1810 if (original.AnchorNode() != enclosing_anchor && | 1810 if (original.AnchorNode() != enclosing_anchor && |
| 1811 original.AnchorNode()->parentNode() != enclosing_anchor) { | 1811 original.AnchorNode()->parentNode() != enclosing_anchor) { |
| 1812 PushAnchorElementDown(enclosing_anchor, editing_state); | 1812 PushAnchorElementDown(enclosing_anchor, editing_state); |
| 1813 if (editing_state->IsAborted()) | 1813 if (editing_state->IsAborted()) |
| 1814 return original; | 1814 return original; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 | 1975 |
| 1976 DEFINE_TRACE(CompositeEditCommand) { | 1976 DEFINE_TRACE(CompositeEditCommand) { |
| 1977 visitor->Trace(commands_); | 1977 visitor->Trace(commands_); |
| 1978 visitor->Trace(starting_selection_); | 1978 visitor->Trace(starting_selection_); |
| 1979 visitor->Trace(ending_selection_); | 1979 visitor->Trace(ending_selection_); |
| 1980 visitor->Trace(undo_step_); | 1980 visitor->Trace(undo_step_); |
| 1981 EditCommand::Trace(visitor); | 1981 EditCommand::Trace(visitor); |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 } // namespace blink | 1984 } // namespace blink |
| OLD | NEW |