Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: third_party/WebKit/Source/core/editing/serializers/Serialization.cpp

Issue 2725603002: createFragmentFromMarkupWithContext() should use EphemeralRange. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(Position::afterNode(nodeBeforeContext).p arentAnchoredEquivalent(),
412 *taggedDocument,
413 Position::afterNode(nodeBeforeContext).parentAnchoredEquivalent(),
414 Position::beforeNode(nodeAfterContext).parentAnchoredEquivalent()); 412 Position::beforeNode(nodeAfterContext).parentAnchoredEquivalent());
415 413
416 Node* commonAncestor = range->commonAncestorContainer(); 414 Node* commonAncestor = range.commonAncestorContainer();
417 HTMLElement* specialCommonAncestor = 415 HTMLElement* specialCommonAncestor =
418 ancestorToRetainStructureAndAppearanceWithNoLayoutObject(commonAncestor); 416 ancestorToRetainStructureAndAppearanceWithNoLayoutObject(commonAncestor);
419 417
420 // When there's a special common ancestor outside of the fragment, we must 418 // 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 419 // 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 420 // fragment. For example, if the fragment contains TD, we need to include the
423 // enclosing TABLE tag as well. 421 // enclosing TABLE tag as well.
424 DocumentFragment* fragment = DocumentFragment::create(document); 422 DocumentFragment* fragment = DocumentFragment::create(document);
425 if (specialCommonAncestor) 423 if (specialCommonAncestor)
426 fragment->appendChild(specialCommonAncestor); 424 fragment->appendChild(specialCommonAncestor);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 textNode->appendData(textNext->data()); 753 textNode->appendData(textNext->data());
756 if (textNext->parentNode()) // Might have been removed by mutation event. 754 if (textNext->parentNode()) // Might have been removed by mutation event.
757 textNext->remove(exceptionState); 755 textNext->remove(exceptionState);
758 } 756 }
759 757
760 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; 758 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>;
761 template class CORE_TEMPLATE_EXPORT 759 template class CORE_TEMPLATE_EXPORT
762 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>; 760 CreateMarkupAlgorithm<EditingInFlatTreeStrategy>;
763 761
764 } // namespace blink 762 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698