OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // FIXME: It's not clear what this code is trying to do. It puts nodes as di
rect children of a | 706 // FIXME: It's not clear what this code is trying to do. It puts nodes as di
rect children of a |
707 // Document that are not normally allowed by using the parser machinery. | 707 // Document that are not normally allowed by using the parser machinery. |
708 taggedDocument->parserTakeAllChildrenFrom(*taggedFragment); | 708 taggedDocument->parserTakeAllChildrenFrom(*taggedFragment); |
709 | 709 |
710 RefPtr<Node> nodeBeforeContext; | 710 RefPtr<Node> nodeBeforeContext; |
711 RefPtr<Node> nodeAfterContext; | 711 RefPtr<Node> nodeAfterContext; |
712 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no
deAfterContext)) | 712 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no
deAfterContext)) |
713 return nullptr; | 713 return nullptr; |
714 | 714 |
715 RefPtr<Range> range = Range::create(*taggedDocument.get(), | 715 RefPtr<Range> range = Range::create(*taggedDocument.get(), |
716 positionAfterNode(*nodeBeforeContext).parentAnchoredEquivalent(), | 716 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), |
717 positionBeforeNode(*nodeAfterContext).parentAnchoredEquivalent()); | 717 positionBeforeNode(nodeAfterContext.get()).parentAnchoredEquivalent()); |
718 | 718 |
719 Node* commonAncestor = range->commonAncestorContainer(ASSERT_NO_EXCEPTION); | 719 Node* commonAncestor = range->commonAncestorContainer(ASSERT_NO_EXCEPTION); |
720 Node* specialCommonAncestor = ancestorToRetainStructureAndAppearanceWithNoRe
nderer(commonAncestor); | 720 Node* specialCommonAncestor = ancestorToRetainStructureAndAppearanceWithNoRe
nderer(commonAncestor); |
721 | 721 |
722 // When there's a special common ancestor outside of the fragment, we must i
nclude it as well to | 722 // When there's a special common ancestor outside of the fragment, we must i
nclude it as well to |
723 // preserve the structure and appearance of the fragment. For example, if th
e fragment contains | 723 // preserve the structure and appearance of the fragment. For example, if th
e fragment contains |
724 // TD, we need to include the enclosing TABLE tag as well. | 724 // TD, we need to include the enclosing TABLE tag as well. |
725 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); | 725 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); |
726 if (specialCommonAncestor) | 726 if (specialCommonAncestor) |
727 fragment->appendChild(specialCommonAncestor); | 727 fragment->appendChild(specialCommonAncestor); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 return; | 1048 return; |
1049 | 1049 |
1050 RefPtr<Text> textNode = toText(node.get()); | 1050 RefPtr<Text> textNode = toText(node.get()); |
1051 RefPtr<Text> textNext = toText(next); | 1051 RefPtr<Text> textNext = toText(next); |
1052 textNode->appendData(textNext->data()); | 1052 textNode->appendData(textNext->data()); |
1053 if (textNext->parentNode()) // Might have been removed by mutation event. | 1053 if (textNext->parentNode()) // Might have been removed by mutation event. |
1054 textNext->remove(exceptionState); | 1054 textNext->remove(exceptionState); |
1055 } | 1055 } |
1056 | 1056 |
1057 } | 1057 } |
OLD | NEW |