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

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

Issue 1860293003: Serialize original node when dragging a link instead of synthesizing HTML. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete delete Created 4 years, 8 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 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 element = block->cloneElementWithoutChildren(); 506 element = block->cloneElementWithoutChildren();
507 else 507 else
508 element = createDefaultParagraphElement(document); 508 element = createDefaultParagraphElement(document);
509 fillContainerFromString(element.get(), s); 509 fillContainerFromString(element.get(), s);
510 } 510 }
511 fragment->appendChild(element.release()); 511 fragment->appendChild(element.release());
512 } 512 }
513 return fragment.release(); 513 return fragment.release();
514 } 514 }
515 515
516 String urlToMarkup(const KURL& url, const String& title)
517 {
518 StringBuilder markup;
519 markup.appendLiteral("<a href=\"");
520 markup.append(url.getString());
521 markup.appendLiteral("\">");
522 MarkupFormatter::appendCharactersReplacingEntities(markup, title, 0, title.l ength(), EntityMaskInPCDATA);
523 markup.appendLiteral("</a>");
524 return markup.toString();
525 }
526
527 RawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, E lement* contextElement, ParserContentPolicy parserContentPolicy, const char* met hod, ExceptionState& exceptionState) 516 RawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, E lement* contextElement, ParserContentPolicy parserContentPolicy, const char* met hod, ExceptionState& exceptionState)
528 { 517 {
529 ASSERT(contextElement); 518 ASSERT(contextElement);
530 Document& document = isHTMLTemplateElement(*contextElement) ? contextElement ->document().ensureTemplateDocument() : contextElement->document(); 519 Document& document = isHTMLTemplateElement(*contextElement) ? contextElement ->document().ensureTemplateDocument() : contextElement->document();
531 RawPtr<DocumentFragment> fragment = DocumentFragment::create(document); 520 RawPtr<DocumentFragment> fragment = DocumentFragment::create(document);
532 521
533 if (document.isHTMLDocument()) { 522 if (document.isHTMLDocument()) {
534 fragment->parseHTML(markup, contextElement, parserContentPolicy); 523 fragment->parseHTML(markup, contextElement, parserContentPolicy);
535 return fragment; 524 return fragment;
536 } 525 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 RawPtr<Text> textNext = toText(next); 683 RawPtr<Text> textNext = toText(next);
695 textNode->appendData(textNext->data()); 684 textNode->appendData(textNext->data());
696 if (textNext->parentNode()) // Might have been removed by mutation event. 685 if (textNext->parentNode()) // Might have been removed by mutation event.
697 textNext->remove(exceptionState); 686 textNext->remove(exceptionState);
698 } 687 }
699 688
700 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; 689 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>;
701 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingInFlatTreeStrat egy>; 690 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingInFlatTreeStrat egy>;
702 691
703 } // namespace blink 692 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698