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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // FIXME: Need to handle the case where the markup already contains these ma
rkers. | 700 // FIXME: Need to handle the case where the markup already contains these ma
rkers. |
701 | 701 |
702 StringBuilder taggedMarkup; | 702 StringBuilder taggedMarkup; |
703 taggedMarkup.append(markup.left(fragmentStart)); | 703 taggedMarkup.append(markup.left(fragmentStart)); |
704 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); | 704 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); |
705 taggedMarkup.append(markup.substring(fragmentStart, fragmentEnd - fragmentSt
art)); | 705 taggedMarkup.append(markup.substring(fragmentStart, fragmentEnd - fragmentSt
art)); |
706 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); | 706 MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); |
707 taggedMarkup.append(markup.substring(fragmentEnd)); | 707 taggedMarkup.append(markup.substring(fragmentEnd)); |
708 | 708 |
709 RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document,
taggedMarkup.toString(), baseURL, parserContentPolicy); | 709 RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document,
taggedMarkup.toString(), baseURL, parserContentPolicy); |
710 RefPtr<Document> taggedDocument = Document::create(0, KURL()); | 710 RefPtr<Document> taggedDocument = Document::create(); |
711 taggedDocument->setContextFeatures(document->contextFeatures()); | 711 taggedDocument->setContextFeatures(document->contextFeatures()); |
712 taggedDocument->takeAllChildrenFrom(taggedFragment.get()); | 712 taggedDocument->takeAllChildrenFrom(taggedFragment.get()); |
713 | 713 |
714 RefPtr<Node> nodeBeforeContext; | 714 RefPtr<Node> nodeBeforeContext; |
715 RefPtr<Node> nodeAfterContext; | 715 RefPtr<Node> nodeAfterContext; |
716 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no
deAfterContext)) | 716 if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, no
deAfterContext)) |
717 return 0; | 717 return 0; |
718 | 718 |
719 RefPtr<Range> range = Range::create(taggedDocument.get(), | 719 RefPtr<Range> range = Range::create(taggedDocument.get(), |
720 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), | 720 positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 if (hasOneChild(containerNode.get())) { | 1083 if (hasOneChild(containerNode.get())) { |
1084 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), ec); | 1084 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), ec); |
1085 return; | 1085 return; |
1086 } | 1086 } |
1087 | 1087 |
1088 containerNode->removeChildren(); | 1088 containerNode->removeChildren(); |
1089 containerNode->appendChild(textNode.release(), ec); | 1089 containerNode->appendChild(textNode.release(), ec); |
1090 } | 1090 } |
1091 | 1091 |
1092 } | 1092 } |
OLD | NEW |