OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // styles are redundant. | 747 // styles are redundant. |
748 // We should remove the Apple-style-span class when we're done, see <rdar://prob
lem/5685600>. | 748 // We should remove the Apple-style-span class when we're done, see <rdar://prob
lem/5685600>. |
749 // We should remove styles from spans that are overridden by all of their childr
en, either here | 749 // We should remove styles from spans that are overridden by all of their childr
en, either here |
750 // or at copy time. | 750 // or at copy time. |
751 void ReplaceSelectionCommand::handleStyleSpans(InsertedNodes& insertedNodes) | 751 void ReplaceSelectionCommand::handleStyleSpans(InsertedNodes& insertedNodes) |
752 { | 752 { |
753 HTMLElement* wrappingStyleSpan = 0; | 753 HTMLElement* wrappingStyleSpan = 0; |
754 // The style span that contains the source document's default style should b
e at | 754 // The style span that contains the source document's default style should b
e at |
755 // the top of the fragment, but Mail sometimes adds a wrapper (for Paste As
Quotation), | 755 // the top of the fragment, but Mail sometimes adds a wrapper (for Paste As
Quotation), |
756 // so search for the top level style span instead of assuming it's at the to
p. | 756 // so search for the top level style span instead of assuming it's at the to
p. |
757 for (Node* node = insertedNodes.firstNodeInserted(); node; node = NodeTraver
sal::next(*node)) { | 757 Node* pastEndNode = insertedNodes.pastLastLeaf(); |
| 758 for (Node* node = insertedNodes.firstNodeInserted(); node && node != pastEnd
Node; node = NodeTraversal::next(*node)) { |
758 if (isLegacyAppleStyleSpan(node)) { | 759 if (isLegacyAppleStyleSpan(node)) { |
759 wrappingStyleSpan = toHTMLElement(node); | 760 wrappingStyleSpan = toHTMLElement(node); |
760 break; | 761 break; |
761 } | 762 } |
762 } | 763 } |
763 | 764 |
764 // There might not be any style spans if we're pasting from another applicat
ion or if | 765 // There might not be any style spans if we're pasting from another applicat
ion or if |
765 // we are here because of a document.execCommand("InsertHTML", ...) call. | 766 // we are here because of a document.execCommand("InsertHTML", ...) call. |
766 if (!wrappingStyleSpan) | 767 if (!wrappingStyleSpan) |
767 return; | 768 return; |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1493 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1493 | 1494 |
1494 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1495 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1495 | 1496 |
1496 setEndingSelection(selectionAfterReplace); | 1497 setEndingSelection(selectionAfterReplace); |
1497 | 1498 |
1498 return true; | 1499 return true; |
1499 } | 1500 } |
1500 | 1501 |
1501 } // namespace WebCore | 1502 } // namespace WebCore |
OLD | NEW |