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 | 706 |
707 // FIXME: It's not clear what this code is trying to do. It puts nodes as di
rect children of a | 707 // FIXME: It's not clear what this code is trying to do. It puts nodes as di
rect children of a |
708 // Document that are not normally allowed by using the parser machinery. | 708 // Document that are not normally allowed by using the parser machinery. |
709 taggedDocument->parserTakeAllChildrenFrom(*taggedFragment); | 709 taggedDocument->parserTakeAllChildrenFrom(*taggedFragment); |
710 | 710 |
711 RefPtr<Node> nodeBeforeContext; | 711 RefPtr<Node> nodeBeforeContext; |
712 RefPtr<Node> nodeAfterContext; | 712 RefPtr<Node> nodeAfterContext; |
713 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no
deAfterContext)) | 713 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no
deAfterContext)) |
714 return nullptr; | 714 return nullptr; |
715 | 715 |
716 RefPtr<Range> range = Range::create(*taggedDocument.get(), | 716 RefPtrWillBeRawPtr<Range> range = Range::create(*taggedDocument.get(), |
717 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), | 717 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), |
718 positionBeforeNode(nodeAfterContext.get()).parentAnchoredEquivalent()); | 718 positionBeforeNode(nodeAfterContext.get()).parentAnchoredEquivalent()); |
719 | 719 |
720 Node* commonAncestor = range->commonAncestorContainer(ASSERT_NO_EXCEPTION); | 720 Node* commonAncestor = range->commonAncestorContainer(ASSERT_NO_EXCEPTION); |
721 Node* specialCommonAncestor = ancestorToRetainStructureAndAppearanceWithNoRe
nderer(commonAncestor); | 721 Node* specialCommonAncestor = ancestorToRetainStructureAndAppearanceWithNoRe
nderer(commonAncestor); |
722 | 722 |
723 // When there's a special common ancestor outside of the fragment, we must i
nclude it as well to | 723 // When there's a special common ancestor outside of the fragment, we must i
nclude it as well to |
724 // preserve the structure and appearance of the fragment. For example, if th
e fragment contains | 724 // preserve the structure and appearance of the fragment. For example, if th
e fragment contains |
725 // TD, we need to include the enclosing TABLE tag as well. | 725 // TD, we need to include the enclosing TABLE tag as well. |
726 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); | 726 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 return; | 1065 return; |
1066 | 1066 |
1067 RefPtr<Text> textNode = toText(node.get()); | 1067 RefPtr<Text> textNode = toText(node.get()); |
1068 RefPtr<Text> textNext = toText(next); | 1068 RefPtr<Text> textNext = toText(next); |
1069 textNode->appendData(textNext->data()); | 1069 textNode->appendData(textNext->data()); |
1070 if (textNext->parentNode()) // Might have been removed by mutation event. | 1070 if (textNext->parentNode()) // Might have been removed by mutation event. |
1071 textNext->remove(exceptionState); | 1071 textNext->remove(exceptionState); |
1072 } | 1072 } |
1073 | 1073 |
1074 } | 1074 } |
OLD | NEW |