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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 Document* document = contextElement->hasTagName(templateTag) ? contextElemen
t->document()->ensureTemplateDocument() : contextElement->document(); | 948 Document* document = contextElement->hasTagName(templateTag) ? contextElemen
t->document()->ensureTemplateDocument() : contextElement->document(); |
949 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); | 949 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); |
950 | 950 |
951 if (document->isHTMLDocument()) { | 951 if (document->isHTMLDocument()) { |
952 fragment->parseHTML(markup, contextElement, parserContentPolicy); | 952 fragment->parseHTML(markup, contextElement, parserContentPolicy); |
953 return fragment; | 953 return fragment; |
954 } | 954 } |
955 | 955 |
956 bool wasValid = fragment->parseXML(markup, contextElement, parserContentPoli
cy); | 956 bool wasValid = fragment->parseXML(markup, contextElement, parserContentPoli
cy); |
957 if (!wasValid) { | 957 if (!wasValid) { |
958 ec = SYNTAX_ERR; | 958 ec = SyntaxError; |
959 return 0; | 959 return 0; |
960 } | 960 } |
961 return fragment.release(); | 961 return fragment.release(); |
962 } | 962 } |
963 | 963 |
964 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&
sourceString, const String& sourceMIMEType, Document* outputDoc) | 964 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&
sourceString, const String& sourceMIMEType, Document* outputDoc) |
965 { | 965 { |
966 RefPtr<DocumentFragment> fragment = outputDoc->createDocumentFragment(); | 966 RefPtr<DocumentFragment> fragment = outputDoc->createDocumentFragment(); |
967 | 967 |
968 if (sourceMIMEType == "text/html") { | 968 if (sourceMIMEType == "text/html") { |
(...skipping 114 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 |