| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 if (isStopping()) { | 891 if (isStopping()) { |
| 892 attemptToRunDeferredScriptsAndEnd(); | 892 attemptToRunDeferredScriptsAndEnd(); |
| 893 return; | 893 return; |
| 894 } | 894 } |
| 895 | 895 |
| 896 m_scriptRunner->executeScriptsWaitingForLoad(cachedResource); | 896 m_scriptRunner->executeScriptsWaitingForLoad(cachedResource); |
| 897 if (!isWaitingForScripts()) | 897 if (!isWaitingForScripts()) |
| 898 resumeParsingAfterScriptExecution(); | 898 resumeParsingAfterScriptExecution(); |
| 899 } | 899 } |
| 900 | 900 |
| 901 void HTMLDocumentParser::executeScriptsWaitingForStylesheets() | 901 void HTMLDocumentParser::executeScriptsWaitingForResources() |
| 902 { | 902 { |
| 903 // Document only calls this when the Document owns the DocumentParser | 903 // Document only calls this when the Document owns the DocumentParser |
| 904 // so this will not be called in the DocumentFragment case. | 904 // so this will not be called in the DocumentFragment case. |
| 905 ASSERT(m_scriptRunner); | 905 ASSERT(m_scriptRunner); |
| 906 // Ignore calls unless we have a script blocking the parser waiting on a | 906 // Ignore calls unless we have a script blocking the parser waiting on a |
| 907 // stylesheet load. Otherwise we are currently parsing and this | 907 // stylesheet load. Otherwise we are currently parsing and this |
| 908 // is a re-entrant call from encountering a </ style> tag. | 908 // is a re-entrant call from encountering a </ style> tag. |
| 909 if (!m_scriptRunner->hasScriptsWaitingForStylesheets()) | 909 if (!m_scriptRunner->hasScriptsWaitingForResources()) |
| 910 return; | 910 return; |
| 911 | 911 |
| 912 // pumpTokenizer can cause this parser to be detached from the Document, | 912 // pumpTokenizer can cause this parser to be detached from the Document, |
| 913 // but we need to ensure it isn't deleted yet. | 913 // but we need to ensure it isn't deleted yet. |
| 914 RefPtr<HTMLDocumentParser> protect(this); | 914 RefPtr<HTMLDocumentParser> protect(this); |
| 915 m_scriptRunner->executeScriptsWaitingForStylesheets(); | 915 m_scriptRunner->executeScriptsWaitingForResources(); |
| 916 if (!isWaitingForScripts()) | 916 if (!isWaitingForScripts()) |
| 917 resumeParsingAfterScriptExecution(); | 917 resumeParsingAfterScriptExecution(); |
| 918 } | 918 } |
| 919 | 919 |
| 920 void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFra
gment* fragment, Element* contextElement, ParserContentPolicy parserContentPolic
y) | 920 void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFra
gment* fragment, Element* contextElement, ParserContentPolicy parserContentPolic
y) |
| 921 { | 921 { |
| 922 RefPtr<HTMLDocumentParser> parser = HTMLDocumentParser::create(fragment, con
textElement, parserContentPolicy); | 922 RefPtr<HTMLDocumentParser> parser = HTMLDocumentParser::create(fragment, con
textElement, parserContentPolicy); |
| 923 parser->insert(source); // Use insert() so that the parser will not yield. | 923 parser->insert(source); // Use insert() so that the parser will not yield. |
| 924 parser->finish(); | 924 parser->finish(); |
| 925 ASSERT(!parser->processingData()); // Make sure we're done. <rdar://problem/
3963151> | 925 ASSERT(!parser->processingData()); // Make sure we're done. <rdar://problem/
3963151> |
| 926 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. | 926 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. |
| 927 } | 927 } |
| 928 | 928 |
| 929 void HTMLDocumentParser::suspendScheduledTasks() | 929 void HTMLDocumentParser::suspendScheduledTasks() |
| 930 { | 930 { |
| 931 if (m_parserScheduler) | 931 if (m_parserScheduler) |
| 932 m_parserScheduler->suspend(); | 932 m_parserScheduler->suspend(); |
| 933 } | 933 } |
| 934 | 934 |
| 935 void HTMLDocumentParser::resumeScheduledTasks() | 935 void HTMLDocumentParser::resumeScheduledTasks() |
| 936 { | 936 { |
| 937 if (m_parserScheduler) | 937 if (m_parserScheduler) |
| 938 m_parserScheduler->resume(); | 938 m_parserScheduler->resume(); |
| 939 } | 939 } |
| 940 | 940 |
| 941 } | 941 } |
| OLD | NEW |