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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 Position end = endOfParagraphToMove.deepEquivalent().upstream(); | 1171 Position end = endOfParagraphToMove.deepEquivalent().upstream(); |
1172 | 1172 |
1173 // start and end can't be used directly to create a Range; they are "editing
positions" | 1173 // start and end can't be used directly to create a Range; they are "editing
positions" |
1174 Position startRangeCompliant = start.parentAnchoredEquivalent(); | 1174 Position startRangeCompliant = start.parentAnchoredEquivalent(); |
1175 Position endRangeCompliant = end.parentAnchoredEquivalent(); | 1175 Position endRangeCompliant = end.parentAnchoredEquivalent(); |
1176 RefPtr<Range> range = Range::create(document(), startRangeCompliant.deprecat
edNode(), startRangeCompliant.deprecatedEditingOffset(), endRangeCompliant.depre
catedNode(), endRangeCompliant.deprecatedEditingOffset()); | 1176 RefPtr<Range> range = Range::create(document(), startRangeCompliant.deprecat
edNode(), startRangeCompliant.deprecatedEditingOffset(), endRangeCompliant.depre
catedNode(), endRangeCompliant.deprecatedEditingOffset()); |
1177 | 1177 |
1178 // FIXME: This is an inefficient way to preserve style on nodes in the parag
raph to move. It | 1178 // FIXME: This is an inefficient way to preserve style on nodes in the parag
raph to move. It |
1179 // shouldn't matter though, since moved paragraphs will usually be quite sma
ll. | 1179 // shouldn't matter though, since moved paragraphs will usually be quite sma
ll. |
1180 RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraph
ToMove ? | 1180 RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraph
ToMove ? |
1181 createFragmentFromMarkup(&document(), createMarkup(range.get(), 0, DoNot
AnnotateForInterchange, true, DoNotResolveURLs, constrainingAncestor), "") : 0; | 1181 createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotA
nnotateForInterchange, true, DoNotResolveURLs, constrainingAncestor), "") : 0; |
1182 | 1182 |
1183 // A non-empty paragraph's style is moved when we copy and move it. We don'
t move | 1183 // A non-empty paragraph's style is moved when we copy and move it. We don'
t move |
1184 // anything if we're given an empty paragraph, but an empty paragraph can ha
ve style | 1184 // anything if we're given an empty paragraph, but an empty paragraph can ha
ve style |
1185 // too, <div><b><br></b></div> for example. Save it so that we can preserve
it later. | 1185 // too, <div><b><br></b></div> for example. Save it so that we can preserve
it later. |
1186 RefPtr<EditingStyle> styleInEmptyParagraph; | 1186 RefPtr<EditingStyle> styleInEmptyParagraph; |
1187 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { | 1187 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { |
1188 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); | 1188 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); |
1189 styleInEmptyParagraph->mergeTypingStyle(&document()); | 1189 styleInEmptyParagraph->mergeTypingStyle(&document()); |
1190 // The moved paragraph should assume the block style of the destination. | 1190 // The moved paragraph should assume the block style of the destination. |
1191 styleInEmptyParagraph->removeBlockProperties(); | 1191 styleInEmptyParagraph->removeBlockProperties(); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 return node.release(); | 1455 return node.release(); |
1456 } | 1456 } |
1457 | 1457 |
1458 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1458 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1459 { | 1459 { |
1460 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1460 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1461 return breakNode.release(); | 1461 return breakNode.release(); |
1462 } | 1462 } |
1463 | 1463 |
1464 } // namespace WebCore | 1464 } // namespace WebCore |
OLD | NEW |