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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 // We should remove the Apple-style-span class when we're done, see <rdar://prob
lem/5685600>. | 775 // We should remove the Apple-style-span class when we're done, see <rdar://prob
lem/5685600>. |
776 // We should remove styles from spans that are overridden by all of their childr
en, either here | 776 // We should remove styles from spans that are overridden by all of their childr
en, either here |
777 // or at copy time. | 777 // or at copy time. |
778 void ReplaceSelectionCommand::handleStyleSpans(InsertedNodes& insertedNodes) | 778 void ReplaceSelectionCommand::handleStyleSpans(InsertedNodes& insertedNodes) |
779 { | 779 { |
780 HTMLSpanElement* wrappingStyleSpan = 0; | 780 HTMLSpanElement* wrappingStyleSpan = 0; |
781 // The style span that contains the source document's default style should b
e at | 781 // The style span that contains the source document's default style should b
e at |
782 // the top of the fragment, but Mail sometimes adds a wrapper (for Paste As
Quotation), | 782 // the top of the fragment, but Mail sometimes adds a wrapper (for Paste As
Quotation), |
783 // so search for the top level style span instead of assuming it's at the to
p. | 783 // so search for the top level style span instead of assuming it's at the to
p. |
784 | 784 |
785 for (Node& node : NodeTraversal::from(insertedNodes.firstNodeInserted())) { | 785 for (Node& node : NodeTraversal::startsAt(insertedNodes.firstNodeInserted())
) { |
786 if (isLegacyAppleHTMLSpanElement(&node)) { | 786 if (isLegacyAppleHTMLSpanElement(&node)) { |
787 wrappingStyleSpan = toHTMLSpanElement(&node); | 787 wrappingStyleSpan = toHTMLSpanElement(&node); |
788 break; | 788 break; |
789 } | 789 } |
790 } | 790 } |
791 | 791 |
792 // There might not be any style spans if we're pasting from another applicat
ion or if | 792 // There might not be any style spans if we're pasting from another applicat
ion or if |
793 // we are here because of a document.execCommand("InsertHTML", ...) call. | 793 // we are here because of a document.execCommand("InsertHTML", ...) call. |
794 if (!wrappingStyleSpan) | 794 if (!wrappingStyleSpan) |
795 return; | 795 return; |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 void ReplaceSelectionCommand::trace(Visitor* visitor) | 1543 void ReplaceSelectionCommand::trace(Visitor* visitor) |
1544 { | 1544 { |
1545 visitor->trace(m_startOfInsertedContent); | 1545 visitor->trace(m_startOfInsertedContent); |
1546 visitor->trace(m_endOfInsertedContent); | 1546 visitor->trace(m_endOfInsertedContent); |
1547 visitor->trace(m_insertionStyle); | 1547 visitor->trace(m_insertionStyle); |
1548 visitor->trace(m_documentFragment); | 1548 visitor->trace(m_documentFragment); |
1549 CompositeEditCommand::trace(visitor); | 1549 CompositeEditCommand::trace(visitor); |
1550 } | 1550 } |
1551 | 1551 |
1552 } // namespace blink | 1552 } // namespace blink |
OLD | NEW |