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

Side by Side Diff: Source/core/editing/markup.cpp

Issue 18808004: Refactoring: Extract DocumentInit for capture Document construction parameter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated to ToT Created 7 years, 5 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 | Annotate | Revision Log
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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // FIXME: Need to handle the case where the markup already contains these ma rkers. 701 // FIXME: Need to handle the case where the markup already contains these ma rkers.
702 702
703 StringBuilder taggedMarkup; 703 StringBuilder taggedMarkup;
704 taggedMarkup.append(markup.left(fragmentStart)); 704 taggedMarkup.append(markup.left(fragmentStart));
705 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); 705 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag);
706 taggedMarkup.append(markup.substring(fragmentStart, fragmentEnd - fragmentSt art)); 706 taggedMarkup.append(markup.substring(fragmentStart, fragmentEnd - fragmentSt art));
707 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); 707 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag);
708 taggedMarkup.append(markup.substring(fragmentEnd)); 708 taggedMarkup.append(markup.substring(fragmentEnd));
709 709
710 RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy); 710 RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy);
711 RefPtr<Document> taggedDocument = Document::create(0, KURL()); 711 RefPtr<Document> taggedDocument = Document::create();
712 taggedDocument->setContextFeatures(document->contextFeatures()); 712 taggedDocument->setContextFeatures(document->contextFeatures());
713 taggedDocument->takeAllChildrenFrom(taggedFragment.get()); 713 taggedDocument->takeAllChildrenFrom(taggedFragment.get());
714 714
715 RefPtr<Node> nodeBeforeContext; 715 RefPtr<Node> nodeBeforeContext;
716 RefPtr<Node> nodeAfterContext; 716 RefPtr<Node> nodeAfterContext;
717 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no deAfterContext)) 717 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no deAfterContext))
718 return 0; 718 return 0;
719 719
720 RefPtr<Range> range = Range::create(taggedDocument.get(), 720 RefPtr<Range> range = Range::create(taggedDocument.get(),
721 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), 721 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(),
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 if (hasOneChild(containerNode.get())) { 1084 if (hasOneChild(containerNode.get())) {
1085 containerNode->replaceChild(textNode.release(), containerNode->firstChil d(), ec); 1085 containerNode->replaceChild(textNode.release(), containerNode->firstChil d(), ec);
1086 return; 1086 return;
1087 } 1087 }
1088 1088
1089 containerNode->removeChildren(); 1089 containerNode->removeChildren();
1090 containerNode->appendChild(textNode.release(), ec); 1090 containerNode->appendChild(textNode.release(), ec);
1091 } 1091 }
1092 1092
1093 } 1093 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698