| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "core/editing/SpellChecker.h" | 55 #include "core/editing/SpellChecker.h" |
| 56 #include "core/editing/SplitElementCommand.h" | 56 #include "core/editing/SplitElementCommand.h" |
| 57 #include "core/editing/SplitTextNodeCommand.h" | 57 #include "core/editing/SplitTextNodeCommand.h" |
| 58 #include "core/editing/SplitTextNodeContainingElementCommand.h" | 58 #include "core/editing/SplitTextNodeContainingElementCommand.h" |
| 59 #include "core/editing/TextIterator.h" | 59 #include "core/editing/TextIterator.h" |
| 60 #include "core/editing/VisibleUnits.h" | 60 #include "core/editing/VisibleUnits.h" |
| 61 #include "core/editing/WrapContentsInDummySpanCommand.h" | 61 #include "core/editing/WrapContentsInDummySpanCommand.h" |
| 62 #include "core/editing/htmlediting.h" | 62 #include "core/editing/htmlediting.h" |
| 63 #include "core/editing/markup.h" | 63 #include "core/editing/markup.h" |
| 64 #include "core/events/ScopedEventQueue.h" | 64 #include "core/events/ScopedEventQueue.h" |
| 65 #include "core/frame/FrameProtector.h" |
| 65 #include "core/frame/LocalFrame.h" | 66 #include "core/frame/LocalFrame.h" |
| 66 #include "core/html/HTMLBRElement.h" | 67 #include "core/html/HTMLBRElement.h" |
| 67 #include "core/html/HTMLDivElement.h" | 68 #include "core/html/HTMLDivElement.h" |
| 68 #include "core/html/HTMLElement.h" | 69 #include "core/html/HTMLElement.h" |
| 69 #include "core/html/HTMLLIElement.h" | 70 #include "core/html/HTMLLIElement.h" |
| 70 #include "core/html/HTMLQuoteElement.h" | 71 #include "core/html/HTMLQuoteElement.h" |
| 71 #include "core/html/HTMLSpanElement.h" | 72 #include "core/html/HTMLSpanElement.h" |
| 72 #include "core/rendering/InlineTextBox.h" | 73 #include "core/rendering/InlineTextBox.h" |
| 73 #include "core/rendering/RenderBlock.h" | 74 #include "core/rendering/RenderBlock.h" |
| 74 #include "core/rendering/RenderListItem.h" | 75 #include "core/rendering/RenderListItem.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 96 | 97 |
| 97 bool EditCommandComposition::belongsTo(const LocalFrame& frame) const | 98 bool EditCommandComposition::belongsTo(const LocalFrame& frame) const |
| 98 { | 99 { |
| 99 ASSERT(m_document); | 100 ASSERT(m_document); |
| 100 return m_document->frame() == &frame; | 101 return m_document->frame() == &frame; |
| 101 } | 102 } |
| 102 | 103 |
| 103 void EditCommandComposition::unapply() | 104 void EditCommandComposition::unapply() |
| 104 { | 105 { |
| 105 ASSERT(m_document); | 106 ASSERT(m_document); |
| 106 RefPtr<LocalFrame> frame = m_document->frame(); | 107 LocalFrame* frame = m_document->frame(); |
| 108 FrameProtector protect(frame); |
| 107 ASSERT(frame); | 109 ASSERT(frame); |
| 108 | 110 |
| 109 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. | 111 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. |
| 110 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one | 112 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one |
| 111 // if one is necessary (like for the creation of VisiblePositions). | 113 // if one is necessary (like for the creation of VisiblePositions). |
| 112 m_document->updateLayoutIgnorePendingStylesheets(); | 114 m_document->updateLayoutIgnorePendingStylesheets(); |
| 113 | 115 |
| 114 { | 116 { |
| 115 size_t size = m_commands.size(); | 117 size_t size = m_commands.size(); |
| 116 for (size_t i = size; i; --i) | 118 for (size_t i = size; i; --i) |
| 117 m_commands[i - 1]->doUnapply(); | 119 m_commands[i - 1]->doUnapply(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 frame->editor().unappliedEditing(this); | 122 frame->editor().unappliedEditing(this); |
| 121 } | 123 } |
| 122 | 124 |
| 123 void EditCommandComposition::reapply() | 125 void EditCommandComposition::reapply() |
| 124 { | 126 { |
| 125 ASSERT(m_document); | 127 ASSERT(m_document); |
| 126 RefPtr<LocalFrame> frame = m_document->frame(); | 128 LocalFrame* frame = m_document->frame(); |
| 129 FrameProtector protect(frame); |
| 127 ASSERT(frame); | 130 ASSERT(frame); |
| 128 | 131 |
| 129 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. | 132 // Changes to the document may have been made since the last editing operati
on that require a layout, as in <rdar://problem/5658603>. |
| 130 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one | 133 // Low level operations, like RemoveNodeCommand, don't require a layout beca
use the high level operations that use them perform one |
| 131 // if one is necessary (like for the creation of VisiblePositions). | 134 // if one is necessary (like for the creation of VisiblePositions). |
| 132 m_document->updateLayoutIgnorePendingStylesheets(); | 135 m_document->updateLayoutIgnorePendingStylesheets(); |
| 133 | 136 |
| 134 { | 137 { |
| 135 size_t size = m_commands.size(); | 138 size_t size = m_commands.size(); |
| 136 for (size_t i = 0; i != size; ++i) | 139 for (size_t i = 0; i != size; ++i) |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 } | 1502 } |
| 1500 | 1503 |
| 1501 void CompositeEditCommand::trace(Visitor* visitor) | 1504 void CompositeEditCommand::trace(Visitor* visitor) |
| 1502 { | 1505 { |
| 1503 visitor->trace(m_commands); | 1506 visitor->trace(m_commands); |
| 1504 visitor->trace(m_composition); | 1507 visitor->trace(m_composition); |
| 1505 EditCommand::trace(visitor); | 1508 EditCommand::trace(visitor); |
| 1506 } | 1509 } |
| 1507 | 1510 |
| 1508 } // namespace blink | 1511 } // namespace blink |
| OLD | NEW |