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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 Position start = startOfParagraphToMove.deepEquivalent().downstream(); | 1182 Position start = startOfParagraphToMove.deepEquivalent().downstream(); |
1183 Position end = endOfParagraphToMove.deepEquivalent().upstream(); | 1183 Position end = endOfParagraphToMove.deepEquivalent().upstream(); |
1184 | 1184 |
1185 // start and end can't be used directly to create a Range; they are "editing
positions" | 1185 // start and end can't be used directly to create a Range; they are "editing
positions" |
1186 Position startRangeCompliant = start.parentAnchoredEquivalent(); | 1186 Position startRangeCompliant = start.parentAnchoredEquivalent(); |
1187 Position endRangeCompliant = end.parentAnchoredEquivalent(); | 1187 Position endRangeCompliant = end.parentAnchoredEquivalent(); |
1188 RefPtrWillBeRawPtr<Range> range = Range::create(document(), startRangeCompli
ant.deprecatedNode(), startRangeCompliant.deprecatedEditingOffset(), endRangeCom
pliant.deprecatedNode(), endRangeCompliant.deprecatedEditingOffset()); | 1188 RefPtrWillBeRawPtr<Range> range = Range::create(document(), startRangeCompli
ant.deprecatedNode(), startRangeCompliant.deprecatedEditingOffset(), endRangeCom
pliant.deprecatedNode(), endRangeCompliant.deprecatedEditingOffset()); |
1189 | 1189 |
1190 // FIXME: This is an inefficient way to preserve style on nodes in the parag
raph to move. It | 1190 // FIXME: This is an inefficient way to preserve style on nodes in the parag
raph to move. It |
1191 // shouldn't matter though, since moved paragraphs will usually be quite sma
ll. | 1191 // shouldn't matter though, since moved paragraphs will usually be quite sma
ll. |
1192 RefPtrWillBeRawPtr<DocumentFragment> fragment = startOfParagraphToMove != en
dOfParagraphToMove ? | 1192 RefPtr<DocumentFragment> fragment = startOfParagraphToMove != endOfParagraph
ToMove ? |
1193 createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotA
nnotateForInterchange, true, DoNotResolveURLs, constrainingAncestor), "") : null
ptr; | 1193 createFragmentFromMarkup(document(), createMarkup(range.get(), 0, DoNotA
nnotateForInterchange, true, DoNotResolveURLs, constrainingAncestor), "") : null
ptr; |
1194 | 1194 |
1195 // A non-empty paragraph's style is moved when we copy and move it. We don'
t move | 1195 // A non-empty paragraph's style is moved when we copy and move it. We don'
t move |
1196 // anything if we're given an empty paragraph, but an empty paragraph can ha
ve style | 1196 // anything if we're given an empty paragraph, but an empty paragraph can ha
ve style |
1197 // too, <div><b><br></b></div> for example. Save it so that we can preserve
it later. | 1197 // too, <div><b><br></b></div> for example. Save it so that we can preserve
it later. |
1198 RefPtr<EditingStyle> styleInEmptyParagraph; | 1198 RefPtr<EditingStyle> styleInEmptyParagraph; |
1199 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { | 1199 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { |
1200 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); | 1200 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); |
1201 styleInEmptyParagraph->mergeTypingStyle(&document()); | 1201 styleInEmptyParagraph->mergeTypingStyle(&document()); |
1202 // The moved paragraph should assume the block style of the destination. | 1202 // The moved paragraph should assume the block style of the destination. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1468 |
1469 return node.release(); | 1469 return node.release(); |
1470 } | 1470 } |
1471 | 1471 |
1472 PassRefPtrWillBeRawPtr<Element> createBlockPlaceholderElement(Document& document
) | 1472 PassRefPtrWillBeRawPtr<Element> createBlockPlaceholderElement(Document& document
) |
1473 { | 1473 { |
1474 return document.createElement(brTag, false); | 1474 return document.createElement(brTag, false); |
1475 } | 1475 } |
1476 | 1476 |
1477 } // namespace WebCore | 1477 } // namespace WebCore |
OLD | NEW |