Commit 884a874e authored by hyatt's avatar hyatt

Make the view source document properly handle <script>. We don't syntax

        highlight the JS yet, but it shows up properly now.

        Reviewed by john

        * WebCore.xcodeproj/project.pbxproj:
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::scriptHandler):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d420935a
2006-06-28 David Hyatt <hyatt@apple.com>
Make the view source document properly handle <script>. We don't syntax
highlight the JS yet, but it shows up properly now.
Reviewed by john
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::scriptHandler):
2006-06-28 Timothy Hatcher <timothy@apple.com> 2006-06-28 Timothy Hatcher <timothy@apple.com>
Prefer the Stabs debugging symbols format until DWARF bugs are fixed. Prefer the Stabs debugging symbols format until DWARF bugs are fixed.
......
...@@ -1569,6 +1569,23 @@ ...@@ -1569,6 +1569,23 @@
FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; }; FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
BCEED0480A530A0A00443D9A /* Development */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = NO;
};
name = Development;
};
BCEED0490A530A0A00443D9A /* Deployment */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = YES;
};
name = Deployment;
};
/* End PBXBuildStyle section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = { DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
...@@ -6371,6 +6388,12 @@ ...@@ -6371,6 +6388,12 @@
0867D690FE84028FC02AAC07 /* Project object */ = { 0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */; buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
buildSettings = {
};
buildStyles = (
BCEED0480A530A0A00443D9A /* Development */,
BCEED0490A530A0A00443D9A /* Deployment */,
);
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
knownRegions = ( knownRegions = (
English, English,
......
...@@ -355,31 +355,34 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) ...@@ -355,31 +355,34 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state)
CachedScript* cs = 0; CachedScript* cs = 0;
// don't load external scripts for standalone documents (for now) // don't load external scripts for standalone documents (for now)
if (!scriptSrc.isEmpty() && m_doc->frame()) { if (!inViewSourceMode()) {
// forget what we just got; load from src url instead if (!scriptSrc.isEmpty() && m_doc->frame()) {
if (!parser->skipMode() && !followingFrameset) { // forget what we just got; load from src url instead
#if INSTRUMENT_LAYOUT_SCHEDULING if (!parser->skipMode() && !followingFrameset) {
if (!m_doc->ownerElement()) #if INSTRUMENT_LAYOUT_SCHEDULING
printf("Requesting script at time %d\n", m_doc->elapsedTime()); if (!m_doc->ownerElement())
#endif printf("Requesting script at time %d\n", m_doc->elapsedTime());
if ( (cs = m_doc->docLoader()->requestScript(scriptSrc, scriptSrcCharset) )) #endif
pendingScripts.enqueue(cs); if ( (cs = m_doc->docLoader()->requestScript(scriptSrc, scriptSrcCharset) ))
else pendingScripts.enqueue(cs);
else
scriptNode = 0;
} else
scriptNode = 0; scriptNode = 0;
} else scriptSrc=DeprecatedString::null;
}
else {
#ifdef TOKEN_DEBUG
kdDebug( 6036 ) << "---START SCRIPT---" << endl;
kdDebug( 6036 ) << DeprecatedString(scriptCode, scriptCodeSize) << endl;
kdDebug( 6036 ) << "---END SCRIPT---" << endl;
#endif
scriptNode = 0; scriptNode = 0;
scriptSrc=DeprecatedString::null; // Parse scriptCode containing <script> info
} doScriptExec = true;
else { }
#ifdef TOKEN_DEBUG
kdDebug( 6036 ) << "---START SCRIPT---" << endl;
kdDebug( 6036 ) << DeprecatedString(scriptCode, scriptCodeSize) << endl;
kdDebug( 6036 ) << "---END SCRIPT---" << endl;
#endif
scriptNode = 0;
// Parse scriptCode containing <script> info
doScriptExec = true;
} }
state = processListing(SegmentedString(scriptCode, scriptCodeSize), state); state = processListing(SegmentedString(scriptCode, scriptCodeSize), state);
DeprecatedString exScript(reinterpret_cast<QChar*>(buffer), dest - buffer); DeprecatedString exScript(reinterpret_cast<QChar*>(buffer), dest - buffer);
processToken(); processToken();
...@@ -387,10 +390,15 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) ...@@ -387,10 +390,15 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state)
currToken.beginTag = false; currToken.beginTag = false;
processToken(); processToken();
state.setInScript(false);
// FIXME: The script should be syntax highlighted.
if (inViewSourceMode())
return state;
SegmentedString *savedPrependingSrc = currentPrependingSrc; SegmentedString *savedPrependingSrc = currentPrependingSrc;
SegmentedString prependingSrc; SegmentedString prependingSrc;
currentPrependingSrc = &prependingSrc; currentPrependingSrc = &prependingSrc;
state.setInScript(false);
scriptCodeSize = scriptCodeResync = 0; scriptCodeSize = scriptCodeResync = 0;
if (!parser->skipMode() && !followingFrameset) { if (!parser->skipMode() && !followingFrameset) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment