OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionStat
e& exceptionState) | 115 Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionStat
e& exceptionState) |
116 { | 116 { |
117 // Don't parse <html> as a fragment. | 117 // Don't parse <html> as a fragment. |
118 if (node->isDocumentNode() || (node->parentNode() && node->parentNode()->isD
ocumentNode())) { | 118 if (node->isDocumentNode() || (node->parentNode() && node->parentNode()->isD
ocumentNode())) { |
119 patchDocument(markup); | 119 patchDocument(markup); |
120 return 0; | 120 return 0; |
121 } | 121 } |
122 | 122 |
123 Node* previousSibling = node->previousSibling(); | 123 Node* previousSibling = node->previousSibling(); |
124 RefPtr<DocumentFragment> fragment = DocumentFragment::create(m_document); | 124 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(m_d
ocument); |
125 Node* targetNode = node->parentElementOrShadowRoot() ? node->parentElementOr
ShadowRoot() : m_document.documentElement(); | 125 Node* targetNode = node->parentElementOrShadowRoot() ? node->parentElementOr
ShadowRoot() : m_document.documentElement(); |
126 | 126 |
127 // Use the document BODY as the context element when editing immediate shado
w root children, | 127 // Use the document BODY as the context element when editing immediate shado
w root children, |
128 // as it provides an equivalent parsing context. | 128 // as it provides an equivalent parsing context. |
129 if (targetNode->isShadowRoot()) | 129 if (targetNode->isShadowRoot()) |
130 targetNode = m_document.body(); | 130 targetNode = m_document.body(); |
131 Element* targetElement = toElement(targetNode); | 131 Element* targetElement = toElement(targetNode); |
132 | 132 |
133 // FIXME: This code should use one of createFragment* in markup.h | 133 // FIXME: This code should use one of createFragment* in markup.h |
134 if (m_document.isHTMLDocument()) | 134 if (m_document.isHTMLDocument()) |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) | 511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) |
512 { | 512 { |
513 fprintf(stderr, "\n\n"); | 513 fprintf(stderr, "\n\n"); |
514 for (size_t i = 0; i < map.size(); ++i) | 514 for (size_t i = 0; i < map.size(); ++i) |
515 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map
[i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map
[i].second); | 515 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map
[i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map
[i].second); |
516 } | 516 } |
517 #endif | 517 #endif |
518 | 518 |
519 } // namespace WebCore | 519 } // namespace WebCore |
520 | 520 |
OLD | NEW |