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, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
10 * | 10 * |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlTr
eeViewer.hasNoStyleInformation(); | 1331 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlTr
eeViewer.hasNoStyleInformation(); |
1332 if (xmlViewerMode) | 1332 if (xmlViewerMode) |
1333 xmlTreeViewer.transformDocumentToTreeView(); | 1333 xmlTreeViewer.transformDocumentToTreeView(); |
1334 | 1334 |
1335 if (m_sawXSLTransform) { | 1335 if (m_sawXSLTransform) { |
1336 void* doc = xmlDocPtrForString(document()->cachedResourceLoader(), m_ori
ginalSourceForTransform.toString(), document()->url().string()); | 1336 void* doc = xmlDocPtrForString(document()->cachedResourceLoader(), m_ori
ginalSourceForTransform.toString(), document()->url().string()); |
1337 document()->setTransformSource(adoptPtr(new TransformSource(doc))); | 1337 document()->setTransformSource(adoptPtr(new TransformSource(doc))); |
1338 | 1338 |
1339 document()->setParsing(false); // Make the document think it's done, so
it will apply XSL stylesheets. | 1339 document()->setParsing(false); // Make the document think it's done, so
it will apply XSL stylesheets. |
1340 document()->styleResolverChanged(RecalcStyleImmediately); | 1340 document()->styleResolverChanged(RecalcStyleImmediately); |
| 1341 |
| 1342 // styleResolverChanged() call can detach the parser and null out its do
cument. |
| 1343 // In that case, we just bail out. |
| 1344 if (isDetached()) |
| 1345 return; |
| 1346 |
1341 document()->setParsing(true); | 1347 document()->setParsing(true); |
1342 | |
1343 DocumentParser::stopParsing(); | 1348 DocumentParser::stopParsing(); |
1344 } | 1349 } |
1345 #endif | 1350 #endif |
1346 } | 1351 } |
1347 | 1352 |
1348 #if ENABLE(XSLT) | 1353 #if ENABLE(XSLT) |
1349 void* xmlDocPtrForString(CachedResourceLoader* cachedResourceLoader, const Strin
g& source, const String& url) | 1354 void* xmlDocPtrForString(CachedResourceLoader* cachedResourceLoader, const Strin
g& source, const String& url) |
1350 { | 1355 { |
1351 if (source.isEmpty()) | 1356 if (source.isEmpty()) |
1352 return 0; | 1357 return 0; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 sax.startElementNs = attributesStartElementNsHandler; | 1496 sax.startElementNs = attributesStartElementNsHandler; |
1492 sax.initialized = XML_SAX2_MAGIC; | 1497 sax.initialized = XML_SAX2_MAGIC; |
1493 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1498 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
1494 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1499 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1495 xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.c
haracters()), parseString.length() * sizeof(UChar), 1); | 1500 xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.c
haracters()), parseString.length() * sizeof(UChar), 1); |
1496 attrsOK = state.gotAttributes; | 1501 attrsOK = state.gotAttributes; |
1497 return state.attributes; | 1502 return state.attributes; |
1498 } | 1503 } |
1499 | 1504 |
1500 } | 1505 } |
OLD | NEW |