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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void EditCommandComposition::unapply() | 86 void EditCommandComposition::unapply() |
87 { | 87 { |
88 ASSERT(m_document); | 88 ASSERT(m_document); |
89 RefPtr<LocalFrame> frame = m_document->frame(); | 89 RefPtr<LocalFrame> frame = m_document->frame(); |
90 ASSERT(frame); | 90 ASSERT(frame); |
91 | 91 |
92 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. | 92 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. |
93 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one | 93 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one |
94 // if one is necessary (like for the creation of VisiblePositions). | 94 // if one is necessary (like for the creation of VisiblePositions). |
95 m_document->updateLayoutIgnorePendingStylesheets(); | 95 m_document->updateLayout(); |
96 | 96 |
97 { | 97 { |
98 size_t size = m_commands.size(); | 98 size_t size = m_commands.size(); |
99 for (size_t i = size; i; --i) | 99 for (size_t i = size; i; --i) |
100 m_commands[i - 1]->doUnapply(); | 100 m_commands[i - 1]->doUnapply(); |
101 } | 101 } |
102 | 102 |
103 frame->editor().unappliedEditing(this); | 103 frame->editor().unappliedEditing(this); |
104 } | 104 } |
105 | 105 |
106 void EditCommandComposition::reapply() | 106 void EditCommandComposition::reapply() |
107 { | 107 { |
108 ASSERT(m_document); | 108 ASSERT(m_document); |
109 RefPtr<LocalFrame> frame = m_document->frame(); | 109 RefPtr<LocalFrame> frame = m_document->frame(); |
110 ASSERT(frame); | 110 ASSERT(frame); |
111 | 111 |
112 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. | 112 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. |
113 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one | 113 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one |
114 // if one is necessary (like for the creation of VisiblePositions). | 114 // if one is necessary (like for the creation of VisiblePositions). |
115 m_document->updateLayoutIgnorePendingStylesheets(); | 115 m_document->updateLayout(); |
116 | 116 |
117 { | 117 { |
118 size_t size = m_commands.size(); | 118 size_t size = m_commands.size(); |
119 for (size_t i = 0; i != size; ++i) | 119 for (size_t i = 0; i != size; ++i) |
120 m_commands[i]->doReapply(); | 120 m_commands[i]->doReapply(); |
121 } | 121 } |
122 | 122 |
123 frame->editor().reappliedEditing(this); | 123 frame->editor().reappliedEditing(this); |
124 } | 124 } |
125 | 125 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 default: | 164 default: |
165 ASSERT_NOT_REACHED(); | 165 ASSERT_NOT_REACHED(); |
166 return; | 166 return; |
167 } | 167 } |
168 } | 168 } |
169 ensureComposition(); | 169 ensureComposition(); |
170 | 170 |
171 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. | 171 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. |
172 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one | 172 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one |
173 // if one is necessary (like for the creation of VisiblePositions). | 173 // if one is necessary (like for the creation of VisiblePositions). |
174 document().updateLayoutIgnorePendingStylesheets(); | 174 document().updateLayout(); |
175 | 175 |
176 LocalFrame* frame = document().frame(); | 176 LocalFrame* frame = document().frame(); |
177 ASSERT(frame); | 177 ASSERT(frame); |
178 { | 178 { |
179 EventQueueScope eventQueueScope; | 179 EventQueueScope eventQueueScope; |
180 doApply(); | 180 doApply(); |
181 } | 181 } |
182 | 182 |
183 // Only need to call appliedEditing for top-level commands, | 183 // Only need to call appliedEditing for top-level commands, |
184 // and TypingCommands do it on their own (see TypingCommand::typingAddedToOp
enCommand). | 184 // and TypingCommands do it on their own (see TypingCommand::typingAddedToOp
enCommand). |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 VisiblePosition positionInParent(firstPositionInNode(parentElement)); | 850 VisiblePosition positionInParent(firstPositionInNode(parentElement)); |
851 VisiblePosition positionInNode(firstPositionInOrBeforeNode(node.get())); | 851 VisiblePosition positionInNode(firstPositionInOrBeforeNode(node.get())); |
852 if (positionInParent != positionInNode) | 852 if (positionInParent != positionInNode) |
853 splitElement(parentElement, node); | 853 splitElement(parentElement, node); |
854 } | 854 } |
855 | 855 |
856 return node.release(); | 856 return node.release(); |
857 } | 857 } |
858 | 858 |
859 } // namespace blink | 859 } // namespace blink |
OLD | NEW |