OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
5 * Copyright (C) 2011 Igalia S.L. | 5 * Copyright (C) 2011 Igalia S.L. |
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 nodeAfterContext)) | 401 nodeAfterContext)) |
402 return nullptr; | 402 return nullptr; |
403 | 403 |
404 Document* taggedDocument = Document::create(); | 404 Document* taggedDocument = Document::create(); |
405 taggedDocument->setContextFeatures(document.contextFeatures()); | 405 taggedDocument->setContextFeatures(document.contextFeatures()); |
406 | 406 |
407 Element* root = Element::create(QualifiedName::null(), taggedDocument); | 407 Element* root = Element::create(QualifiedName::null(), taggedDocument); |
408 root->appendChild(taggedFragment); | 408 root->appendChild(taggedFragment); |
409 taggedDocument->appendChild(root); | 409 taggedDocument->appendChild(root); |
410 | 410 |
411 Range* range = Range::create( | 411 EphemeralRange range = EphemeralRange( |
Xiaocheng
2017/03/02 20:00:16
nit: Initialize range as either
const EphemeralRa
| |
412 *taggedDocument, | |
413 Position::afterNode(nodeBeforeContext).parentAnchoredEquivalent(), | 412 Position::afterNode(nodeBeforeContext).parentAnchoredEquivalent(), |
414 Position::beforeNode(nodeAfterContext).parentAnchoredEquivalent()); | 413 Position::beforeNode(nodeAfterContext).parentAnchoredEquivalent()); |
415 | 414 |
416 Node* commonAncestor = range->commonAncestorContainer(); | 415 Node* commonAncestor = range.commonAncestorContainer(); |
417 HTMLElement* specialCommonAncestor = | 416 HTMLElement* specialCommonAncestor = |
418 ancestorToRetainStructureAndAppearanceWithNoLayoutObject(commonAncestor); | 417 ancestorToRetainStructureAndAppearanceWithNoLayoutObject(commonAncestor); |
419 | 418 |
420 // When there's a special common ancestor outside of the fragment, we must | 419 // When there's a special common ancestor outside of the fragment, we must |
421 // include it as well to preserve the structure and appearance of the | 420 // include it as well to preserve the structure and appearance of the |
422 // fragment. For example, if the fragment contains TD, we need to include the | 421 // fragment. For example, if the fragment contains TD, we need to include the |
423 // enclosing TABLE tag as well. | 422 // enclosing TABLE tag as well. |
424 DocumentFragment* fragment = DocumentFragment::create(document); | 423 DocumentFragment* fragment = DocumentFragment::create(document); |
425 if (specialCommonAncestor) | 424 if (specialCommonAncestor) |
426 fragment->appendChild(specialCommonAncestor); | 425 fragment->appendChild(specialCommonAncestor); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 textNode->appendData(textNext->data()); | 754 textNode->appendData(textNext->data()); |
756 if (textNext->parentNode()) // Might have been removed by mutation event. | 755 if (textNext->parentNode()) // Might have been removed by mutation event. |
757 textNext->remove(exceptionState); | 756 textNext->remove(exceptionState); |
758 } | 757 } |
759 | 758 |
760 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; | 759 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; |
761 template class CORE_TEMPLATE_EXPORT | 760 template class CORE_TEMPLATE_EXPORT |
762 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>; | 761 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>; |
763 | 762 |
764 } // namespace blink | 763 } // namespace blink |
OLD | NEW |