OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 LayoutObject* layoutObject = position.anchorNode()->layoutObject(); | 95 LayoutObject* layoutObject = position.anchorNode()->layoutObject(); |
96 if (!layoutObject) | 96 if (!layoutObject) |
97 return false; | 97 return false; |
98 | 98 |
99 return toLayoutText(layoutObject) | 99 return toLayoutText(layoutObject) |
100 ->isRenderedCharacter(position.offsetInContainerNode()); | 100 ->isRenderedCharacter(position.offsetInContainerNode()); |
101 } | 101 } |
102 | 102 |
103 void EditCommand::setParent(CompositeEditCommand* parent) { | 103 void EditCommand::setParent(CompositeEditCommand* parent) { |
104 DCHECK((parent && !m_parent) || (!parent && m_parent)); | 104 DCHECK((parent && !m_parent) || (!parent && m_parent)); |
105 DCHECK(!parent || !isCompositeEditCommand() || | 105 // Currently only allow merging |InsertFromDrop| and |DeleteByDrag| with |Drag
AndDropCommand| after applied. |
| 106 DCHECK(!parent || parent->isCommandGroupWrapper() || |
| 107 !isCompositeEditCommand() || |
106 !toCompositeEditCommand(this)->composition()); | 108 !toCompositeEditCommand(this)->composition()); |
107 m_parent = parent; | 109 m_parent = parent; |
108 if (parent) { | 110 if (parent) { |
109 m_startingSelection = parent->m_endingSelection; | 111 m_startingSelection = parent->m_endingSelection; |
110 m_endingSelection = parent->m_endingSelection; | 112 m_endingSelection = parent->m_endingSelection; |
111 } | 113 } |
112 } | 114 } |
113 | 115 |
114 void SimpleEditCommand::doReapply() { | 116 void SimpleEditCommand::doReapply() { |
115 EditingState editingState; | 117 EditingState editingState; |
116 doApply(&editingState); | 118 doApply(&editingState); |
117 } | 119 } |
118 | 120 |
119 DEFINE_TRACE(EditCommand) { | 121 DEFINE_TRACE(EditCommand) { |
120 visitor->trace(m_document); | 122 visitor->trace(m_document); |
121 visitor->trace(m_startingSelection); | 123 visitor->trace(m_startingSelection); |
122 visitor->trace(m_endingSelection); | 124 visitor->trace(m_endingSelection); |
123 visitor->trace(m_parent); | 125 visitor->trace(m_parent); |
124 } | 126 } |
125 | 127 |
126 } // namespace blink | 128 } // namespace blink |
OLD | NEW |