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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 Position end = endOfParagraphToMove.deepEquivalent().upstream(); | 1204 Position end = endOfParagraphToMove.deepEquivalent().upstream(); |
1205 | 1205 |
1206 // start and end can't be used directly to create a Range; they are "editing
positions" | 1206 // start and end can't be used directly to create a Range; they are "editing
positions" |
1207 Position startRangeCompliant = start.parentAnchoredEquivalent(); | 1207 Position startRangeCompliant = start.parentAnchoredEquivalent(); |
1208 Position endRangeCompliant = end.parentAnchoredEquivalent(); | 1208 Position endRangeCompliant = end.parentAnchoredEquivalent(); |
1209 RefPtrWillBeRawPtr<Range> range = Range::create(document(), startRangeCompli
ant.deprecatedNode(), startRangeCompliant.deprecatedEditingOffset(), endRangeCom
pliant.deprecatedNode(), endRangeCompliant.deprecatedEditingOffset()); | 1209 RefPtrWillBeRawPtr<Range> range = Range::create(document(), startRangeCompli
ant.deprecatedNode(), startRangeCompliant.deprecatedEditingOffset(), endRangeCom
pliant.deprecatedNode(), endRangeCompliant.deprecatedEditingOffset()); |
1210 | 1210 |
1211 // FIXME: This is an inefficient way to preserve style on nodes in the parag
raph to move. It | 1211 // FIXME: This is an inefficient way to preserve style on nodes in the parag
raph to move. It |
1212 // shouldn't matter though, since moved paragraphs will usually be quite sma
ll. | 1212 // shouldn't matter though, since moved paragraphs will usually be quite sma
ll. |
1213 RefPtrWillBeRawPtr<DocumentFragment> fragment = startOfParagraphToMove != en
dOfParagraphToMove ? | 1213 RefPtrWillBeRawPtr<DocumentFragment> fragment = startOfParagraphToMove != en
dOfParagraphToMove ? |
1214 createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotA
nnotateForInterchange, true, DoNotResolveURLs, constrainingAncestor), "") : null
ptr; | 1214 createFragmentFromMarkup(document(), createMarkup(range.get(), DoNotAnno
tateForInterchange, true, DoNotResolveURLs, constrainingAncestor), "") : nullptr
; |
1215 | 1215 |
1216 // A non-empty paragraph's style is moved when we copy and move it. We don'
t move | 1216 // A non-empty paragraph's style is moved when we copy and move it. We don'
t move |
1217 // anything if we're given an empty paragraph, but an empty paragraph can ha
ve style | 1217 // anything if we're given an empty paragraph, but an empty paragraph can ha
ve style |
1218 // too, <div><b><br></b></div> for example. Save it so that we can preserve
it later. | 1218 // too, <div><b><br></b></div> for example. Save it so that we can preserve
it later. |
1219 RefPtrWillBeRawPtr<EditingStyle> styleInEmptyParagraph = nullptr; | 1219 RefPtrWillBeRawPtr<EditingStyle> styleInEmptyParagraph = nullptr; |
1220 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { | 1220 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { |
1221 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); | 1221 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); |
1222 styleInEmptyParagraph->mergeTypingStyle(&document()); | 1222 styleInEmptyParagraph->mergeTypingStyle(&document()); |
1223 // The moved paragraph should assume the block style of the destination. | 1223 // The moved paragraph should assume the block style of the destination. |
1224 styleInEmptyParagraph->removeBlockProperties(); | 1224 styleInEmptyParagraph->removeBlockProperties(); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 } | 1493 } |
1494 | 1494 |
1495 void CompositeEditCommand::trace(Visitor* visitor) | 1495 void CompositeEditCommand::trace(Visitor* visitor) |
1496 { | 1496 { |
1497 visitor->trace(m_commands); | 1497 visitor->trace(m_commands); |
1498 visitor->trace(m_composition); | 1498 visitor->trace(m_composition); |
1499 EditCommand::trace(visitor); | 1499 EditCommand::trace(visitor); |
1500 } | 1500 } |
1501 | 1501 |
1502 } // namespace blink | 1502 } // namespace blink |
OLD | NEW |