--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/chrome-dev-tools-patches/stack-line-numbers-patch.txt Tue Feb 09 10:49:18 2010 -0800
@@ -0,0 +1,76 @@
+Index: src/org/chromium/debug/core/model/DebugTargetImpl.java
+===================================================================
+--- src/org/chromium/debug/core/model/DebugTargetImpl.java (revision 307)
++++ src/org/chromium/debug/core/model/DebugTargetImpl.java (working copy)
+@@ -474,6 +474,10 @@
+ public WorkspaceBridge.JsLabelProvider getLabelProvider() {
+ return workspaceBridgeFactory.getLabelProvider();
+ }
++
++ public int getLineNumber(CallFrame stackFrame) {
++ return workspaceRelations.getLineNumber(stackFrame);
++ }
+
+ private static class ListenerBlock {
+ private volatile boolean isBlocked = true;
+Index: src/org/chromium/debug/core/model/StackFrame.java
+===================================================================
+--- src/org/chromium/debug/core/model/StackFrame.java (revision 307)
++++ src/org/chromium/debug/core/model/StackFrame.java (working copy)
+@@ -194,8 +194,7 @@
+ }
+
+ public int getLineNumber() throws DebugException {
+- // convert 0-based to 1-based
+- return stackFrame.getLineNumber() + 1;
++ return getDebugTarget().getLineNumber(stackFrame);
+ }
+
+ public int getCharStart() throws DebugException {
+Index: src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java
+===================================================================
+--- src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java (revision 307)
++++ src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java (working copy)
+@@ -230,6 +230,11 @@
+ }
+ };
+
++ public int getLineNumber(CallFrame stackFrame) {
++ // convert 0-based to 1-based
++ return stackFrame.getLineNumber() + 1;
++ }
++
+ /**
+ * This very simple source locator works because we provide our own source files.
+ * We'll have to try harder, once we link with resource js files.
+@@ -282,4 +287,5 @@
+ return name;
+ }
+ };
++
+ }
+Index: src/org/chromium/debug/core/model/WorkspaceBridge.java
+===================================================================
+--- src/org/chromium/debug/core/model/WorkspaceBridge.java (revision 307)
++++ src/org/chromium/debug/core/model/WorkspaceBridge.java (working copy)
+@@ -7,6 +7,7 @@
+ import java.util.Collection;
+
+ import org.chromium.sdk.Breakpoint;
++import org.chromium.sdk.CallFrame;
+ import org.chromium.sdk.JavascriptVm;
+ import org.chromium.sdk.Script;
+ import org.eclipse.core.resources.IFile;
+@@ -86,6 +87,12 @@
+ BreakpointHandler getBreakpointHandler();
+
+ /**
++ * Returns editor line number for the provided call stack frame applying all required
++ * editor-specific translations.
++ */
++ int getLineNumber(CallFrame stackFrame);
++
++ /**
+ * Breakpoint-related aspect of {@link WorkspaceBridge} interface.
+ */
+ interface BreakpointHandler extends IBreakpointListener {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/HtmlBreakpointProvider.java Tue Feb 09 10:49:18 2010 -0800
@@ -0,0 +1,58 @@
+package org.symbian.tools.wrttools.debug.internal;
+
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
+import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
+
+@SuppressWarnings("restriction")
+public class HtmlBreakpointProvider implements IBreakpointProvider {
+
+ public IStatus addBreakpoint(IDocument document, IEditorInput input,
+ int lineNumber, int offset) throws CoreException {
+ boolean hasScript = hasJavaScript(document, lineNumber);
+
+ System.out.println(hasScript);
+ ChromiumLineBreakpoint breakpoint = new ChromiumLineBreakpoint(getResource(input), lineNumber);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
+ return Status.OK_STATUS;
+ }
+
+ private boolean hasJavaScript(IDocument document, int lineNumber) {
+ try {
+ if (document instanceof IStructuredDocument) {
+ IStructuredDocument doc = (IStructuredDocument) document;
+ int lineOffset = doc.getLineOffset(lineNumber - 1);
+ int lineLength = doc.getLineLength(lineNumber - 1);
+ ITypedRegion[] computePartitioning = doc.computePartitioning(lineOffset, lineLength);
+ for (ITypedRegion region : computePartitioning) {
+ if (IHTMLPartitions.SCRIPT.equals(region.getType()) || IHTMLPartitions.SCRIPT_EVENTHANDLER.equals(region.getType())) {
+ return true;
+ }
+ }
+ }
+ } catch (BadLocationException e) {
+ Activator.log(e);
+ }
+ return false;
+ }
+
+ public IResource getResource(IEditorInput input) {
+ return (IResource) input.getAdapter(IResource.class);
+ }
+
+ public void setSourceEditingTextTools(ISourceEditingTextTools tools) {
+ // Do nothing
+ }
+
+}