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 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1965 // also avoid structural elements like lists and blocks (5142012). | 1965 // also avoid structural elements like lists and blocks (5142012). |
1966 if (original.anchorNode() != enclosingAnchor && | 1966 if (original.anchorNode() != enclosingAnchor && |
1967 original.anchorNode()->parentNode() != enclosingAnchor) { | 1967 original.anchorNode()->parentNode() != enclosingAnchor) { |
1968 pushAnchorElementDown(enclosingAnchor, editingState); | 1968 pushAnchorElementDown(enclosingAnchor, editingState); |
1969 if (editingState->isAborted()) | 1969 if (editingState->isAborted()) |
1970 return original; | 1970 return original; |
1971 enclosingAnchor = enclosingAnchorElement(original); | 1971 enclosingAnchor = enclosingAnchorElement(original); |
1972 if (!enclosingAnchor) | 1972 if (!enclosingAnchor) |
1973 return original; | 1973 return original; |
1974 } | 1974 } |
1975 | |
1976 document().updateStyleAndLayoutIgnorePendingStylesheets(); | |
yosin_UTC9
2017/01/12 04:52:26
Could you add following comment as same as others:
Xiaocheng
2017/01/12 07:39:43
We don't use to put this notes in editing/commands
yosin_UTC9
2017/01/12 09:39:55
Talk offline. We don't need to have a comment ment
| |
1977 | |
1975 // Don't insert outside an anchor if doing so would skip over a line | 1978 // Don't insert outside an anchor if doing so would skip over a line |
1976 // break. It would probably be safe to move the line break so that we | 1979 // break. It would probably be safe to move the line break so that we |
1977 // could still avoid the anchor here. | 1980 // could still avoid the anchor here. |
1978 Position downstream( | 1981 Position downstream( |
1979 mostForwardCaretPosition(visiblePos.deepEquivalent())); | 1982 mostForwardCaretPosition(visiblePos.deepEquivalent())); |
1980 if (lineBreakExistsAtVisiblePosition(visiblePos) && | 1983 if (lineBreakExistsAtVisiblePosition(visiblePos) && |
1981 downstream.anchorNode()->isDescendantOf(enclosingAnchor)) | 1984 downstream.anchorNode()->isDescendantOf(enclosingAnchor)) |
1982 return original; | 1985 return original; |
1983 | 1986 |
1984 result = Position::inParentAfterNode(*enclosingAnchor); | 1987 result = Position::inParentAfterNode(*enclosingAnchor); |
1985 } | 1988 } |
1986 | 1989 |
1987 document().updateStyleAndLayoutIgnorePendingStylesheets(); | |
1988 | |
1989 // If visually just before an anchor, insert *outside* the anchor unless | 1990 // If visually just before an anchor, insert *outside* the anchor unless |
1990 // it's the first VisiblePosition in a paragraph, to match NSTextView. | 1991 // it's the first VisiblePosition in a paragraph, to match NSTextView. |
1991 if (visiblePos.deepEquivalent() == firstInAnchor.deepEquivalent()) { | 1992 if (visiblePos.deepEquivalent() == firstInAnchor.deepEquivalent()) { |
1992 // Make sure anchors are pushed down before avoiding them so that we don't | 1993 // Make sure anchors are pushed down before avoiding them so that we don't |
1993 // also avoid structural elements like lists and blocks (5142012). | 1994 // also avoid structural elements like lists and blocks (5142012). |
1994 if (original.anchorNode() != enclosingAnchor && | 1995 if (original.anchorNode() != enclosingAnchor && |
1995 original.anchorNode()->parentNode() != enclosingAnchor) { | 1996 original.anchorNode()->parentNode() != enclosingAnchor) { |
1996 pushAnchorElementDown(enclosingAnchor, editingState); | 1997 pushAnchorElementDown(enclosingAnchor, editingState); |
1997 if (editingState->isAborted()) | 1998 if (editingState->isAborted()) |
1998 return original; | 1999 return original; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2047 return node; | 2048 return node; |
2048 } | 2049 } |
2049 | 2050 |
2050 DEFINE_TRACE(CompositeEditCommand) { | 2051 DEFINE_TRACE(CompositeEditCommand) { |
2051 visitor->trace(m_commands); | 2052 visitor->trace(m_commands); |
2052 visitor->trace(m_composition); | 2053 visitor->trace(m_composition); |
2053 EditCommand::trace(visitor); | 2054 EditCommand::trace(visitor); |
2054 } | 2055 } |
2055 | 2056 |
2056 } // namespace blink | 2057 } // namespace blink |
OLD | NEW |