OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 if (m_parsingFragment) | 287 if (m_parsingFragment) |
288 return; | 288 return; |
289 #endif | 289 #endif |
290 // One or more errors occurred during parsing of the code. Display an error
block to the user above | 290 // One or more errors occurred during parsing of the code. Display an error
block to the user above |
291 // the normal content (the DOM tree is created manually and includes line/co
l info regarding | 291 // the normal content (the DOM tree is created manually and includes line/co
l info regarding |
292 // where the errors are located) | 292 // where the errors are located) |
293 | 293 |
294 // Create elements for display | 294 // Create elements for display |
295 ExceptionCode ec = 0; | 295 ExceptionCode ec = 0; |
296 Document* document = this->document(); | 296 Document* document = this->document(); |
297 Element* documentElement = document->documentElement(); | 297 RefPtr<Element> documentElement = document->documentElement(); |
298 if (!documentElement) { | 298 if (!documentElement) { |
299 RefPtr<Element> rootElement = document->createElement(htmlTag, false); | 299 RefPtr<Element> rootElement = document->createElement(htmlTag, false); |
300 document->appendChild(rootElement, ec); | 300 document->appendChild(rootElement, ec); |
301 RefPtr<Element> body = document->createElement(bodyTag, false); | 301 RefPtr<Element> body = document->createElement(bodyTag, false); |
302 rootElement->appendChild(body, ec); | 302 rootElement->appendChild(body, ec); |
303 documentElement = body.get(); | 303 documentElement = body.get(); |
304 } | 304 } |
305 #if ENABLE(SVG) | 305 #if ENABLE(SVG) |
306 else if (documentElement->namespaceURI() == SVGNames::svgNamespaceURI) { | 306 else if (documentElement->namespaceURI() == SVGNames::svgNamespaceURI) { |
307 RefPtr<Element> rootElement = document->createElement(htmlTag, false); | 307 RefPtr<Element> rootElement = document->createElement(htmlTag, false); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 397 |
398 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte
xtElement, scriptingPermission); | 398 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte
xtElement, scriptingPermission); |
399 bool wellFormed = parser->appendFragmentSource(chunk); | 399 bool wellFormed = parser->appendFragmentSource(chunk); |
400 // Do not call finish(). Current finish() and doEnd() implementations touch
the main Document/loader | 400 // Do not call finish(). Current finish() and doEnd() implementations touch
the main Document/loader |
401 // and can cause crashes in the fragment case. | 401 // and can cause crashes in the fragment case. |
402 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. | 402 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. |
403 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive
than wellFormed(). | 403 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive
than wellFormed(). |
404 } | 404 } |
405 | 405 |
406 } // namespace WebCore | 406 } // namespace WebCore |
OLD | NEW |