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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 LayoutObject* layoutObject = position.anchorNode()->layoutObject(); | 105 LayoutObject* layoutObject = position.anchorNode()->layoutObject(); |
106 if (!layoutObject) | 106 if (!layoutObject) |
107 return false; | 107 return false; |
108 | 108 |
109 return toLayoutText(layoutObject)->isRenderedCharacter(position.offsetInCont
ainerNode()); | 109 return toLayoutText(layoutObject)->isRenderedCharacter(position.offsetInCont
ainerNode()); |
110 } | 110 } |
111 | 111 |
112 void EditCommand::setParent(CompositeEditCommand* parent) | 112 void EditCommand::setParent(CompositeEditCommand* parent) |
113 { | 113 { |
114 DCHECK((parent && !m_parent) || (!parent && m_parent)); | 114 DCHECK((parent && !m_parent) || (!parent && m_parent)); |
115 DCHECK(!parent || !isCompositeEditCommand() || !toCompositeEditCommand(this)
->composition()); | 115 // Only allow merging |InsertFromDrop| with previous |DeleteByDrag| after ap
plied. |
| 116 DCHECK(!parent || !isCompositeEditCommand() || inputType() == InputEvent::In
putType::InsertFromDrop || !toCompositeEditCommand(this)->composition()); |
116 m_parent = parent; | 117 m_parent = parent; |
117 if (parent) { | 118 if (parent) { |
118 m_startingSelection = parent->m_endingSelection; | 119 m_startingSelection = parent->m_endingSelection; |
119 m_endingSelection = parent->m_endingSelection; | 120 m_endingSelection = parent->m_endingSelection; |
120 } | 121 } |
121 } | 122 } |
122 | 123 |
123 void SimpleEditCommand::doReapply() | 124 void SimpleEditCommand::doReapply() |
124 { | 125 { |
125 EditingState editingState; | 126 EditingState editingState; |
126 doApply(&editingState); | 127 doApply(&editingState); |
127 } | 128 } |
128 | 129 |
129 DEFINE_TRACE(EditCommand) | 130 DEFINE_TRACE(EditCommand) |
130 { | 131 { |
131 visitor->trace(m_document); | 132 visitor->trace(m_document); |
132 visitor->trace(m_startingSelection); | 133 visitor->trace(m_startingSelection); |
133 visitor->trace(m_endingSelection); | 134 visitor->trace(m_endingSelection); |
134 visitor->trace(m_parent); | 135 visitor->trace(m_parent); |
135 } | 136 } |
136 | 137 |
137 } // namespace blink | 138 } // namespace blink |
OLD | NEW |