summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/inspector')
-rw-r--r--WebCore/inspector/InjectedScript.cpp96
-rw-r--r--WebCore/inspector/InjectedScript.h64
-rw-r--r--WebCore/inspector/InjectedScriptHost.cpp20
-rw-r--r--WebCore/inspector/InjectedScriptHost.h11
-rw-r--r--WebCore/inspector/InspectorBackend.cpp20
-rw-r--r--WebCore/inspector/InspectorBackend.h2
-rw-r--r--WebCore/inspector/InspectorController.cpp159
-rw-r--r--WebCore/inspector/InspectorController.h35
-rw-r--r--WebCore/inspector/InspectorFrontend.cpp15
-rw-r--r--WebCore/inspector/InspectorFrontend.h4
-rw-r--r--WebCore/inspector/JavaScriptCallFrame.cpp2
-rw-r--r--WebCore/inspector/JavaScriptCallFrame.h2
-rw-r--r--WebCore/inspector/JavaScriptDebugListener.h2
-rw-r--r--WebCore/inspector/JavaScriptDebugServer.cpp2
-rw-r--r--WebCore/inspector/JavaScriptDebugServer.h2
-rw-r--r--WebCore/inspector/JavaScriptProfile.cpp2
-rw-r--r--WebCore/inspector/JavaScriptProfile.h2
-rw-r--r--WebCore/inspector/JavaScriptProfileNode.cpp2
-rw-r--r--WebCore/inspector/JavaScriptProfileNode.h2
-rw-r--r--WebCore/inspector/front-end/ElementsTreeOutline.js19
-rw-r--r--WebCore/inspector/front-end/InjectedScript.js2
-rw-r--r--WebCore/inspector/front-end/InspectorBackendStub.js11
-rw-r--r--WebCore/inspector/front-end/InspectorFrontendHostStub.js4
-rw-r--r--WebCore/inspector/front-end/NativeTextViewer.js99
-rw-r--r--WebCore/inspector/front-end/ResourceView.js2
-rw-r--r--WebCore/inspector/front-end/ResourcesPanel.js7
-rw-r--r--WebCore/inspector/front-end/Settings.js2
-rw-r--r--WebCore/inspector/front-end/SourceFrame.js6
-rw-r--r--WebCore/inspector/front-end/SourceHTMLTokenizer.js648
-rw-r--r--WebCore/inspector/front-end/SourceHTMLTokenizer.re2js174
-rw-r--r--WebCore/inspector/front-end/SourceView.js10
-rw-r--r--WebCore/inspector/front-end/TextEditor.js118
-rw-r--r--WebCore/inspector/front-end/TextEditorHighlighter.js6
-rw-r--r--WebCore/inspector/front-end/inspector.css58
-rw-r--r--WebCore/inspector/front-end/inspector.js57
-rw-r--r--WebCore/inspector/front-end/inspectorSyntaxHighlight.css40
-rw-r--r--WebCore/inspector/front-end/textEditor.css1
37 files changed, 960 insertions, 748 deletions
diff --git a/WebCore/inspector/InjectedScript.cpp b/WebCore/inspector/InjectedScript.cpp
new file mode 100644
index 0000000..5525877
--- /dev/null
+++ b/WebCore/inspector/InjectedScript.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedScript.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "PlatformString.h"
+#include "ScriptFunctionCall.h"
+
+namespace WebCore {
+
+InjectedScript::InjectedScript(ScriptObject injectedScriptObject)
+ : m_injectedScriptObject(injectedScriptObject)
+{
+}
+
+void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException)
+{
+ ASSERT(!hasNoValue());
+ ScriptState* scriptState = m_injectedScriptObject.scriptState();
+ ScriptFunctionCall function(scriptState, m_injectedScriptObject, "dispatch");
+ function.appendArgument(methodName);
+ function.appendArgument(arguments);
+ if (async)
+ function.appendArgument(callId);
+ *hadException = false;
+ ScriptValue resultValue = function.call(*hadException);
+ if (!*hadException)
+ *result = resultValue.toString(scriptState);
+}
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+String InjectedScript::callFrames()
+{
+ ASSERT(!hasNoValue());
+ ScriptState* scriptState = m_injectedScriptObject.scriptState();
+ ScriptFunctionCall function(scriptState, m_injectedScriptObject, "callFrames");
+ ScriptValue callFramesValue = function.call();
+ return callFramesValue.toString(scriptState);
+}
+#endif
+
+String InjectedScript::wrapAndStringifyForConsole(ScriptValue value)
+{
+ ASSERT(!hasNoValue());
+ ScriptState* scriptState = m_injectedScriptObject.scriptState();
+ ScriptFunctionCall wrapFunction(scriptState, m_injectedScriptObject, "wrapAndStringifyObject");
+ wrapFunction.appendArgument(value);
+ wrapFunction.appendArgument("console");
+ ScriptValue r = wrapFunction.call();
+ if (r.hasNoValue())
+ return "";
+ return r.toString(scriptState);
+}
+
+void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup)
+{
+ ASSERT(!hasNoValue());
+ ScriptState* scriptState = m_injectedScriptObject.scriptState();
+ ScriptFunctionCall releaseFunction(scriptState, m_injectedScriptObject, "releaseWrapperObjectGroup");
+ releaseFunction.appendArgument(objectGroup);
+ releaseFunction.call();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/InjectedScript.h b/WebCore/inspector/InjectedScript.h
new file mode 100644
index 0000000..b70ee39
--- /dev/null
+++ b/WebCore/inspector/InjectedScript.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InjectedScript_h
+#define InjectedScript_h
+
+#include "InjectedScriptHost.h"
+#include "ScriptObject.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class String;
+
+class InjectedScript {
+public:
+ InjectedScript() { }
+ ~InjectedScript() { }
+
+ bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
+
+ void dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException);
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+ String callFrames();
+#endif
+ String wrapAndStringifyForConsole(ScriptValue);
+ void releaseWrapperObjectGroup(const String&);
+
+private:
+ friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*);
+ explicit InjectedScript(ScriptObject);
+ ScriptObject m_injectedScriptObject;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp
index d5bbd1c..13e156a 100644
--- a/WebCore/inspector/InjectedScriptHost.cpp
+++ b/WebCore/inspector/InjectedScriptHost.cpp
@@ -38,6 +38,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLFrameOwnerElement.h"
+#include "InjectedScript.h"
#include "InspectorClient.h"
#include "InspectorController.h"
#include "InspectorDOMAgent.h"
@@ -47,7 +48,7 @@
#include "ScriptArray.h"
#include "ScriptFunctionCall.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JavaScriptCallFrame.h"
#include "JavaScriptDebugServer.h"
using namespace JSC;
@@ -131,7 +132,7 @@ long InjectedScriptHost::pushNodeByPathToFrontend(const String& path)
return domAgent->pushNodePathToFrontend(node);
}
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
JavaScriptCallFrame* InjectedScriptHost::currentCallFrame() const
{
return JavaScriptDebugServer::shared().currentCallFrame();
@@ -167,7 +168,7 @@ void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, const St
frontend->didDispatchOnInjectedScript(callId, result, isException);
}
-ScriptObject InjectedScriptHost::injectedScriptForId(long id)
+InjectedScript InjectedScriptHost::injectedScriptForId(long id)
{
return m_idToInjectedScript.get(id);
}
@@ -180,13 +181,13 @@ void InjectedScriptHost::discardInjectedScripts()
void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
{
if (injectedScriptId) {
- ScriptObject injectedScript = m_idToInjectedScript.get(injectedScriptId);
+ InjectedScript injectedScript = m_idToInjectedScript.get(injectedScriptId);
if (!injectedScript.hasNoValue())
- releaseWrapperObjectGroup(injectedScript, objectGroup);
+ injectedScript.releaseWrapperObjectGroup(objectGroup);
} else {
// Iterate over all injected scripts if injectedScriptId is not specified.
for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it)
- releaseWrapperObjectGroup(it->second, objectGroup);
+ it->second.releaseWrapperObjectGroup(objectGroup);
}
}
@@ -204,13 +205,6 @@ InspectorFrontend* InjectedScriptHost::inspectorFrontend()
return m_inspectorController->m_frontend.get();
}
-void InjectedScriptHost::releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup)
-{
- ScriptFunctionCall releaseFunction(injectedScript.scriptState(), injectedScript, "releaseWrapperObjectGroup");
- releaseFunction.appendArgument(objectGroup);
- releaseFunction.call();
-}
-
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h
index d91c8e2..901472c 100644
--- a/WebCore/inspector/InjectedScriptHost.h
+++ b/WebCore/inspector/InjectedScriptHost.h
@@ -41,6 +41,7 @@
namespace WebCore {
class Database;
+class InjectedScript;
class InspectorDOMAgent;
class InspectorFrontend;
class JavaScriptCallFrame;
@@ -71,7 +72,7 @@ public:
void addNodesToSearchResult(const String& nodeIds);
long pushNodeByPathToFrontend(const String& path);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
JavaScriptCallFrame* currentCallFrame() const;
#endif
#if ENABLE(DATABASE)
@@ -83,8 +84,8 @@ public:
#endif
void reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException);
- ScriptObject injectedScriptFor(ScriptState*);
- ScriptObject injectedScriptForId(long);
+ InjectedScript injectedScriptFor(ScriptState*);
+ InjectedScript injectedScriptForId(long);
void discardInjectedScripts();
void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
@@ -93,12 +94,10 @@ private:
InspectorDOMAgent* inspectorDOMAgent();
InspectorFrontend* inspectorFrontend();
- void releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup);
-
InspectorController* m_inspectorController;
String m_injectedScriptSource;
long m_nextInjectedScriptId;
- typedef HashMap<long, ScriptObject> IdToInjectedScriptMap;
+ typedef HashMap<long, InjectedScript> IdToInjectedScriptMap;
IdToInjectedScriptMap m_idToInjectedScript;
};
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 999a4b7..1ce0e69 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -40,6 +40,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLFrameOwnerElement.h"
+#include "InjectedScript.h"
#include "InjectedScriptHost.h"
#include "InspectorClient.h"
#include "InspectorController.h"
@@ -54,7 +55,7 @@
#include "Storage.h"
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JavaScriptCallFrame.h"
#include "JavaScriptDebugServer.h"
using namespace JSC;
@@ -147,7 +148,7 @@ void InspectorBackend::stopTimelineProfiler()
m_inspectorController->stopTimelineProfiler();
}
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
bool InspectorBackend::debuggerEnabled() const
{
if (m_inspectorController)
@@ -285,7 +286,7 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript
// FIXME: explicitly pass injectedScriptId along with node id to the frontend.
bool injectedScriptIdIsNodeId = injectedScriptId <= 0;
- ScriptObject injectedScript;
+ InjectedScript injectedScript;
if (injectedScriptIdIsNodeId)
injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId);
else
@@ -294,19 +295,12 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript
if (injectedScript.hasNoValue())
return;
- ScriptFunctionCall function(injectedScript.scriptState(), injectedScript, "dispatch");
- function.appendArgument(methodName);
- function.appendArgument(arguments);
- if (async)
- function.appendArgument(callId);
+ String result;
bool hadException = false;
- ScriptValue result = function.call(hadException);
+ injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException);
if (async)
return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
- if (hadException)
- frontend->didDispatchOnInjectedScript(callId, "", true);
- else
- frontend->didDispatchOnInjectedScript(callId, result.toString(injectedScript.scriptState()), false);
+ frontend->didDispatchOnInjectedScript(callId, result, hadException);
}
void InspectorBackend::getChildNodes(long callId, long nodeId)
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index 81c1f2d..7c9644f 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -73,7 +73,7 @@ public:
void startTimelineProfiler();
void stopTimelineProfiler();
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
bool debuggerEnabled() const;
void enableDebugger(bool always);
void disableDebugger(bool always);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 5ab1354..1dbb898 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -39,9 +39,9 @@
#include "ConsoleMessage.h"
#include "Cookie.h"
#include "CookieJar.h"
+#include "DOMWindow.h"
#include "Document.h"
#include "DocumentLoader.h"
-#include "DOMWindow.h"
#include "Element.h"
#include "FloatConversion.h"
#include "FloatQuad.h"
@@ -53,16 +53,17 @@
#include "GraphicsContext.h"
#include "HTMLFrameOwnerElement.h"
#include "HitTestResult.h"
-#include "InspectorBackend.h"
#include "InjectedScriptHost.h"
+#include "InjectedScript.h"
+#include "InspectorBackend.h"
#include "InspectorClient.h"
-#include "InspectorFrontend.h"
-#include "InspectorFrontendHost.h"
-#include "InspectorDatabaseResource.h"
#include "InspectorDOMAgent.h"
#include "InspectorDOMStorageResource.h"
-#include "InspectorTimelineAgent.h"
+#include "InspectorDatabaseResource.h"
+#include "InspectorFrontend.h"
+#include "InspectorFrontendHost.h"
#include "InspectorResource.h"
+#include "InspectorTimelineAgent.h"
#include "JavaScriptProfile.h"
#include "Page.h"
#include "ProgressTracker.h"
@@ -73,6 +74,8 @@
#include "ScriptCallStack.h"
#include "ScriptFunctionCall.h"
#include "ScriptObject.h"
+#include "ScriptProfile.h"
+#include "ScriptProfiler.h"
#include "ScriptString.h"
#include "SecurityOrigin.h"
#include "Settings.h"
@@ -93,15 +96,12 @@
#include "StorageArea.h"
#endif
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+#include "JSJavaScriptCallFrame.h"
#include "JavaScriptCallFrame.h"
#include "JavaScriptDebugServer.h"
-#include "JSJavaScriptCallFrame.h"
-#include <profiler/Profile.h>
-#include <profiler/Profiler.h>
#include <runtime/JSLock.h>
-#include <runtime/StringBuilder.h>
#include <runtime/UString.h>
using namespace JSC;
@@ -132,7 +132,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
, m_client(client)
, m_page(0)
, m_expiredConsoleMessageCount(0)
- , m_scriptState(0)
+ , m_frontendScriptState(0)
, m_windowVisible(false)
, m_showAfterVisible(CurrentPanel)
, m_groupLevel(0)
@@ -143,7 +143,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
, m_inspectorBackend(InspectorBackend::create(this))
, m_inspectorFrontendHost(InspectorFrontendHost::create(this, client))
, m_injectedScriptHost(InjectedScriptHost::create(this))
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
, m_debuggerEnabled(false)
, m_attachDebuggerWhenShown(false)
, m_profilerEnabled(false)
@@ -162,7 +162,7 @@ InspectorController::~InspectorController()
{
// These should have been cleared in inspectedPageDestroyed().
ASSERT(!m_client);
- ASSERT(!m_scriptState);
+ ASSERT(!m_frontendScriptState);
ASSERT(!m_inspectedPage);
ASSERT(!m_page || (m_page && !m_page->parentInspectorController()));
@@ -183,10 +183,9 @@ void InspectorController::inspectedPageDestroyed()
{
close();
- if (m_scriptState) {
- ScriptGlobalObject::remove(m_scriptState, "InspectorBackend");
- ScriptGlobalObject::remove(m_scriptState, "InspectorFrontendHost");
- ScriptGlobalObject::remove(m_scriptState, "InjectedScriptHost");
+ if (m_frontendScriptState) {
+ ScriptGlobalObject::remove(m_frontendScriptState, "InspectorBackend");
+ ScriptGlobalObject::remove(m_frontendScriptState, "InspectorFrontendHost");
}
ASSERT(m_inspectedPage);
m_inspectedPage = 0;
@@ -303,13 +302,13 @@ void InspectorController::setWindowVisible(bool visible, bool attached)
if (m_nodeToFocus)
focusNode();
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
if (m_attachDebuggerWhenShown)
enableDebugger();
#endif
showPanel(m_showAfterVisible);
} else {
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
// If the window is being closed with the debugger enabled,
// remember this state to re-enable debugger on the next window
// opening.
@@ -390,7 +389,7 @@ void InspectorController::startGroup(MessageSource source, ScriptCallStack* call
void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL)
{
- if (m_groupLevel == 0)
+ if (!m_groupLevel)
return;
--m_groupLevel;
@@ -509,24 +508,23 @@ void InspectorController::windowScriptObjectAvailable()
// Grant the inspector the ability to script the inspected page.
m_page->mainFrame()->document()->securityOrigin()->grantUniversalAccess();
- m_scriptState = scriptStateFromPage(debuggerWorld(), m_page);
- ScriptGlobalObject::set(m_scriptState, "InspectorBackend", m_inspectorBackend.get());
- ScriptGlobalObject::set(m_scriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get());
+ m_frontendScriptState = scriptStateFromPage(debuggerWorld(), m_page);
+ ScriptGlobalObject::set(m_frontendScriptState, "InspectorBackend", m_inspectorBackend.get());
+ ScriptGlobalObject::set(m_frontendScriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get());
}
void InspectorController::scriptObjectReady()
{
- ASSERT(m_scriptState);
- if (!m_scriptState)
+ ASSERT(m_frontendScriptState);
+ if (!m_frontendScriptState)
return;
ScriptObject webInspectorObj;
- if (!ScriptGlobalObject::get(m_scriptState, "WebInspector", webInspectorObj))
+ if (!ScriptGlobalObject::get(m_frontendScriptState, "WebInspector", webInspectorObj))
return;
- ScriptObject injectedScriptObj;
- setFrontendProxyObject(m_scriptState, webInspectorObj, injectedScriptObj);
+ setFrontendProxyObject(m_frontendScriptState, webInspectorObj);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
String debuggerEnabled = setting(debuggerEnabledSettingName);
if (debuggerEnabled == "true")
enableDebugger();
@@ -543,7 +541,7 @@ void InspectorController::scriptObjectReady()
void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject)
{
- m_scriptState = scriptState;
+ m_frontendScriptState = scriptState;
m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj));
releaseDOMAgent();
m_domAgent = InspectorDOMAgent::create(m_frontend.get());
@@ -558,7 +556,7 @@ void InspectorController::show()
if (!m_page) {
if (m_frontend)
- return; // We are using custom frontend - no need to create page.
+ return; // We are using custom frontend - no need to create page.
m_page = m_client->createPage();
if (!m_page)
@@ -595,7 +593,7 @@ void InspectorController::close()
if (!enabled())
return;
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
stopUserInitiatedProfiling();
disableDebugger();
#endif
@@ -604,7 +602,7 @@ void InspectorController::close()
releaseDOMAgent();
m_frontend.set(0);
m_timelineAgent = 0;
- m_scriptState = 0;
+ m_frontendScriptState = 0;
if (m_page) {
if (!m_page->mainFrame() || !m_page->mainFrame()->loader() || !m_page->mainFrame()->loader()->isLoading()) {
m_page->setParentInspectorController(0);
@@ -745,7 +743,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
m_times.clear();
m_counts.clear();
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
m_profiles.clear();
m_currentUserInitiatedProfileNumber = 1;
m_nextUserInitiatedProfileNumber = 1;
@@ -1306,7 +1304,7 @@ void InspectorController::setDOMStorageItem(long callId, long storageId, const S
if (storageResource) {
ExceptionCode exception = 0;
storageResource->domStorage()->setItem(key, value, exception);
- success = (exception == 0);
+ success = !exception;
}
m_frontend->didSetDOMStorageItem(callId, success);
}
@@ -1344,13 +1342,13 @@ void InspectorController::moveWindowBy(float x, float y) const
m_page->chrome()->setWindowRect(frameRect);
}
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-void InspectorController::addProfile(PassRefPtr<Profile> prpProfile, unsigned lineNumber, const UString& sourceURL)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
{
if (!enabled())
return;
- RefPtr<Profile> profile = prpProfile;
+ RefPtr<ScriptProfile> profile = prpProfile;
m_profiles.add(profile->uid(), profile);
if (m_frontend) {
@@ -1361,30 +1359,18 @@ void InspectorController::addProfile(PassRefPtr<Profile> prpProfile, unsigned li
addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL);
}
-void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<Profile> prpProfile, unsigned lineNumber, const UString& sourceURL)
+void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
{
- RefPtr<Profile> profile = prpProfile;
+ RefPtr<ScriptProfile> profile = prpProfile;
- JSC::StringBuilder message;
- message.append("Profile \"webkit-profile://");
- message.append((UString)encodeWithURLEscapeSequences(CPUProfileType));
- message.append("/");
- message.append((UString)encodeWithURLEscapeSequences(profile->title()));
- message.append("#");
- message.append(UString::from(profile->uid()));
- message.append("\" finished.");
- addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message.release(), lineNumber, sourceURL);
+ String message = String::format("Profile \"webkit-profile://%s/%s#%d\" finished.", CPUProfileType, encodeWithURLEscapeSequences(profile->title()).utf8().data(), profile->uid());
+ addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
-void InspectorController::addStartProfilingMessageToConsole(const UString& title, unsigned lineNumber, const UString& sourceURL)
+void InspectorController::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
{
- JSC::StringBuilder message;
- message.append("Profile \"webkit-profile://");
- message.append(encodeWithURLEscapeSequences(CPUProfileType));
- message.append("/");
- message.append(encodeWithURLEscapeSequences(title));
- message.append("#0\" started.");
- addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message.release(), lineNumber, sourceURL);
+ String message = String::format("Profile \"webkit-profile://%s/%s#0\" started.", CPUProfileType, encodeWithURLEscapeSequences(title).utf8().data());
+ addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
}
void InspectorController::getProfileHeaders(long callId)
@@ -1405,29 +1391,24 @@ void InspectorController::getProfile(long callId, unsigned uid)
return;
ProfilesMap::iterator it = m_profiles.find(uid);
if (it != m_profiles.end())
- m_frontend->didGetProfile(callId, toJS(m_scriptState, it->second.get()));
+ m_frontend->didGetProfile(callId, toJS(m_frontendScriptState, it->second.get()));
}
-ScriptObject InspectorController::createProfileHeader(const JSC::Profile& profile)
+ScriptObject InspectorController::createProfileHeader(const ScriptProfile& profile)
{
ScriptObject header = m_frontend->newScriptObject();
header.set("title", profile.title());
header.set("uid", profile.uid());
- header.set("typeId", UString(CPUProfileType));
+ header.set("typeId", String(CPUProfileType));
return header;
}
-UString InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false)
+String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false)
{
if (incrementProfileNumber)
m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++;
- JSC::StringBuilder title;
- title.append(UserInitiatedProfileName);
- title.append(".");
- title.append(UString::from(m_currentUserInitiatedProfileNumber));
-
- return title.release();
+ return String::format("%s.%d", UserInitiatedProfileName, m_currentUserInitiatedProfileNumber);
}
void InspectorController::startUserInitiatedProfilingSoon()
@@ -1447,12 +1428,12 @@ void InspectorController::startUserInitiatedProfiling(Timer<InspectorController>
m_recordingUserInitiatedProfile = true;
- UString title = getCurrentUserInitiatedProfileName(true);
+ String title = getCurrentUserInitiatedProfileName(true);
ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
- Profiler::profiler()->startProfiling(scriptState, title);
+ ScriptProfiler::start(scriptState, title);
- addStartProfilingMessageToConsole(title, 0, UString());
+ addStartProfilingMessageToConsole(title, 0, String());
toggleRecordButton(true);
}
@@ -1464,12 +1445,12 @@ void InspectorController::stopUserInitiatedProfiling()
m_recordingUserInitiatedProfile = false;
- UString title = getCurrentUserInitiatedProfileName();
+ String title = getCurrentUserInitiatedProfileName();
ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
- RefPtr<Profile> profile = Profiler::profiler()->stopProfiling(scriptState, title);
+ RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title);
if (profile)
- addProfile(profile, 0, UString());
+ addProfile(profile, 0, String());
toggleRecordButton(false);
}
@@ -1536,9 +1517,9 @@ void InspectorController::enableDebugger()
if (m_debuggerEnabled)
return;
- if (!m_scriptState || !m_frontend) {
+ if (!m_frontendScriptState || !m_frontend)
m_attachDebuggerWhenShown = true;
- } else {
+ else {
m_frontend->attachDebuggerWhenShown();
m_attachDebuggerWhenShown = false;
}
@@ -1587,11 +1568,8 @@ void InspectorController::didPause()
JavaScriptCallFrame* callFrame = m_injectedScriptHost->currentCallFrame();
ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec();
ASSERT(scriptState);
- ScriptObject injectedScriptObj = m_injectedScriptHost->injectedScriptFor(scriptState);
- ScriptFunctionCall function(scriptState, injectedScriptObj, "getCallFrames");
- ScriptValue callFramesValue = function.call();
- String callFrames = callFramesValue.toString(scriptState);
-
+ InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState);
+ String callFrames = injectedScript.callFrames();
m_frontend->pausedScript(callFrames);
}
@@ -1803,20 +1781,19 @@ InspectorController::SpecialPanels InspectorController::specialPanelForJSName(co
{
if (panelName == "elements")
return ElementsPanel;
- else if (panelName == "resources")
+ if (panelName == "resources")
return ResourcesPanel;
- else if (panelName == "scripts")
+ if (panelName == "scripts")
return ScriptsPanel;
- else if (panelName == "timeline")
+ if (panelName == "timeline")
return TimelinePanel;
- else if (panelName == "profiles")
+ if (panelName == "profiles")
return ProfilesPanel;
- else if (panelName == "storage" || panelName == "databases")
+ if (panelName == "storage" || panelName == "databases")
return StoragePanel;
- else if (panelName == "console")
+ if (panelName == "console")
return ConsolePanel;
- else
- return ElementsPanel;
+ return ElementsPanel;
}
void InspectorController::deleteCookie(const String& cookieName, const String& domain)
@@ -1829,7 +1806,7 @@ void InspectorController::deleteCookie(const String& cookieName, const String& d
}
}
-ScriptObject InspectorController::injectedScriptForNodeId(long id)
+InjectedScript InspectorController::injectedScriptForNodeId(long id)
{
Frame* frame = 0;
@@ -1847,7 +1824,7 @@ ScriptObject InspectorController::injectedScriptForNodeId(long id)
if (frame)
return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
- return ScriptObject();
+ return InjectedScript();
}
} // namespace WebCore
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 860bf49..6904380 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -35,6 +35,7 @@
#include "PlatformString.h"
#include "ScriptArray.h"
#include "ScriptObject.h"
+#include "ScriptProfile.h"
#include "ScriptState.h"
#include "ScriptValue.h"
#include "StringHash.h"
@@ -46,12 +47,11 @@
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JavaScriptDebugListener.h"
namespace JSC {
- class Profile;
- class UString;
+class UString;
}
#endif
@@ -64,6 +64,7 @@ class DocumentLoader;
class Element;
class GraphicsContext;
class HitTestResult;
+class InjectedScript;
class InjectedScriptHost;
class InspectorBackend;
class InspectorClient;
@@ -89,7 +90,7 @@ class InspectorDOMStorageResource;
class InspectorResource;
class InspectorController
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
: JavaScriptDebugListener, public Noncopyable
#else
: public Noncopyable
@@ -149,7 +150,7 @@ public:
void detachWindow();
void toggleSearchForNodeInPage();
- bool searchingForNodeInPage() { return m_searchingForNode; };
+ bool searchingForNodeInPage() const { return m_searchingForNode; }
void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
void handleMousePressOnNode(Node*);
@@ -157,7 +158,7 @@ public:
void windowScriptObjectAvailable();
void setFrontendProxyObject(ScriptState* state, ScriptObject webInspectorObj, ScriptObject injectedScriptObj = ScriptObject());
- ScriptState* frontendScriptState() const { return m_scriptState; }
+ ScriptState* frontendScriptState() const { return m_frontendScriptState; }
void populateScriptObjects();
void resetScriptObjects();
@@ -219,14 +220,14 @@ public:
void markTimeline(const String& message);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- void addProfile(PassRefPtr<JSC::Profile>, unsigned lineNumber, const JSC::UString& sourceURL);
- void addProfileFinishedMessageToConsole(PassRefPtr<JSC::Profile>, unsigned lineNumber, const JSC::UString& sourceURL);
- void addStartProfilingMessageToConsole(const JSC::UString& title, unsigned lineNumber, const JSC::UString& sourceURL);
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+ void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
+ void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
+ void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
bool isRecordingUserInitiatedProfile() const { return m_recordingUserInitiatedProfile; }
- JSC::UString getCurrentUserInitiatedProfileName(bool incrementProfileNumber);
+ String getCurrentUserInitiatedProfileName(bool incrementProfileNumber);
void startUserInitiatedProfiling(Timer<InspectorController>* = 0);
void stopUserInitiatedProfiling();
@@ -248,7 +249,7 @@ public:
void evaluateForTestInFrontend(long callId, const String& script);
- ScriptObject injectedScriptForNodeId(long id);
+ InjectedScript injectedScriptForNodeId(long id);
private:
static const char* const FrontendSettingsSettingName;
@@ -267,15 +268,15 @@ private:
void deleteCookie(const String& cookieName, const String& domain);
-#if ENABLE(JAVASCRIPT_DEBUGGER)
- typedef HashMap<unsigned int, RefPtr<JSC::Profile> > ProfilesMap;
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+ typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
void startUserInitiatedProfilingSoon();
void toggleRecordButton(bool);
void enableDebuggerFromFrontend(bool always);
void getProfileHeaders(long callId);
void getProfile(long callId, unsigned uid);
- ScriptObject createProfileHeader(const JSC::Profile& profile);
+ ScriptObject createProfileHeader(const ScriptProfile& profile);
#endif
#if ENABLE(DATABASE)
void selectDatabase(Database* database);
@@ -328,7 +329,7 @@ private:
#if ENABLE(DOM_STORAGE)
DOMStorageResourcesMap m_domStorageResources;
#endif
- ScriptState* m_scriptState;
+ ScriptState* m_frontendScriptState;
bool m_windowVisible;
SpecialPanels m_showAfterVisible;
RefPtr<Node> m_highlightedNode;
@@ -345,7 +346,7 @@ private:
mutable Settings m_settings;
Vector<pair<long, String> > m_pendingEvaluateTestCommands;
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
bool m_debuggerEnabled;
bool m_attachDebuggerWhenShown;
bool m_profilerEnabled;
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index d5c817d..c3bf1b4 100644
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -34,6 +34,7 @@
#include "ConsoleMessage.h"
#include "Frame.h"
+#include "InjectedScript.h"
#include "InjectedScriptHost.h"
#include "InspectorController.h"
#include "Node.h"
@@ -43,7 +44,7 @@
#include "ScriptString.h"
#include <wtf/OwnPtr.h>
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include <parser/SourceCode.h>
#include <runtime/JSValue.h>
#include <runtime/UString.h>
@@ -105,15 +106,9 @@ void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const
function.appendArgument(frames[i]);
} else if (!arguments.isEmpty()) {
function.appendArgument(true);
- ScriptObject injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState);
+ InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState);
for (unsigned i = 0; i < arguments.size(); ++i) {
- ScriptFunctionCall wrapFunction(scriptState, injectedScript, "wrapAndStringifyObject");
- wrapFunction.appendArgument(arguments[i]);
- wrapFunction.appendArgument("console");
- ScriptValue r = wrapFunction.call();
- if (r.hasNoValue())
- return;
- String s = r.toString(scriptState);
+ String s = injectedScript.wrapAndStringifyForConsole(arguments[i]);
function.appendArgument(s);
}
} else {
@@ -252,7 +247,7 @@ void InspectorFrontend::addRecordToTimeline(const ScriptObject& record)
function.call();
}
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
void InspectorFrontend::attachDebuggerWhenShown()
{
callSimpleFunction("attachDebuggerWhenShown");
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index 0b52566..a36a323 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -35,7 +35,7 @@
#include "ScriptState.h"
#include <wtf/PassOwnPtr.h>
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
namespace JSC {
class JSValue;
class SourceCode;
@@ -84,7 +84,7 @@ namespace WebCore {
void resourceTrackingWasEnabled();
void resourceTrackingWasDisabled();
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
void attachDebuggerWhenShown();
void debuggerWasEnabled();
void debuggerWasDisabled();
diff --git a/WebCore/inspector/JavaScriptCallFrame.cpp b/WebCore/inspector/JavaScriptCallFrame.cpp
index cbc5314..e6f75b8 100644
--- a/WebCore/inspector/JavaScriptCallFrame.cpp
+++ b/WebCore/inspector/JavaScriptCallFrame.cpp
@@ -27,7 +27,7 @@
#include "JavaScriptCallFrame.h"
#include "JSDOMBinding.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "PlatformString.h"
#include <debugger/DebuggerCallFrame.h>
diff --git a/WebCore/inspector/JavaScriptCallFrame.h b/WebCore/inspector/JavaScriptCallFrame.h
index 47cdac2..bf61c4b 100644
--- a/WebCore/inspector/JavaScriptCallFrame.h
+++ b/WebCore/inspector/JavaScriptCallFrame.h
@@ -26,7 +26,7 @@
#ifndef JavaScriptCallFrame_h
#define JavaScriptCallFrame_h
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include <interpreter/CallFrame.h>
#include <wtf/PassRefPtr.h>
diff --git a/WebCore/inspector/JavaScriptDebugListener.h b/WebCore/inspector/JavaScriptDebugListener.h
index 912a751..6570065 100644
--- a/WebCore/inspector/JavaScriptDebugListener.h
+++ b/WebCore/inspector/JavaScriptDebugListener.h
@@ -29,7 +29,7 @@
#ifndef JavaScriptDebugListener_h
#define JavaScriptDebugListener_h
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
namespace JSC {
class ExecState;
diff --git a/WebCore/inspector/JavaScriptDebugServer.cpp b/WebCore/inspector/JavaScriptDebugServer.cpp
index 4aab347..03c3577 100644
--- a/WebCore/inspector/JavaScriptDebugServer.cpp
+++ b/WebCore/inspector/JavaScriptDebugServer.cpp
@@ -29,7 +29,7 @@
#include "config.h"
#include "JavaScriptDebugServer.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "DOMWindow.h"
#include "EventLoop.h"
diff --git a/WebCore/inspector/JavaScriptDebugServer.h b/WebCore/inspector/JavaScriptDebugServer.h
index b5b713d..d7c23bc 100644
--- a/WebCore/inspector/JavaScriptDebugServer.h
+++ b/WebCore/inspector/JavaScriptDebugServer.h
@@ -29,7 +29,7 @@
#ifndef JavaScriptDebugServer_h
#define JavaScriptDebugServer_h
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "Timer.h"
#include <debugger/Debugger.h>
diff --git a/WebCore/inspector/JavaScriptProfile.cpp b/WebCore/inspector/JavaScriptProfile.cpp
index 3a65fb8..2203f0b 100644
--- a/WebCore/inspector/JavaScriptProfile.cpp
+++ b/WebCore/inspector/JavaScriptProfile.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "JavaScriptProfile.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JavaScriptProfileNode.h"
#include <profiler/Profile.h>
diff --git a/WebCore/inspector/JavaScriptProfile.h b/WebCore/inspector/JavaScriptProfile.h
index 28fd3e4..2500881 100644
--- a/WebCore/inspector/JavaScriptProfile.h
+++ b/WebCore/inspector/JavaScriptProfile.h
@@ -26,7 +26,7 @@
#ifndef JavaScriptProfile_h
#define JavaScriptProfile_h
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include <runtime/JSValue.h>
diff --git a/WebCore/inspector/JavaScriptProfileNode.cpp b/WebCore/inspector/JavaScriptProfileNode.cpp
index 2d462f6..6387c85 100644
--- a/WebCore/inspector/JavaScriptProfileNode.cpp
+++ b/WebCore/inspector/JavaScriptProfileNode.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "JavaScriptProfileNode.h"
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include "JSDOMBinding.h"
#include <profiler/ProfileNode.h>
diff --git a/WebCore/inspector/JavaScriptProfileNode.h b/WebCore/inspector/JavaScriptProfileNode.h
index ad72b71..2685ac6 100644
--- a/WebCore/inspector/JavaScriptProfileNode.h
+++ b/WebCore/inspector/JavaScriptProfileNode.h
@@ -26,7 +26,7 @@
#ifndef JavaScriptProfileNode_h
#define JavaScriptProfileNode_h
-#if ENABLE(JAVASCRIPT_DEBUGGER)
+#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
#include <runtime/JSValue.h>
#include <JavaScriptCore/JSBase.h>
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index d38a7bb..8d8d5db 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -898,29 +898,18 @@ WebInspector.ElementsTreeElement.prototype = {
if (!hrefValue || hrefValue.indexOf("://") > 0)
return hrefValue;
- var match;
- var documentURL;
for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
if (frameOwnerCandidate.documentURL) {
- documentURL = frameOwnerCandidate.documentURL;
+ var result = WebInspector.completeURL(frameOwnerCandidate.documentURL, hrefValue);
+ if (result)
+ return result;
break;
}
}
- if (documentURL) {
- match = documentURL.match(WebInspector.URLRegExp);
- if (match) {
- var path = hrefValue;
- if (path.charAt(0) !== "/") {
- var documentPath = match[4] || "/";
- path = documentPath.substring(0, documentPath.lastIndexOf("/")) + "/" + path;
- }
- return match[1] + "://" + match[2] + (match[3] ? (":" + match[3]) : "") + path;
- }
- }
// documentURL not found or has bad value
for (var url in WebInspector.resourceURLMap) {
- match = url.match(WebInspector.URLRegExp);
+ var match = url.match(WebInspector.URLRegExp);
if (match && match[4] === hrefValue)
return url;
}
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 9389117..337628f 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -923,7 +923,7 @@ InjectedScript.openInInspectedWindow = function(url)
return true;
}
-InjectedScript.getCallFrames = function()
+InjectedScript.callFrames = function()
{
var callFrame = InjectedScriptHost.currentCallFrame();
if (!callFrame)
diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js
index 5ddb74a..ed03f73 100644
--- a/WebCore/inspector/front-end/InspectorBackendStub.js
+++ b/WebCore/inspector/front-end/InspectorBackendStub.js
@@ -46,17 +46,6 @@ WebInspector.InspectorBackendStub.prototype = {
return func;
},
- platform: function()
- {
- return "mac-leopard";
- },
-
- port: function()
- {
- return "unknown";
- },
-
-
closeWindow: function()
{
this._windowVisible = false;
diff --git a/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/WebCore/inspector/front-end/InspectorFrontendHostStub.js
index dc7da61..f1decb6 100644
--- a/WebCore/inspector/front-end/InspectorFrontendHostStub.js
+++ b/WebCore/inspector/front-end/InspectorFrontendHostStub.js
@@ -35,10 +35,12 @@ WebInspector.InspectorFrontendHostStub = function()
this._attachedWindowHeight = 0;
}
+WebInspector._platformFlavor = WebInspector.PlatformFlavor.MacLeopard;
+
WebInspector.InspectorFrontendHostStub.prototype = {
platform: function()
{
- return "mac-leopard";
+ return "mac";
},
port: function()
diff --git a/WebCore/inspector/front-end/NativeTextViewer.js b/WebCore/inspector/front-end/NativeTextViewer.js
index 53b213d..5e7db27 100644
--- a/WebCore/inspector/front-end/NativeTextViewer.js
+++ b/WebCore/inspector/front-end/NativeTextViewer.js
@@ -28,13 +28,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.NativeTextViewer = function(textModel, platform)
+WebInspector.NativeTextViewer = function(textModel, platform, url)
{
WebInspector.TextEditor.call(this, textModel, platform);
- this._sheet.className = "monospace";
this._sheet.tabIndex = 0;
this._canvas.style.zIndex = 0;
this._createLineDivs();
+ this._url = url;
+ this._selectionColor = "rgb(241, 234, 0)";
}
WebInspector.NativeTextViewer.prototype = {
@@ -52,9 +53,13 @@ WebInspector.NativeTextViewer.prototype = {
for (var i = 0; i < this._textModel.linesCount; ++i) {
var lineDiv = document.createElement("div");
lineDiv.className = "native-text-editor-line";
- lineDiv.textContent = this._textModel.line(i);
+ var text = this._textModel.line(i);
+ lineDiv.textContent = text;
+ if (!text)
+ lineDiv.style.minHeight = this._textLineHeight + "px";
this._sheet.appendChild(lineDiv);
this._textModel.setAttribute(i, "line-div", lineDiv);
+ this._textModel.removeAttribute(i, "div-highlighted");
}
this._container.appendChild(this._sheet);
},
@@ -68,7 +73,7 @@ WebInspector.NativeTextViewer.prototype = {
var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount);
this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth;
- this._sheet.style.paddingLeft = this._textWidth + this._lineNumberWidth + "px";
+ this._container.style.left = this._lineNumberWidth + "px";
this._lineNumberDigits = newLineNumberDigits;
this.repaintAll();
@@ -86,7 +91,8 @@ WebInspector.NativeTextViewer.prototype = {
_registerMouseListeners: function()
{
- this._sheet.addEventListener("mousedown", this._mouseDown.bind(this), false);
+ this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false);
+ this.element.addEventListener("mousedown", this._mouseDown.bind(this), false);
},
_registerKeyboardListeners: function()
@@ -99,44 +105,48 @@ WebInspector.NativeTextViewer.prototype = {
// Noop - let browser take care of this.
},
- _paintSelection: function()
+ _positionDivDecoration: function()
{
- // Noop - let browser take care of this.
+ // Div decorations have fixed positions in our case.
},
- _positionDivDecoration: function()
+ _registerShortcuts: function()
{
- // Div decorations have fixed positions in our case.
+ // Noop.
},
_mouseDown: function(e)
{
- if (e.offsetX + e.target.offsetTop >= this._lineNumberWidth && this._lineNumberDecorator)
- return;
-
- if (e.button === 2 || (this._isMac && e.ctrlKey))
+ if (e.target !== this.element || e.button === 2 || (this._isMac && e.ctrlKey))
return;
-
- var location = this._caretForMouseEvent(e);
- this._lineNumberDecorator.mouseDown(location.line, e);
+ this._lineNumberDecorator.mouseDown(this._lineForMouseEvent(e), e);
},
_contextMenu: function(e)
{
- // Override editor's implementation to add the line's offsets.
- if (e.offsetX + e.target.offsetTop >= this._lineNumberWidth && this._lineNumberDecorator)
+ if (e.target !== this.element)
return;
+ this._lineNumberDecorator.contextMenu(this._lineForMouseEvent(e), e);
+ },
- var location = this._caretForMouseEvent(e);
- this._lineNumberDecorator.contextMenu(location.line, e);
+ _lineForMouseEvent: function(e)
+ {
+ return Math.max(0, this._offsetToLine(e.offsetY + this._scrollTop) - 1);
},
- _caretForMouseEvent: function(e)
+ _lineHeight: function(lineNumber)
{
- // Override editor's implementation to add the line's offsets.
- var lineNumber = Math.max(0, this._offsetToLine(e.offsetY + e.target.offsetTop) - 1);
- var offset = e.offsetX + e.target.offsetLeft + this._scrollLeft - this._lineNumberWidth;
- return { line: lineNumber, column: this._columnForOffset(lineNumber, offset) };
+ // Use cached value first.
+ if (this._lineOffsetsCache[lineNumber + 1])
+ return this._lineOffsetsCache[lineNumber + 1] - this._lineOffsetsCache[lineNumber];
+
+ // Get metrics from the browser.
+ var element = this._textModel.getAttribute(lineNumber, "line-div");
+ if (lineNumber + 1 < this._textModel.linesCount) {
+ var nextElement = this._textModel.getAttribute(lineNumber + 1, "line-div");
+ return nextElement.offsetTop - element.offsetTop;
+ }
+ return element.parentElement.offsetHeight - element.offsetTop;
},
_paintLine: function(lineNumber, lineOffset)
@@ -181,12 +191,41 @@ WebInspector.NativeTextViewer.prototype = {
_createSpan: function(content, className)
{
+ if (className === "html-resource-link" || className === "html-external-link")
+ return this._createLink(content, className === "html-external-link");
+
var span = document.createElement("span");
span.className = "webkit-" + className;
span.appendChild(document.createTextNode(content));
return span;
},
+ _createLink: function(content, isExternal)
+ {
+ var quote = content.charAt(0);
+ if (content.length > 1 && (quote === "\"" || quote === "'"))
+ content = content.substring(1, content.length - 1);
+ else
+ quote = null;
+
+ var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal);
+ var span = document.createElement("span");
+ span.className = "webkit-html-attribute-value";
+ if (quote)
+ span.appendChild(document.createTextNode(quote));
+ span.appendChild(a);
+ if (quote)
+ span.appendChild(document.createTextNode(quote));
+ return span;
+ },
+
+ _rewriteHref: function(hrefValue, isExternal)
+ {
+ if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0)
+ return hrefValue;
+ return WebInspector.completeURL(this._url, hrefValue);
+ },
+
setDivDecoration: function(lineNumber, element)
{
var existingElement = this._textModel.getAttribute(lineNumber, "div-decoration");
@@ -203,6 +242,16 @@ WebInspector.NativeTextViewer.prototype = {
this._textModel.setAttribute(lineNumber, "div-decoration", element);
}
this.revalidateDecorationsAndPaint();
+ },
+
+ initFontMetrics: function()
+ {
+ WebInspector.TextEditor.prototype.initFontMetrics.call(this);
+ for (var i = 0; i < this._textModel.linesCount; ++i) {
+ var lineDiv = this._textModel.getAttribute(i, "line-div");
+ if (!this._textModel.line(i))
+ lineDiv.style.minHeight = this._textLineHeight + "px";
+ }
}
}
diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js
index 334847e..b7b01ac 100644
--- a/WebCore/inspector/front-end/ResourceView.js
+++ b/WebCore/inspector/front-end/ResourceView.js
@@ -183,6 +183,8 @@ WebInspector.ResourceView.prototype = {
this.headersElement.addStyleClass("hidden");
if ("resize" in this)
this.resize();
+ if ("contentTabSelected" in this)
+ this.contentTabSelected();
},
_refreshURL: function()
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index e0c5521..40a380c 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -429,7 +429,7 @@ WebInspector.ResourcesPanel.prototype = {
return;
var newView = this._createResourceView(resource);
- if (newView.prototype === resource._resourcesView.prototype)
+ if (newView.__proto__ === resource._resourcesView.__proto__)
return;
resource.warnings = 0;
@@ -439,6 +439,7 @@ WebInspector.ResourcesPanel.prototype = {
resource._itemsTreeElement.updateErrorsAndWarnings();
var oldView = resource._resourcesView;
+ var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null;
resource._resourcesView.detach();
delete resource._resourcesView;
@@ -447,8 +448,8 @@ WebInspector.ResourcesPanel.prototype = {
newView.headersVisible = oldView.headersVisible;
- if (oldView.visible && oldView.element.parentNode)
- newView.show(oldView.element.parentNode);
+ if (oldViewParentNode)
+ newView.show(oldViewParentNode);
},
canShowSourceLineForURL: function(url)
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index 1838068..bc0daa5 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -39,7 +39,7 @@ var Preferences = {
showMissingLocalizedStrings: false,
samplingCPUProfiler: false,
showColorNicknames: true,
- useCanvasBasedEditor: true
+ useCanvasBasedEditor: false
}
WebInspector.populateFrontendSettings = function(settingsString)
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index 1e1bd0c..e30dbdb 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -123,11 +123,12 @@ WebInspector.SourceFrame.prototype = {
this._editor.revalidateDecorationsAndPaint();
},
- setContent: function(mimeType, content)
+ setContent: function(mimeType, content, url)
{
this._loaded = true;
this._textModel.setText(null, content);
this._mimeType = mimeType;
+ this._url = url;
this._createEditorIfNeeded();
},
@@ -137,13 +138,14 @@ WebInspector.SourceFrame.prototype = {
return;
var editorConstructor = Preferences.useCanvasBasedEditor ? WebInspector.TextEditor : WebInspector.NativeTextViewer;
- this._editor = new editorConstructor(this._textModel, WebInspector.platform);
+ this._editor = new editorConstructor(this._textModel, WebInspector.platform, this._url);
this._editor.lineNumberDecorator = new WebInspector.BreakpointLineNumberDecorator(this, this._editor.textModel);
this._editor.lineDecorator = new WebInspector.ExecutionLineDecorator(this);
this._editor.readOnly = true;
this._element = this._editor.element;
this._element.addEventListener("keydown", this._keyDown.bind(this), true);
this._parentElement.appendChild(this._element);
+ this._editor.initFontMetrics();
this._editor.mimeType = this._mimeType;
diff --git a/WebCore/inspector/front-end/SourceHTMLTokenizer.js b/WebCore/inspector/front-end/SourceHTMLTokenizer.js
index 1212ffe..8856ff5 100644
--- a/WebCore/inspector/front-end/SourceHTMLTokenizer.js
+++ b/WebCore/inspector/front-end/SourceHTMLTokenizer.js
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Thu Jan 28 20:49:22 2010 */
+/* Generated by re2c 0.13.5 on Tue Feb 2 00:44:38 2010 */
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
@@ -45,72 +45,81 @@ WebInspector.SourceHTMLTokenizer = function()
{
WebInspector.SourceTokenizer.call(this);
+ // The order is determined by the generated code.
this._lexConditions = {
INITIAL: 0,
COMMENT: 1,
- DSTRING: 2,
- SSTRING: 3
+ DOCTYPE: 2,
+ TAG: 3,
+ DSTRING: 4,
+ SSTRING: 5
};
+ this.case_INITIAL = 1000;
+ this.case_COMMENT = 1001;
+ this.case_DOCTYPE = 1002;
+ this.case_TAG = 1003;
+ this.case_DSTRING = 1004;
+ this.case_SSTRING = 1005;
this._parseConditions = {
INITIAL: 0,
- TAG: 1,
- ATTRIBUTE: 2,
- ATTRIBUTE_VALUE: 3,
- SCRIPT: 4,
- SCRIPT_ATTRIBUTE: 5,
- SCRIPT_ATTRIBUTE_VALUE: 6,
- DOCTYPE: 7
+ ATTRIBUTE: 1,
+ ATTRIBUTE_VALUE: 2,
+ LINKIFY: 4,
+ A_NODE: 8,
+ SCRIPT: 16
};
- this.case_INITIAL = 1000;
- this.case_COMMENT = 1001;
- this.case_DSTRING = 1002;
- this.case_SSTRING = 1003;
-
this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
}
WebInspector.SourceHTMLTokenizer.prototype = {
- _isAttribute: function()
+ _isExpectingAttribute: function()
{
- return this._parseCondition === this._parseConditions.ATTRIBUTE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE;
+ return this._parseCondition & this._parseConditions.ATTRIBUTE;
},
- _isAttributeValue: function()
+ _isExpectingAttributeValue: function()
{
- return this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE;
+ return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
},
- _setAttributeValue: function()
+ _setExpectingAttribute: function()
{
- if (this._parseCondition === this._parseConditions.ATTRIBUTE)
- this._parseCondition = this._parseConditions.ATTRIBUTE_VALUE;
- else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE)
- this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE_VALUE;
+ if (this._isExpectingAttributeValue())
+ this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
+ this._parseCondition |= this._parseConditions.ATTRIBUTE;
},
- _setAttribute: function()
+ _setExpectingAttributeValue: function()
{
- if (this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE)
- this._parseCondition = this._parseConditions.ATTRIBUTE;
- else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE)
- this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE;
+ if (this._isExpectingAttribute())
+ this._parseCondition ^= this._parseConditions.ATTRIBUTE;
+ this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
},
_stringToken: function(cursor, stringEnds)
{
- if (this._isAttributeValue()) {
- this.tokenType = "html-attr-value";
- if (stringEnds)
- this._setAttribute();
- } else if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
+ if (!this._isExpectingAttributeValue()) {
this.tokenType = null;
+ return cursor;
+ }
+ this.tokenType = this._attrValueTokenType();
+ if (stringEnds)
+ this._setExpectingAttribute();
return cursor;
},
+ _attrValueTokenType: function()
+ {
+ if (this._parseCondition & this._parseConditions.LINKIFY) {
+ if (this._parseCondition & this._parseConditions.A_NODE)
+ return "html-external-link";
+ return "html-resource-link";
+ }
+ return "html-attribute-value";
+ },
+
nextToken: function(cursor)
{
var cursorOnEnter = cursor;
@@ -122,17 +131,25 @@ WebInspector.SourceHTMLTokenizer.prototype = {
{
case 1: var yych;
var yyaccept = 0;
- if (this.getLexCondition() < 2) {
+ if (this.getLexCondition() < 3) {
if (this.getLexCondition() < 1) {
{ gotoCase = this.case_INITIAL; continue; };
} else {
- { gotoCase = this.case_COMMENT; continue; };
+ if (this.getLexCondition() < 2) {
+ { gotoCase = this.case_COMMENT; continue; };
+ } else {
+ { gotoCase = this.case_DOCTYPE; continue; };
+ }
}
} else {
- if (this.getLexCondition() < 3) {
- { gotoCase = this.case_DSTRING; continue; };
+ if (this.getLexCondition() < 4) {
+ { gotoCase = this.case_TAG; continue; };
} else {
- { gotoCase = this.case_SSTRING; continue; };
+ if (this.getLexCondition() < 5) {
+ { gotoCase = this.case_DSTRING; continue; };
+ } else {
+ { gotoCase = this.case_SSTRING; continue; };
+ }
}
}
/* *********************************** */
@@ -193,393 +210,438 @@ case 12:
{ gotoCase = 5; continue; };
}
/* *********************************** */
-case this.case_DSTRING:
+case this.case_DOCTYPE:
yych = this._charAt(cursor);
if (yych <= '\f') {
if (yych == '\n') { gotoCase = 18; continue; };
{ gotoCase = 17; continue; };
} else {
if (yych <= '\r') { gotoCase = 18; continue; };
- if (yych == '"') { gotoCase = 20; continue; };
+ if (yych == '>') { gotoCase = 20; continue; };
{ gotoCase = 17; continue; };
}
case 16:
- { return this._stringToken(cursor); }
+ { this.tokenType = "html-doctype"; return cursor; }
case 17:
yych = this._charAt(++cursor);
- { gotoCase = 24; continue; };
+ { gotoCase = 23; continue; };
case 18:
++cursor;
{ this.tokenType = null; return cursor; }
case 20:
++cursor;
-case 21:
this.setLexCondition(this._lexConditions.INITIAL);
- { return this._stringToken(cursor, true); }
+ { this.tokenType = "html-doctype"; return cursor; }
case 22:
- yych = this._charAt(++cursor);
- { gotoCase = 21; continue; };
-case 23:
++cursor;
yych = this._charAt(cursor);
-case 24:
+case 23:
if (yych <= '\f') {
if (yych == '\n') { gotoCase = 16; continue; };
- { gotoCase = 23; continue; };
+ { gotoCase = 22; continue; };
} else {
if (yych <= '\r') { gotoCase = 16; continue; };
- if (yych == '"') { gotoCase = 22; continue; };
- { gotoCase = 23; continue; };
+ if (yych == '>') { gotoCase = 16; continue; };
+ { gotoCase = 22; continue; };
}
/* *********************************** */
-case this.case_INITIAL:
+case this.case_DSTRING:
yych = this._charAt(cursor);
- if (yych <= '=') {
- if (yych <= '\'') {
- if (yych == '"') { gotoCase = 29; continue; };
- if (yych >= '\'') { gotoCase = 30; continue; };
- } else {
- if (yych <= '9') {
- if (yych >= '0') { gotoCase = 31; continue; };
- } else {
- if (yych <= ';') { gotoCase = 27; continue; };
- if (yych <= '<') { gotoCase = 33; continue; };
- { gotoCase = 35; continue; };
- }
- }
+ if (yych <= '\f') {
+ if (yych == '\n') { gotoCase = 28; continue; };
+ { gotoCase = 27; continue; };
} else {
- if (yych <= '^') {
- if (yych <= '>') { gotoCase = 37; continue; };
- if (yych <= '@') { gotoCase = 27; continue; };
- if (yych <= 'Z') { gotoCase = 31; continue; };
- } else {
- if (yych <= '`') {
- if (yych <= '_') { gotoCase = 31; continue; };
- } else {
- if (yych <= 'z') { gotoCase = 31; continue; };
- if (yych >= 0x80) { gotoCase = 31; continue; };
- }
- }
+ if (yych <= '\r') { gotoCase = 28; continue; };
+ if (yych == '"') { gotoCase = 30; continue; };
+ { gotoCase = 27; continue; };
}
+case 26:
+ { return this._stringToken(cursor); }
case 27:
- ++cursor;
+ yych = this._charAt(++cursor);
+ { gotoCase = 34; continue; };
case 28:
+ ++cursor;
{ this.tokenType = null; return cursor; }
-case 29:
- yyaccept = 0;
- yych = this._charAt(YYMARKER = ++cursor);
- { gotoCase = 82; continue; };
case 30:
- yyaccept = 0;
- yych = this._charAt(YYMARKER = ++cursor);
- { gotoCase = 76; continue; };
-case 31:
++cursor;
- yych = this._charAt(cursor);
- { gotoCase = 74; continue; };
+case 31:
+ this.setLexCondition(this._lexConditions.TAG);
+ { return this._stringToken(cursor, true); }
case 32:
- {
- if (this._parseCondition === this._parseConditions.SCRIPT) {
- this.tokenType = null;
- return cursor;
- }
-
- if (this._parseCondition === this._parseConditions.TAG) {
- this.tokenType = "html-tag";
- this._parseCondition = this._parseConditions.ATTRIBUTE;
- } else if (this._isAttribute())
- this.tokenType = "html-attr-name";
- else if (this._isAttributeValue())
- this.tokenType = "html-attr-value";
- else if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
- this.tokenType = null;
- return cursor;
- }
+ yych = this._charAt(++cursor);
+ { gotoCase = 31; continue; };
case 33:
- yyaccept = 1;
+ ++cursor;
+ yych = this._charAt(cursor);
+case 34:
+ if (yych <= '\f') {
+ if (yych == '\n') { gotoCase = 26; continue; };
+ { gotoCase = 33; continue; };
+ } else {
+ if (yych <= '\r') { gotoCase = 26; continue; };
+ if (yych == '"') { gotoCase = 32; continue; };
+ { gotoCase = 33; continue; };
+ }
+/* *********************************** */
+case this.case_INITIAL:
+ yych = this._charAt(cursor);
+ if (yych == '<') { gotoCase = 39; continue; };
+ ++cursor;
+ { this.tokenType = null; return cursor; }
+case 39:
+ yyaccept = 0;
yych = this._charAt(YYMARKER = ++cursor);
if (yych <= '/') {
- if (yych == '!') { gotoCase = 42; continue; };
- if (yych >= '/') { gotoCase = 39; continue; };
+ if (yych == '!') { gotoCase = 44; continue; };
+ if (yych >= '/') { gotoCase = 41; continue; };
} else {
if (yych <= 'S') {
- if (yych >= 'S') { gotoCase = 40; continue; };
+ if (yych >= 'S') { gotoCase = 42; continue; };
} else {
- if (yych == 's') { gotoCase = 40; continue; };
+ if (yych == 's') { gotoCase = 42; continue; };
}
}
-case 34:
+case 40:
+ this.setLexCondition(this._lexConditions.TAG);
{
- if (this._parseCondition === this._parseConditions.SCRIPT) {
+ if (this._parseCondition & this._parseConditions.SCRIPT) {
+ // Do not tokenize script tag contents, keep lexer state although processing "<".
+ this.setLexCondition(this._lexConditions.INITIAL);
this.tokenType = null;
return cursor;
}
+ this._parseCondition = this._parseConditions.INITIAL;
this.tokenType = "html-tag";
- this._parseCondition = this._parseConditions.TAG;
- return cursor;
- }
-case 35:
- ++cursor;
- {
- if (this._isAttribute()) {
- this.tokenType = null;
- this._setAttributeValue();
- } else if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
- this.tokenType = null;
- return cursor;
- }
-case 37:
- ++cursor;
- {
- if (this._parseCondition === this._parseConditions.SCRIPT) {
- this.tokenType = null;
- return cursor;
- }
-
- if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
- this.tokenType = "html-tag";
-
- if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE)
- this._parseCondition = this._parseConditions.SCRIPT;
- else
- this._parseCondition = this._parseConditions.INITIAL;
return cursor;
}
-case 39:
- yyaccept = 1;
+case 41:
+ yyaccept = 0;
yych = this._charAt(YYMARKER = ++cursor);
- if (yych == 'S') { gotoCase = 66; continue; };
- if (yych == 's') { gotoCase = 66; continue; };
- { gotoCase = 34; continue; };
-case 40:
+ if (yych == 'S') { gotoCase = 68; continue; };
+ if (yych == 's') { gotoCase = 68; continue; };
+ { gotoCase = 40; continue; };
+case 42:
yych = this._charAt(++cursor);
- if (yych == 'C') { gotoCase = 60; continue; };
- if (yych == 'c') { gotoCase = 60; continue; };
-case 41:
+ if (yych == 'C') { gotoCase = 62; continue; };
+ if (yych == 'c') { gotoCase = 62; continue; };
+case 43:
cursor = YYMARKER;
- if (yyaccept <= 0) {
- { gotoCase = 28; continue; };
- } else {
- { gotoCase = 34; continue; };
- }
-case 42:
+ { gotoCase = 40; continue; };
+case 44:
yych = this._charAt(++cursor);
if (yych <= 'C') {
- if (yych != '-') { gotoCase = 41; continue; };
+ if (yych != '-') { gotoCase = 43; continue; };
} else {
- if (yych <= 'D') { gotoCase = 44; continue; };
- if (yych == 'd') { gotoCase = 44; continue; };
- { gotoCase = 41; continue; };
+ if (yych <= 'D') { gotoCase = 46; continue; };
+ if (yych == 'd') { gotoCase = 46; continue; };
+ { gotoCase = 43; continue; };
}
yych = this._charAt(++cursor);
- if (yych == '-') { gotoCase = 52; continue; };
- { gotoCase = 41; continue; };
-case 44:
- yych = this._charAt(++cursor);
- if (yych == 'O') { gotoCase = 45; continue; };
- if (yych != 'o') { gotoCase = 41; continue; };
-case 45:
- yych = this._charAt(++cursor);
- if (yych == 'C') { gotoCase = 46; continue; };
- if (yych != 'c') { gotoCase = 41; continue; };
+ if (yych == '-') { gotoCase = 54; continue; };
+ { gotoCase = 43; continue; };
case 46:
yych = this._charAt(++cursor);
- if (yych == 'T') { gotoCase = 47; continue; };
- if (yych != 't') { gotoCase = 41; continue; };
+ if (yych == 'O') { gotoCase = 47; continue; };
+ if (yych != 'o') { gotoCase = 43; continue; };
case 47:
yych = this._charAt(++cursor);
- if (yych == 'Y') { gotoCase = 48; continue; };
- if (yych != 'y') { gotoCase = 41; continue; };
+ if (yych == 'C') { gotoCase = 48; continue; };
+ if (yych != 'c') { gotoCase = 43; continue; };
case 48:
yych = this._charAt(++cursor);
- if (yych == 'P') { gotoCase = 49; continue; };
- if (yych != 'p') { gotoCase = 41; continue; };
+ if (yych == 'T') { gotoCase = 49; continue; };
+ if (yych != 't') { gotoCase = 43; continue; };
case 49:
yych = this._charAt(++cursor);
- if (yych == 'E') { gotoCase = 50; continue; };
- if (yych != 'e') { gotoCase = 41; continue; };
+ if (yych == 'Y') { gotoCase = 50; continue; };
+ if (yych != 'y') { gotoCase = 43; continue; };
case 50:
- ++cursor;
- {
- this.tokenType = "html-doctype";
- this._parseCondition = this._parseConditions.DOCTYPE;
- return cursor;
- }
+ yych = this._charAt(++cursor);
+ if (yych == 'P') { gotoCase = 51; continue; };
+ if (yych != 'p') { gotoCase = 43; continue; };
+case 51:
+ yych = this._charAt(++cursor);
+ if (yych == 'E') { gotoCase = 52; continue; };
+ if (yych != 'e') { gotoCase = 43; continue; };
case 52:
++cursor;
+ this.setLexCondition(this._lexConditions.DOCTYPE);
+ { this.tokenType = "html-doctype"; return cursor; }
+case 54:
+ ++cursor;
yych = this._charAt(cursor);
if (yych <= '\f') {
- if (yych == '\n') { gotoCase = 55; continue; };
- { gotoCase = 52; continue; };
+ if (yych == '\n') { gotoCase = 57; continue; };
+ { gotoCase = 54; continue; };
} else {
- if (yych <= '\r') { gotoCase = 55; continue; };
- if (yych != '-') { gotoCase = 52; continue; };
+ if (yych <= '\r') { gotoCase = 57; continue; };
+ if (yych != '-') { gotoCase = 54; continue; };
}
++cursor;
yych = this._charAt(cursor);
- if (yych == '-') { gotoCase = 57; continue; };
- { gotoCase = 41; continue; };
-case 55:
+ if (yych == '-') { gotoCase = 59; continue; };
+ { gotoCase = 43; continue; };
+case 57:
++cursor;
this.setLexCondition(this._lexConditions.COMMENT);
{ this.tokenType = "html-comment"; return cursor; }
-case 57:
+case 59:
++cursor;
yych = this._charAt(cursor);
- if (yych != '>') { gotoCase = 52; continue; };
+ if (yych != '>') { gotoCase = 54; continue; };
++cursor;
{ this.tokenType = "html-comment"; return cursor; }
-case 60:
- yych = this._charAt(++cursor);
- if (yych == 'R') { gotoCase = 61; continue; };
- if (yych != 'r') { gotoCase = 41; continue; };
-case 61:
- yych = this._charAt(++cursor);
- if (yych == 'I') { gotoCase = 62; continue; };
- if (yych != 'i') { gotoCase = 41; continue; };
case 62:
yych = this._charAt(++cursor);
- if (yych == 'P') { gotoCase = 63; continue; };
- if (yych != 'p') { gotoCase = 41; continue; };
+ if (yych == 'R') { gotoCase = 63; continue; };
+ if (yych != 'r') { gotoCase = 43; continue; };
case 63:
yych = this._charAt(++cursor);
- if (yych == 'T') { gotoCase = 64; continue; };
- if (yych != 't') { gotoCase = 41; continue; };
+ if (yych == 'I') { gotoCase = 64; continue; };
+ if (yych != 'i') { gotoCase = 43; continue; };
case 64:
+ yych = this._charAt(++cursor);
+ if (yych == 'P') { gotoCase = 65; continue; };
+ if (yych != 'p') { gotoCase = 43; continue; };
+case 65:
+ yych = this._charAt(++cursor);
+ if (yych == 'T') { gotoCase = 66; continue; };
+ if (yych != 't') { gotoCase = 43; continue; };
+case 66:
++cursor;
+ this.setLexCondition(this._lexConditions.TAG);
{
this.tokenType = "html-tag";
- this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE;
+ this._parseCondition = this._parseConditions.SCRIPT;
+ this._setExpectingAttribute();
return cursor;
}
-case 66:
- yych = this._charAt(++cursor);
- if (yych == 'C') { gotoCase = 67; continue; };
- if (yych != 'c') { gotoCase = 41; continue; };
-case 67:
- yych = this._charAt(++cursor);
- if (yych == 'R') { gotoCase = 68; continue; };
- if (yych != 'r') { gotoCase = 41; continue; };
case 68:
yych = this._charAt(++cursor);
- if (yych == 'I') { gotoCase = 69; continue; };
- if (yych != 'i') { gotoCase = 41; continue; };
+ if (yych == 'C') { gotoCase = 69; continue; };
+ if (yych != 'c') { gotoCase = 43; continue; };
case 69:
yych = this._charAt(++cursor);
- if (yych == 'P') { gotoCase = 70; continue; };
- if (yych != 'p') { gotoCase = 41; continue; };
+ if (yych == 'R') { gotoCase = 70; continue; };
+ if (yych != 'r') { gotoCase = 43; continue; };
case 70:
yych = this._charAt(++cursor);
- if (yych == 'T') { gotoCase = 71; continue; };
- if (yych != 't') { gotoCase = 41; continue; };
+ if (yych == 'I') { gotoCase = 71; continue; };
+ if (yych != 'i') { gotoCase = 43; continue; };
case 71:
+ yych = this._charAt(++cursor);
+ if (yych == 'P') { gotoCase = 72; continue; };
+ if (yych != 'p') { gotoCase = 43; continue; };
+case 72:
+ yych = this._charAt(++cursor);
+ if (yych == 'T') { gotoCase = 73; continue; };
+ if (yych != 't') { gotoCase = 43; continue; };
+case 73:
++cursor;
+ this.setLexCondition(this._lexConditions.TAG);
{
this.tokenType = "html-tag";
this._parseCondition = this._parseConditions.INITIAL;
return cursor;
}
-case 73:
+/* *********************************** */
+case this.case_SSTRING:
+ yych = this._charAt(cursor);
+ if (yych <= '\f') {
+ if (yych == '\n') { gotoCase = 79; continue; };
+ { gotoCase = 78; continue; };
+ } else {
+ if (yych <= '\r') { gotoCase = 79; continue; };
+ if (yych == '\'') { gotoCase = 81; continue; };
+ { gotoCase = 78; continue; };
+ }
+case 77:
+ { return this._stringToken(cursor); }
+case 78:
+ yych = this._charAt(++cursor);
+ { gotoCase = 85; continue; };
+case 79:
+ ++cursor;
+ { this.tokenType = null; return cursor; }
+case 81:
+ ++cursor;
+case 82:
+ this.setLexCondition(this._lexConditions.TAG);
+ { return this._stringToken(cursor, true); }
+case 83:
+ yych = this._charAt(++cursor);
+ { gotoCase = 82; continue; };
+case 84:
++cursor;
yych = this._charAt(cursor);
-case 74:
- if (yych <= '^') {
- if (yych <= '9') {
- if (yych <= '/') { gotoCase = 32; continue; };
- { gotoCase = 73; continue; };
+case 85:
+ if (yych <= '\f') {
+ if (yych == '\n') { gotoCase = 77; continue; };
+ { gotoCase = 84; continue; };
+ } else {
+ if (yych <= '\r') { gotoCase = 77; continue; };
+ if (yych == '\'') { gotoCase = 83; continue; };
+ { gotoCase = 84; continue; };
+ }
+/* *********************************** */
+case this.case_TAG:
+ yych = this._charAt(cursor);
+ if (yych <= '&') {
+ if (yych <= '\r') {
+ if (yych == '\n') { gotoCase = 90; continue; };
+ if (yych >= '\r') { gotoCase = 90; continue; };
} else {
- if (yych <= '@') { gotoCase = 32; continue; };
- if (yych <= 'Z') { gotoCase = 73; continue; };
- { gotoCase = 32; continue; };
+ if (yych <= ' ') {
+ if (yych >= ' ') { gotoCase = 90; continue; };
+ } else {
+ if (yych == '"') { gotoCase = 92; continue; };
+ }
}
} else {
- if (yych <= '`') {
- if (yych <= '_') { gotoCase = 73; continue; };
- { gotoCase = 32; continue; };
+ if (yych <= '>') {
+ if (yych <= ';') {
+ if (yych <= '\'') { gotoCase = 93; continue; };
+ } else {
+ if (yych <= '<') { gotoCase = 90; continue; };
+ if (yych <= '=') { gotoCase = 94; continue; };
+ { gotoCase = 96; continue; };
+ }
} else {
- if (yych <= 'z') { gotoCase = 73; continue; };
- if (yych <= 0x7F) { gotoCase = 32; continue; };
- { gotoCase = 73; continue; };
+ if (yych <= '[') {
+ if (yych >= '[') { gotoCase = 90; continue; };
+ } else {
+ if (yych == ']') { gotoCase = 90; continue; };
+ }
}
}
-case 75:
++cursor;
yych = this._charAt(cursor);
-case 76:
+ { gotoCase = 109; continue; };
+case 89:
+ {
+ if (this._parseCondition === this._parseConditions.SCRIPT) {
+ // Fall through if expecting attributes.
+ this.tokenType = null;
+ return cursor;
+ }
+
+ if (this._parseCondition === this._parseConditions.INITIAL) {
+ this.tokenType = "html-tag";
+ this._setExpectingAttribute();
+ var token = this._line.substring(cursorOnEnter, cursor);
+ if (token === "a")
+ this._parseCondition |= this._parseConditions.A_NODE;
+ else if (this._parseCondition & this._parseConditions.A_NODE)
+ this._parseCondition ^= this._parseConditions.A_NODE;
+ } else if (this._isExpectingAttribute()) {
+ var token = this._line.substring(cursorOnEnter, cursor);
+ if (token === "href" || token === "src")
+ this._parseCondition |= this._parseConditions.LINKIFY;
+ else if (this._parseCondition |= this._parseConditions.LINKIFY)
+ this._parseCondition ^= this._parseConditions.LINKIFY;
+ this.tokenType = "html-attribute-name";
+ } else if (this._isExpectingAttributeValue())
+ this.tokenType = this._attrValueTokenType();
+ else
+ this.tokenType = null;
+ return cursor;
+ }
+case 90:
+ ++cursor;
+ { this.tokenType = null; return cursor; }
+case 92:
+ yyaccept = 0;
+ yych = this._charAt(YYMARKER = ++cursor);
+ { gotoCase = 105; continue; };
+case 93:
+ yyaccept = 0;
+ yych = this._charAt(YYMARKER = ++cursor);
+ { gotoCase = 99; continue; };
+case 94:
+ ++cursor;
+ {
+ if (this._isExpectingAttribute())
+ this._setExpectingAttributeValue();
+ this.tokenType = null;
+ return cursor;
+ }
+case 96:
+ ++cursor;
+ this.setLexCondition(this._lexConditions.INITIAL);
+ {
+ if (this._parseCondition & this._parseConditions.SCRIPT) {
+ // Do not tokenize script tag contents.
+ this.tokenType = null;
+ return cursor;
+ }
+
+ this._parseCondition = this._parseConditions.INITIAL;
+ this.tokenType = "html-tag";
+ return cursor;
+ }
+case 98:
+ ++cursor;
+ yych = this._charAt(cursor);
+case 99:
if (yych <= '\f') {
- if (yych != '\n') { gotoCase = 75; continue; };
+ if (yych != '\n') { gotoCase = 98; continue; };
} else {
- if (yych <= '\r') { gotoCase = 77; continue; };
- if (yych == '\'') { gotoCase = 79; continue; };
- { gotoCase = 75; continue; };
+ if (yych <= '\r') { gotoCase = 100; continue; };
+ if (yych == '\'') { gotoCase = 102; continue; };
+ { gotoCase = 98; continue; };
}
-case 77:
+case 100:
++cursor;
this.setLexCondition(this._lexConditions.SSTRING);
{ return this._stringToken(cursor); }
-case 79:
+case 102:
++cursor;
{ return this._stringToken(cursor, true); }
-case 81:
+case 104:
++cursor;
yych = this._charAt(cursor);
-case 82:
+case 105:
if (yych <= '\f') {
- if (yych != '\n') { gotoCase = 81; continue; };
+ if (yych != '\n') { gotoCase = 104; continue; };
} else {
- if (yych <= '\r') { gotoCase = 83; continue; };
- if (yych == '"') { gotoCase = 79; continue; };
- { gotoCase = 81; continue; };
+ if (yych <= '\r') { gotoCase = 106; continue; };
+ if (yych == '"') { gotoCase = 102; continue; };
+ { gotoCase = 104; continue; };
}
-case 83:
+case 106:
++cursor;
this.setLexCondition(this._lexConditions.DSTRING);
{ return this._stringToken(cursor); }
-/* *********************************** */
-case this.case_SSTRING:
- yych = this._charAt(cursor);
- if (yych <= '\f') {
- if (yych == '\n') { gotoCase = 89; continue; };
- { gotoCase = 88; continue; };
- } else {
- if (yych <= '\r') { gotoCase = 89; continue; };
- if (yych == '\'') { gotoCase = 91; continue; };
- { gotoCase = 88; continue; };
- }
-case 87:
- { return this._stringToken(cursor); }
-case 88:
- yych = this._charAt(++cursor);
- { gotoCase = 95; continue; };
-case 89:
- ++cursor;
- { this.tokenType = null; return cursor; }
-case 91:
- ++cursor;
-case 92:
- this.setLexCondition(this._lexConditions.INITIAL);
- { return this._stringToken(cursor, true); }
-case 93:
- yych = this._charAt(++cursor);
- { gotoCase = 92; continue; };
-case 94:
+case 108:
++cursor;
yych = this._charAt(cursor);
-case 95:
- if (yych <= '\f') {
- if (yych == '\n') { gotoCase = 87; continue; };
- { gotoCase = 94; continue; };
+case 109:
+ if (yych <= '"') {
+ if (yych <= '\r') {
+ if (yych == '\n') { gotoCase = 89; continue; };
+ if (yych <= '\f') { gotoCase = 108; continue; };
+ { gotoCase = 89; continue; };
+ } else {
+ if (yych == ' ') { gotoCase = 89; continue; };
+ if (yych <= '!') { gotoCase = 108; continue; };
+ { gotoCase = 89; continue; };
+ }
} else {
- if (yych <= '\r') { gotoCase = 87; continue; };
- if (yych == '\'') { gotoCase = 93; continue; };
- { gotoCase = 94; continue; };
+ if (yych <= '>') {
+ if (yych == '\'') { gotoCase = 89; continue; };
+ if (yych <= ';') { gotoCase = 108; continue; };
+ { gotoCase = 89; continue; };
+ } else {
+ if (yych <= '[') {
+ if (yych <= 'Z') { gotoCase = 108; continue; };
+ { gotoCase = 89; continue; };
+ } else {
+ if (yych == ']') { gotoCase = 89; continue; };
+ { gotoCase = 108; continue; };
+ }
+ }
}
}
diff --git a/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js b/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
index e56f3ff..89c535a 100644
--- a/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
+++ b/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js
@@ -44,72 +44,81 @@ WebInspector.SourceHTMLTokenizer = function()
{
WebInspector.SourceTokenizer.call(this);
+ // The order is determined by the generated code.
this._lexConditions = {
INITIAL: 0,
COMMENT: 1,
- DSTRING: 2,
- SSTRING: 3
+ DOCTYPE: 2,
+ TAG: 3,
+ DSTRING: 4,
+ SSTRING: 5
};
+ this.case_INITIAL = 1000;
+ this.case_COMMENT = 1001;
+ this.case_DOCTYPE = 1002;
+ this.case_TAG = 1003;
+ this.case_DSTRING = 1004;
+ this.case_SSTRING = 1005;
this._parseConditions = {
INITIAL: 0,
- TAG: 1,
- ATTRIBUTE: 2,
- ATTRIBUTE_VALUE: 3,
- SCRIPT: 4,
- SCRIPT_ATTRIBUTE: 5,
- SCRIPT_ATTRIBUTE_VALUE: 6,
- DOCTYPE: 7
+ ATTRIBUTE: 1,
+ ATTRIBUTE_VALUE: 2,
+ LINKIFY: 4,
+ A_NODE: 8,
+ SCRIPT: 16
};
- this.case_INITIAL = 1000;
- this.case_COMMENT = 1001;
- this.case_DSTRING = 1002;
- this.case_SSTRING = 1003;
-
this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
}
WebInspector.SourceHTMLTokenizer.prototype = {
- _isAttribute: function()
+ _isExpectingAttribute: function()
{
- return this._parseCondition === this._parseConditions.ATTRIBUTE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE;
+ return this._parseCondition & this._parseConditions.ATTRIBUTE;
},
- _isAttributeValue: function()
+ _isExpectingAttributeValue: function()
{
- return this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE;
+ return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
},
- _setAttributeValue: function()
+ _setExpectingAttribute: function()
{
- if (this._parseCondition === this._parseConditions.ATTRIBUTE)
- this._parseCondition = this._parseConditions.ATTRIBUTE_VALUE;
- else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE)
- this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE_VALUE;
+ if (this._isExpectingAttributeValue())
+ this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
+ this._parseCondition |= this._parseConditions.ATTRIBUTE;
},
- _setAttribute: function()
+ _setExpectingAttributeValue: function()
{
- if (this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE)
- this._parseCondition = this._parseConditions.ATTRIBUTE;
- else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE)
- this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE;
+ if (this._isExpectingAttribute())
+ this._parseCondition ^= this._parseConditions.ATTRIBUTE;
+ this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
},
_stringToken: function(cursor, stringEnds)
{
- if (this._isAttributeValue()) {
- this.tokenType = "html-attr-value";
- if (stringEnds)
- this._setAttribute();
- } else if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
+ if (!this._isExpectingAttributeValue()) {
this.tokenType = null;
+ return cursor;
+ }
+ this.tokenType = this._attrValueTokenType();
+ if (stringEnds)
+ this._setExpectingAttribute();
return cursor;
},
+ _attrValueTokenType: function()
+ {
+ if (this._parseCondition & this._parseConditions.LINKIFY) {
+ if (this._parseCondition & this._parseConditions.A_NODE)
+ return "html-external-link";
+ return "html-resource-link";
+ }
+ return "html-attribute-value";
+ },
+
nextToken: function(cursor)
{
var cursorOnEnter = cursor;
@@ -134,7 +143,9 @@ WebInspector.SourceHTMLTokenizer.prototype = {
CommentStart = "<!--" CommentContent [\r\n];
CommentEnd = CommentContent "-->";
- DocTypeLT = "<!" [Dd] [Oo] [Cc] [Tt] [Yy] [Pp] [Ee];
+ DocTypeStart = "<!" [Dd] [Oo] [Cc] [Tt] [Yy] [Pp] [Ee];
+ DocTypeContent = [^\r\n>]*;
+
ScriptStart = "<" [Ss] [Cc] [Rr] [Ii] [Pp] [Tt];
ScriptEnd = "</" [Ss] [Cc] [Rr] [Ii] [Pp] [Tt];
@@ -150,101 +161,100 @@ WebInspector.SourceHTMLTokenizer.prototype = {
SingleStringStart = "'" SingleStringContent [\r\n];
SingleStringEnd = SingleStringContent "'";
- Identifier = [_a-zA-Z0-9\x80-\xFF]+;
+ Identifier = [^ \r\n"'<>\[\]=]+;
<INITIAL> Comment { this.tokenType = "html-comment"; return cursor; }
<INITIAL> CommentStart => COMMENT { this.tokenType = "html-comment"; return cursor; }
<COMMENT> CommentContent => COMMENT { this.tokenType = "html-comment"; return cursor; }
<COMMENT> CommentEnd => INITIAL { this.tokenType = "html-comment"; return cursor; }
- <INITIAL> DocTypeLT => INITIAL
- {
- this.tokenType = "html-doctype";
- this._parseCondition = this._parseConditions.DOCTYPE;
- return cursor;
- }
+ <INITIAL> DocTypeStart => DOCTYPE { this.tokenType = "html-doctype"; return cursor; }
+ <DOCTYPE> DocTypeContent => DOCTYPE { this.tokenType = "html-doctype"; return cursor; }
+ <DOCTYPE> GT => INITIAL { this.tokenType = "html-doctype"; return cursor; }
- <INITIAL> ScriptStart => INITIAL
+ <INITIAL> ScriptStart => TAG
{
this.tokenType = "html-tag";
- this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE;
+ this._parseCondition = this._parseConditions.SCRIPT;
+ this._setExpectingAttribute();
return cursor;
}
- <INITIAL> ScriptEnd => INITIAL
+ <INITIAL> ScriptEnd => TAG
{
this.tokenType = "html-tag";
this._parseCondition = this._parseConditions.INITIAL;
return cursor;
}
- <INITIAL> LT => INITIAL
+ <INITIAL> LT => TAG
{
- if (this._parseCondition === this._parseConditions.SCRIPT) {
+ if (this._parseCondition & this._parseConditions.SCRIPT) {
+ // Do not tokenize script tag contents, keep lexer state although processing "<".
+ this.setLexCondition(this._lexConditions.INITIAL);
this.tokenType = null;
return cursor;
}
+ this._parseCondition = this._parseConditions.INITIAL;
this.tokenType = "html-tag";
- this._parseCondition = this._parseConditions.TAG;
return cursor;
}
- <INITIAL> GT => INITIAL
+ <TAG> GT => INITIAL
{
- if (this._parseCondition === this._parseConditions.SCRIPT) {
+ if (this._parseCondition & this._parseConditions.SCRIPT) {
+ // Do not tokenize script tag contents.
this.tokenType = null;
return cursor;
}
- if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
- this.tokenType = "html-tag";
-
- if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE)
- this._parseCondition = this._parseConditions.SCRIPT;
- else
- this._parseCondition = this._parseConditions.INITIAL;
+ this._parseCondition = this._parseConditions.INITIAL;
+ this.tokenType = "html-tag";
return cursor;
}
- <INITIAL> StringLiteral { return this._stringToken(cursor, true); }
- <INITIAL> DoubleStringStart => DSTRING { return this._stringToken(cursor); }
+ <TAG> StringLiteral { return this._stringToken(cursor, true); }
+ <TAG> DoubleStringStart => DSTRING { return this._stringToken(cursor); }
<DSTRING> DoubleStringContent => DSTRING { return this._stringToken(cursor); }
- <DSTRING> DoubleStringEnd => INITIAL { return this._stringToken(cursor, true); }
- <INITIAL> SingleStringStart => SSTRING { return this._stringToken(cursor); }
+ <DSTRING> DoubleStringEnd => TAG { return this._stringToken(cursor, true); }
+ <TAG> SingleStringStart => SSTRING { return this._stringToken(cursor); }
<SSTRING> SingleStringContent => SSTRING { return this._stringToken(cursor); }
- <SSTRING> SingleStringEnd => INITIAL { return this._stringToken(cursor, true); }
+ <SSTRING> SingleStringEnd => TAG { return this._stringToken(cursor, true); }
- <INITIAL> EqualSign => INITIAL
+ <TAG> EqualSign => TAG
{
- if (this._isAttribute()) {
- this.tokenType = null;
- this._setAttributeValue();
- } else if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
- else
- this.tokenType = null;
+ if (this._isExpectingAttribute())
+ this._setExpectingAttributeValue();
+ this.tokenType = null;
return cursor;
}
- <INITIAL> Identifier
+ <TAG> Identifier
{
if (this._parseCondition === this._parseConditions.SCRIPT) {
+ // Fall through if expecting attributes.
this.tokenType = null;
return cursor;
}
- if (this._parseCondition === this._parseConditions.TAG) {
+ if (this._parseCondition === this._parseConditions.INITIAL) {
this.tokenType = "html-tag";
- this._parseCondition = this._parseConditions.ATTRIBUTE;
- } else if (this._isAttribute())
- this.tokenType = "html-attr-name";
- else if (this._isAttributeValue())
- this.tokenType = "html-attr-value";
- else if (this._parseCondition === this._parseConditions.DOCTYPE)
- this.tokenType = "html-doctype";
+ this._setExpectingAttribute();
+ var token = this._line.substring(cursorOnEnter, cursor);
+ if (token === "a")
+ this._parseCondition |= this._parseConditions.A_NODE;
+ else if (this._parseCondition & this._parseConditions.A_NODE)
+ this._parseCondition ^= this._parseConditions.A_NODE;
+ } else if (this._isExpectingAttribute()) {
+ var token = this._line.substring(cursorOnEnter, cursor);
+ if (token === "href" || token === "src")
+ this._parseCondition |= this._parseConditions.LINKIFY;
+ else if (this._parseCondition |= this._parseConditions.LINKIFY)
+ this._parseCondition ^= this._parseConditions.LINKIFY;
+ this.tokenType = "html-attribute-name";
+ } else if (this._isExpectingAttributeValue())
+ this.tokenType = this._attrValueTokenType();
else
this.tokenType = null;
return cursor;
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index 292b8af..7fc8499 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -41,7 +41,6 @@ WebInspector.SourceView.prototype = {
show: function(parentElement)
{
WebInspector.ResourceView.prototype.show.call(this, parentElement);
- this.setupSourceFrameIfNeeded();
this.sourceFrame.visible = true;
this.resize();
},
@@ -79,10 +78,15 @@ WebInspector.SourceView.prototype = {
delete this._frameNeedsSetup;
WebInspector.getResourceContent(this.resource.identifier, this._contentLoaded.bind(this));
},
-
+
+ contentTabSelected: function()
+ {
+ this.setupSourceFrameIfNeeded();
+ },
+
_contentLoaded: function(content)
{
- this.sourceFrame.setContent(this.resource.mimeType, content);
+ this.sourceFrame.setContent(this.resource.mimeType, content, this.resource.url);
this._sourceFrameSetupFinished();
},
diff --git a/WebCore/inspector/front-end/TextEditor.js b/WebCore/inspector/front-end/TextEditor.js
index afa97c1..9268280 100644
--- a/WebCore/inspector/front-end/TextEditor.js
+++ b/WebCore/inspector/front-end/TextEditor.js
@@ -35,7 +35,8 @@ WebInspector.TextEditor = function(textModel, platform)
this._highlighter = new WebInspector.TextEditorHighlighter(this._textModel, this._highlightChanged.bind(this));
this.element = document.createElement("div");
- this.element.className = "text-editor";
+ this.element.className = "text-editor monospace";
+ this.element.tabIndex = 0;
this._canvas = document.createElement("canvas");
this._canvas.className = "text-editor-canvas";
@@ -43,7 +44,6 @@ WebInspector.TextEditor = function(textModel, platform)
this._container = document.createElement("div");
this._container.className = "text-editor-container";
- this._container.tabIndex = 0;
this.element.appendChild(this._container);
this._sheet = document.createElement("div");
@@ -55,7 +55,6 @@ WebInspector.TextEditor = function(textModel, platform)
this._cursor = new WebInspector.TextCursor(cursorElement);
this._container.addEventListener("scroll", this._scroll.bind(this), false);
- this._sheet.addEventListener("contextmenu", this._contextMenu.bind(this), false);
this._registerMouseListeners();
this._registerKeyboardListeners();
@@ -69,9 +68,6 @@ WebInspector.TextEditor = function(textModel, platform)
this._selection = new WebInspector.TextSelectionModel(this._selectionChanged.bind(this));
this._isMac = platform && (platform.indexOf("mac") === 0);
-
- this._initFont();
-
this._paintCoalescingLevel = 0;
this._registerShortcuts();
@@ -84,6 +80,7 @@ WebInspector.TextEditor = function(textModel, platform)
this._lineOffsetsCache = [0];
this._readOnly = false;
+ this._selectionColor = "rgb(181, 213, 255)";
}
WebInspector.TextEditor.prototype = {
@@ -152,11 +149,12 @@ WebInspector.TextEditor.prototype = {
_registerMouseListeners: function()
{
- this._sheet.addEventListener("mouseup", this._mouseUp.bind(this), false);
- this._sheet.addEventListener("mousedown", this._mouseDown.bind(this), false);
- this._sheet.addEventListener("mousemove", this._mouseMove.bind(this), false);
- this._sheet.addEventListener("mouseout", this._mouseOut.bind(this), false);
- this._sheet.addEventListener("dblclick", this._dblClick.bind(this), false);
+ this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false);
+ this.element.addEventListener("mouseup", this._mouseUp.bind(this), false);
+ this.element.addEventListener("mousedown", this._mouseDown.bind(this), false);
+ this.element.addEventListener("mousemove", this._mouseMove.bind(this), false);
+ this.element.addEventListener("mouseout", this._mouseOut.bind(this), false);
+ this.element.addEventListener("dblclick", this._dblClick.bind(this), false);
},
_registerKeyboardListeners: function()
@@ -180,7 +178,7 @@ WebInspector.TextEditor.prototype = {
if (offset > this._lineOffsetsCache[this._lineOffsetsCache.length - 1]) {
// Seeking outside cached area. Fill the cache.
var lineNumber = this._lineOffsetsCache.length;
- while (this._lineToOffset(lineNumber) < offset)
+ while (lineNumber < this._textModel.linesCount && this._lineToOffset(lineNumber) < offset)
lineNumber++;
return lineNumber;
}
@@ -217,6 +215,10 @@ WebInspector.TextEditor.prototype = {
_lineHeight: function(lineNumber)
{
+ // Use cached value first.
+ if (this._lineOffsetsCache[lineNumber + 1])
+ return this._lineOffsetsCache[lineNumber + 1] - this._lineOffsetsCache[lineNumber];
+
var element = this._textModel.getAttribute(lineNumber, "div-decoration");
if (element)
return 2 * this._textLineHeight + element.clientHeight;
@@ -225,6 +227,9 @@ WebInspector.TextEditor.prototype = {
reveal: function(line, column)
{
+ this._scrollTop = this._container.scrollTop;
+ this._scrollLeft = this._container.scrollLeft;
+
var maxScrollTop = this._lineToOffset(line);
var minScrollTop = maxScrollTop + this._lineHeight(line) - this._canvas.height;
if (this._scrollTop > maxScrollTop)
@@ -237,8 +242,10 @@ WebInspector.TextEditor.prototype = {
var minScrollLeft = maxScrollLeft - this._container.clientWidth + this._lineNumberWidth;
if (this._scrollLeft < minScrollLeft)
this._container.scrollLeft = minScrollLeft + 100;
- if (this._scrollLeft > maxScrollLeft)
+ else if (this._scrollLeft > maxScrollLeft)
this._container.scrollLeft = maxScrollLeft;
+ else if (minScrollLeft < 0 && maxScrollLeft > 0)
+ this._container.scrollLeft = 0;
},
// WebInspector.TextModel listener
@@ -326,8 +333,9 @@ WebInspector.TextEditor.prototype = {
var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount);
this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth;
+ this._container.style.left = this._lineNumberWidth + "px";
- var newWidth = this._textWidth + this._lineNumberWidth + "px";
+ var newWidth = this._textWidth + "px";
var newHeight = this._lineToOffset(this._textModel.linesCount) + "px";
this._sheet.style.width = newWidth;
this._sheet.style.height = newHeight;
@@ -345,7 +353,7 @@ WebInspector.TextEditor.prototype = {
resize: function()
{
if (this._canvas.width !== this._container.clientWidth || this._canvas.height !== this._container.clientHeight) {
- this._canvas.width = this._container.clientWidth;
+ this._canvas.width = this._container.clientWidth + this._lineNumberWidth;
this._canvas.height = this._container.clientHeight;
this.repaintAll();
}
@@ -376,16 +384,20 @@ WebInspector.TextEditor.prototype = {
_paint: function()
{
+ this._scrollTop = this._container.scrollTop;
+ this._scrollLeft = this._container.scrollLeft;
+
if (this._paintCoalescingLevel)
return;
+ this._updateDivDecorations();
+
this.paintLineNumbers();
for (var i = 0; this._damage && i < this._damage.length; ++i)
this._paintLines(this._damage[i].startLine, this._damage[i].endLine);
delete this._damage;
- this._updateDivDecorations();
this._updateCursor(this._selection.endLine, this._selection.endColumn);
},
@@ -556,7 +568,7 @@ WebInspector.TextEditor.prototype = {
var location = this._caretForMouseEvent(e);
- if (e.offsetX < this._lineNumberWidth && this._lineNumberDecorator) {
+ if (e.target === this.element && this._lineNumberDecorator) {
if (this._lineNumberDecorator.mouseDown(location.line, e))
return;
}
@@ -590,7 +602,7 @@ WebInspector.TextEditor.prototype = {
_contextMenu: function(e)
{
- if (e.offsetX < this._lineNumberWidth && this._lineNumberDecorator) {
+ if (e.target === this.element && this._lineNumberDecorator) {
var location = this._caretForMouseEvent(e);
if (this._lineNumberDecorator.contextMenu(location.line, e))
return;
@@ -607,8 +619,8 @@ WebInspector.TextEditor.prototype = {
_caretForMouseEvent: function(e)
{
- var lineNumber = Math.max(0, this._offsetToLine(e.offsetY) - 1);
- var offset = e.offsetX + this._scrollLeft - this._lineNumberWidth;
+ var lineNumber = Math.max(0, this._offsetToLine(e.offsetY + (e.target === this.element ? this._scrollTop : 0)) - 1);
+ var offset = e.offsetX + this._scrollLeft;
return { line: lineNumber, column: this._columnForOffset(lineNumber, offset) };
},
@@ -811,8 +823,10 @@ WebInspector.TextEditor.prototype = {
var linesCount = this._textModel.linesCount;
for (var i = 0; i < linesCount; ++i) {
var element = this._textModel.getAttribute(i, "div-decoration");
- if (element)
+ if (element) {
+ this._lineOffsetsCache.length = Math.min(this._lineOffsetsCache.length, i + 1);
this._positionDivDecoration(i, element, i > firstLine && i < lastLine);
+ }
}
},
@@ -848,7 +862,7 @@ WebInspector.TextEditor.prototype = {
if (this._selection.isEmpty())
return;
var range = this._selection.range();
- this._ctx.fillStyle = "rgb(181, 213, 255)";
+ this._ctx.fillStyle = this._selectionColor;
firstLine = Math.max(firstLine, range.startLine);
endLine = Math.min(lastLine, range.endLine + 1);
@@ -962,34 +976,14 @@ WebInspector.TextEditor.prototype = {
this._updateCursor(this._selection.endLine, this._selection.endColumn);
},
- _initFont: function(sansSerif)
+ initFontMetrics: function()
{
- if (!WebInspector.TextEditor.PlatformFonts) {
- WebInspector.TextEditor.PlatformFonts = {};
- WebInspector.TextEditor.PlatformFonts[WebInspector.OS.Windows] = {size: 12, face: "Lucida Console"};
- WebInspector.TextEditor.PlatformFonts[WebInspector.OS.WindowsVistaOrLater] = {size: 12, face: "Courier"};
- WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacSnowLeopard] = {size: 11, face: "Menlo"};
- WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacLeopard] = {size: 10, face: "Monaco"};
- WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacTiger] = {size: 10, face: "Monaco"};
- }
-
- if (sansSerif) {
- this._isMonospace = false;
- this._fontSize = 11;
- this._font = this._fontSize + "px sans-serif";
- } else {
- this._isMonospace = true;
- const platform = WebInspector.platform;
- const fontInfo = WebInspector.TextEditor.PlatformFonts[platform] || {size: 10, face: "monospace"};
- this._fontSize = fontInfo.size;
- this._font = this._fontSize + "px " + fontInfo.face;
- }
+ var computedStyle = window.getComputedStyle(this.element);
+ this._font = computedStyle.fontSize + " " + computedStyle.fontFamily;
this._ctx.font = this._font;
this._digitWidth = this._ctx.measureText("0").width;
-
- this._textLineHeight = Math.floor(this._fontSize * 1.4);
+ this._textLineHeight = Math.floor(parseInt(this._ctx.font) * 1.4);
this._cursor.setTextLineHeight(this._textLineHeight);
- this._lineOffsetsCache = [0];
},
_registerShortcuts: function()
@@ -999,15 +993,11 @@ WebInspector.TextEditor.prototype = {
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleUndo.bind(this);
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.Shift | (this._isMac ? modifiers.Meta : modifiers.Ctrl))] = this._handleRedo.bind(this);
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("a", this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._selectAll.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Plus, this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleZoomIn.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Minus, this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleZoomOut.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Zero, this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleZoomReset.bind(this);
if (this._isMac)
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl)] = this._handleDeleteKey.bind(this);
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleDebugMode.bind(this);
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("h", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleHighlightMode.bind(this);
- this._shortcuts[WebInspector.KeyboardShortcut.makeKey("m", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleMonospaceMode.bind(this);
},
_handleUndo: function()
@@ -1065,34 +1055,6 @@ WebInspector.TextEditor.prototype = {
this._debugMode = !this._debugMode;
},
- _handleZoomIn: function()
- {
- if (this._fontSize < 25)
- this._changeFont(!this._isMonospace, this._fontSize + 1);
- },
-
- _handleZoomOut: function()
- {
- if (this._fontSize > 1)
- this._changeFont(!this._isMonospace, this._fontSize - 1);
- },
-
- _handleZoomReset: function()
- {
- this._changeFont(!this._isMonospace);
- },
-
- _handleToggleMonospaceMode: function()
- {
- this._changeFont(this._isMonospace, this._fontSize);
- },
-
- _changeFont: function(sansSerif, fontSize) {
- this._initFont(sansSerif, fontSize);
- this._updatePreferredSize(0, this._textModel.linesCount);
- this.repaintAll();
- },
-
_handleToggleHighlightMode: function()
{
this._highlightingEnabled = !this._highlightingEnabled;
diff --git a/WebCore/inspector/front-end/TextEditorHighlighter.js b/WebCore/inspector/front-end/TextEditorHighlighter.js
index 9a7a050..c73e036 100644
--- a/WebCore/inspector/front-end/TextEditorHighlighter.js
+++ b/WebCore/inspector/front-end/TextEditorHighlighter.js
@@ -47,10 +47,12 @@ WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
/* Keep this in sync with inspector.css and view-source.css */
this._styles["html-tag"] = "rgb(136, 18, 128)";
- this._styles["html-attr-name"] = "rgb(153, 69, 0)";
- this._styles["html-attr-value"] = "rgb(26, 26, 166)";
+ this._styles["html-attribute-name"] = "rgb(153, 69, 0)";
+ this._styles["html-attribute-value"] = "rgb(26, 26, 166)";
this._styles["html-comment"] = "rgb(35, 110, 37)";
this._styles["html-doctype"] = "rgb(192, 192, 192)";
+ this._styles["html-external-link"] = "#00e";
+ this._styles["html-resource-link"] = "#00e";
this._styles["javascript-comment"] = "rgb(0, 116, 0)";
this._styles["javascript-string"] = "rgb(196, 26, 22)";
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 501915d..45b8ec3 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -246,13 +246,11 @@ body.attached.port-qt .toolbar-item.close-left, body.attached.port-qt .toolbar-i
display: none;
}
-body.platform-mac-tiger .toolbar-item.close-right,
-body.platform-mac-leopard .toolbar-item.close-right,
-body.platform-mac-snowleopard .toolbar-item.close-right {
+body.platform-mac .toolbar-item.close-right {
display: none;
}
-body:not(.platform-mac-tiger):not(.platform-mac-leopard):not(.platform-mac-snowleopard) .toolbar-item.close-left {
+body:not(.platform-mac) .toolbar-item.close-left {
display: none;
}
@@ -503,20 +501,18 @@ body.drawer-visible #drawer {
font-family: monospace;
}
-body.platform-mac-tiger .monospace, body.platform-mac-leopard .monospace,
-body.platform-mac-tiger .source-code, body.platform-mac-leopard .source-code {
- font-size: 10px;
+body.platform-mac .monospace, body.platform-mac .source-code {
font-family: Monaco, monospace;
}
-body.platform-mac-snowleopard .monospace,
-body.platform-mac-snowleopard .source-code {
+/* Keep .platform-mac to make the rule more specific than the general one above. */
+body.platform-mac.platform-mac-snowleopard .monospace,
+body.platform-mac.platform-mac-snowleopard .source-code {
font-size: 11px;
font-family: Menlo, monospace;
}
-body.platform-windows .monospace, body.platform-windows-vista-or-later .monospace,
-body.platform-windows .source-code, body.platform-windows-vista-or-later .source-code {
+body.platform-windows .monospace, body.platform-windows .source-code {
font-size: 12px;
font-family: Consolas, Lucida Console, monospace;
}
@@ -1188,46 +1184,6 @@ body.platform-windows .source-code, body.platform-windows-vista-or-later .source
display: block;
}
-.webkit-html-comment {
- /* Keep this in sync with view-source.css (.webkit-html-comment) */
- color: rgb(35, 110, 37);
-}
-
-.webkit-html-tag {
- /* Keep this in sync with view-source.css (.webkit-html-tag) */
- color: rgb(136, 18, 128);
-}
-
-.webkit-html-doctype {
- /* Keep this in sync with view-source.css (.webkit-html-doctype) */
- color: rgb(192, 192, 192);
-}
-
-.webkit-html-attribute-name {
- /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
- color: rgb(153, 69, 0);
-}
-
-.webkit-html-attribute-value {
- /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
- color: rgb(26, 26, 166);
-}
-
-.webkit-html-external-link, .webkit-html-resource-link {
- /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */
- color: #00e;
-}
-
-.webkit-html-external-link {
- /* Keep this in sync with view-source.css (.webkit-html-external-link) */
- text-decoration: none;
-}
-
-.webkit-html-external-link:hover {
- /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */
- text-decoration: underline;
-}
-
.add-attribute {
margin-left: 1px;
margin-right: 1px;
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index c637f37..de20739 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -67,37 +67,44 @@ var WebInspector = {
get platform()
{
if (!("_platform" in this))
- this._platform = this._detectPlatform();
+ this._platform = InspectorFrontendHost.platform();
return this._platform;
},
- _detectPlatform: function()
+ get platformFlavor()
+ {
+ if (!("_platformFlavor" in this))
+ this._platformFlavor = this._detectPlatformFlavor();
+
+ return this._platformFlavor;
+ },
+
+ _detectPlatformFlavor: function()
{
const userAgent = navigator.userAgent;
- var nativePlatform = InspectorFrontendHost.platform();
- if (nativePlatform === "windows") {
+ if (this.platform === "windows") {
var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/);
if (match && match[1] >= 6)
- return WebInspector.OS.WindowsVistaOrLater;
- return WebInspector.OS.Windows;
- } else if (nativePlatform === "mac") {
+ return WebInspector.PlatformFlavor.WindowsVista;
+ return null;
+ } else if (this.platform === "mac") {
var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);
if (!match || match[1] != 10)
- return WebInspector.OS.MacSnowLeopard;
+ return WebInspector.PlatformFlavor.MacSnowLeopard;
switch (Number(match[2])) {
case 4:
- return WebInspector.OS.MacTiger;
+ return WebInspector.PlatformFlavor.MacTiger;
case 5:
- return WebInspector.OS.MacLeopard;
+ return WebInspector.PlatformFlavor.MacLeopard;
case 6:
default:
- return WebInspector.OS.MacSnowLeopard;
+ return WebInspector.PlatformFlavor.MacSnowLeopard;
}
}
- return nativePlatform;
+ return null;
},
get port()
@@ -415,9 +422,8 @@ var WebInspector = {
}
}
-WebInspector.OS = {
- Windows: "windows",
- WindowsVistaOrLater: "windows-vista-or-later",
+WebInspector.PlatformFlavor = {
+ WindowsVista: "windows-vista",
MacTiger: "mac-tiger",
MacLeopard: "mac-leopard",
MacSnowLeopard: "mac-snowleopard"
@@ -429,6 +435,9 @@ WebInspector.loaded = function()
var platform = WebInspector.platform;
document.body.addStyleClass("platform-" + platform);
+ var flavor = WebInspector.platformFlavor;
+ if (flavor)
+ document.body.addStyleClass("platform-" + flavor);
var port = WebInspector.port;
document.body.addStyleClass("port-" + port);
@@ -871,7 +880,7 @@ WebInspector.toggleAttach = function()
WebInspector.toolbarDragStart = function(event)
{
- if ((!WebInspector.attached && WebInspector.platform !== "mac-leopard") || WebInspector.port == "qt")
+ if ((!WebInspector.attached && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port == "qt")
return;
var target = event.target;
@@ -1528,6 +1537,20 @@ WebInspector.linkifyURL = function(url, linkText, classes, isExternal, tooltipTe
return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal, tooltipText).outerHTML;
}
+WebInspector.completeURL = function(baseURL, href)
+{
+ var match = baseURL.match(WebInspector.URLRegExp);
+ if (match) {
+ var path = href;
+ if (path.charAt(0) !== "/") {
+ var basePath = match[4] || "/";
+ path = basePath.substring(0, basePath.lastIndexOf("/")) + "/" + path;
+ }
+ return match[1] + "://" + match[2] + (match[3] ? (":" + match[3]) : "") + path;
+ }
+ return null;
+}
+
WebInspector.addMainEventListeners = function(doc)
{
doc.defaultView.addEventListener("focus", this.windowFocused.bind(this), false);
@@ -1685,7 +1708,7 @@ WebInspector.UIString = function(string)
WebInspector.isMac = function()
{
if (!("_isMac" in this))
- this._isMac = WebInspector.platform.indexOf("mac-") === 0;
+ this._isMac = WebInspector.platform === "mac";
return this._isMac;
}
diff --git a/WebCore/inspector/front-end/inspectorSyntaxHighlight.css b/WebCore/inspector/front-end/inspectorSyntaxHighlight.css
index e3e3074..1292f00 100644
--- a/WebCore/inspector/front-end/inspectorSyntaxHighlight.css
+++ b/WebCore/inspector/front-end/inspectorSyntaxHighlight.css
@@ -65,3 +65,43 @@
.webkit-javascript-string, .webkit-javascript-regexp {
color: rgb(196, 26, 22);
}
+
+.webkit-html-comment {
+ /* Keep this in sync with view-source.css (.webkit-html-comment) */
+ color: rgb(35, 110, 37);
+}
+
+.webkit-html-tag {
+ /* Keep this in sync with view-source.css (.webkit-html-tag) */
+ color: rgb(136, 18, 128);
+}
+
+.webkit-html-doctype {
+ /* Keep this in sync with view-source.css (.webkit-html-doctype) */
+ color: rgb(192, 192, 192);
+}
+
+.webkit-html-attribute-name {
+ /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
+ color: rgb(153, 69, 0);
+}
+
+.webkit-html-attribute-value {
+ /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
+ color: rgb(26, 26, 166);
+}
+
+.webkit-html-external-link, .webkit-html-resource-link {
+ /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */
+ color: #00e;
+}
+
+.webkit-html-external-link {
+ /* Keep this in sync with view-source.css (.webkit-html-external-link) */
+ text-decoration: none;
+}
+
+.webkit-html-external-link:hover {
+ /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */
+ text-decoration: underline;
+}
diff --git a/WebCore/inspector/front-end/textEditor.css b/WebCore/inspector/front-end/textEditor.css
index 9629a07..93495f2 100644
--- a/WebCore/inspector/front-end/textEditor.css
+++ b/WebCore/inspector/front-end/textEditor.css
@@ -45,7 +45,6 @@
}
.native-text-editor-line {
- height: 14px;
white-space: pre;
}