Title: [125880] trunk
Revision
125880
Author
[email protected]
Date
2012-08-17 04:42:08 -0700 (Fri, 17 Aug 2012)

Log Message

Web Inspector: SourceFrame shouldn't be a View
https://bugs.webkit.org/show_bug.cgi?id=93444

Patch by Jan Keromnes <[email protected]> on 2012-08-17
Reviewed by Pavel Feldman.

Source/WebCore:

Move SourceFrame from being a View to being an Object. This will allow
future ExtensionSourceFrames to share a single iframe ExtensionView.

* inspector/front-end/CodeMirrorTextEditor.js:
(WebInspector.CodeMirrorTextEditor.prototype.wasShown):
(WebInspector.CodeMirrorTextEditor.prototype.willHide):
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.DefaultTextEditor.prototype.wasShown):
(WebInspector.DefaultTextEditor.prototype.willHide):
* inspector/front-end/_javascript_SourceFrame.js:
(WebInspector._javascript_SourceFrame):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
(WebInspector.SourceFrame.prototype.show):
(WebInspector.SourceFrame.prototype.detach):
(WebInspector.SourceFrame.prototype.focus):
(WebInspector.SourceFrame.prototype._onTextEditorWasShown):
(WebInspector.SourceFrame.prototype._onTextEditorWillHide):
* inspector/front-end/TextEditor.js:
* inspector/front-end/scriptsPanel.css:

LayoutTests:

Use TextEditor as a View instead of SourceFrame.

* inspector/debugger/reveal-execution-line.html:
* inspector/debugger/source-frame-count.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125879 => 125880)


--- trunk/LayoutTests/ChangeLog	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/LayoutTests/ChangeLog	2012-08-17 11:42:08 UTC (rev 125880)
@@ -1,3 +1,15 @@
+2012-08-17  Jan Keromnes  <[email protected]>
+
+        Web Inspector: SourceFrame shouldn't be a View
+        https://bugs.webkit.org/show_bug.cgi?id=93444
+
+        Reviewed by Pavel Feldman.
+
+        Use TextEditor as a View instead of SourceFrame.
+
+        * inspector/debugger/reveal-execution-line.html:
+        * inspector/debugger/source-frame-count.html:
+
 2012-08-17  Anthony Berent  <[email protected]>
 
         View source doesn't interpret escape characters in hrefs.

Modified: trunk/LayoutTests/inspector/debugger/reveal-execution-line.html (125879 => 125880)


--- trunk/LayoutTests/inspector/debugger/reveal-execution-line.html	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/LayoutTests/inspector/debugger/reveal-execution-line.html	2012-08-17 11:42:08 UTC (rev 125880)
@@ -36,7 +36,7 @@
             {
                 if (executionLineRevealed)
                     return;
-                if (this.isShowing()) {
+                if (this._textEditor.isShowing()) {
                     executionLineRevealed = true;
                     maybeNext();
                 }

Modified: trunk/LayoutTests/inspector/debugger/source-frame-count.html (125879 => 125880)


--- trunk/LayoutTests/inspector/debugger/source-frame-count.html	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/LayoutTests/inspector/debugger/source-frame-count.html	2012-08-17 11:42:08 UTC (rev 125880)
@@ -35,7 +35,7 @@
                 {
                     sourceFrameCount += 1;
                 }
-                InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wasShown", didCreateSourceFrame, true);
+                InspectorTest.addSniffer(WebInspector.TextEditor.prototype, "wasShown", didCreateSourceFrame, true);
                 InspectorTest.reloadPage(didReload);
             }
 

Modified: trunk/Source/WebCore/ChangeLog (125879 => 125880)


--- trunk/Source/WebCore/ChangeLog	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/ChangeLog	2012-08-17 11:42:08 UTC (rev 125880)
@@ -1,3 +1,31 @@
+2012-08-17  Jan Keromnes  <[email protected]>
+
+        Web Inspector: SourceFrame shouldn't be a View
+        https://bugs.webkit.org/show_bug.cgi?id=93444
+
+        Reviewed by Pavel Feldman.
+
+        Move SourceFrame from being a View to being an Object. This will allow
+        future ExtensionSourceFrames to share a single iframe ExtensionView.
+
+        * inspector/front-end/CodeMirrorTextEditor.js:
+        (WebInspector.CodeMirrorTextEditor.prototype.wasShown):
+        (WebInspector.CodeMirrorTextEditor.prototype.willHide):
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.DefaultTextEditor.prototype.wasShown):
+        (WebInspector.DefaultTextEditor.prototype.willHide):
+        * inspector/front-end/_javascript_SourceFrame.js:
+        (WebInspector._javascript_SourceFrame):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        (WebInspector.SourceFrame.prototype.show):
+        (WebInspector.SourceFrame.prototype.detach):
+        (WebInspector.SourceFrame.prototype.focus):
+        (WebInspector.SourceFrame.prototype._onTextEditorWasShown):
+        (WebInspector.SourceFrame.prototype._onTextEditorWillHide):
+        * inspector/front-end/TextEditor.js:
+        * inspector/front-end/scriptsPanel.css:
+
 2012-08-17  Pavel Chadnov  <[email protected]>
 
         Web Inspector: requests filtering in network tab

Modified: trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js (125879 => 125880)


--- trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2012-08-17 11:42:08 UTC (rev 125880)
@@ -393,6 +393,16 @@
         loadLibrary("_javascript_.js");
         loadLibrary("xml.js");
         loadLibrary("htmlmixed.js");
+    },
+
+    wasShown: function()
+    {
+        this.dispatchEventToListeners(WebInspector.TextEditor.Events.WasShown);
+    },
+
+    willHide: function()
+    {
+        this.dispatchEventToListeners(WebInspector.TextEditor.Events.WillHide);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (125879 => 125880)


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-17 11:42:08 UTC (rev 125880)
@@ -553,6 +553,8 @@
 
         this._boundSelectionChangeListener = this._handleSelectionChange.bind(this);
         document.addEventListener("selectionchange", this._boundSelectionChangeListener, false);
+
+        this.dispatchEventToListeners(WebInspector.TextEditor.Events.WasShown);
     },
 
     _handleFocused: function()
@@ -563,6 +565,8 @@
 
     willHide: function()
     {
+        this.dispatchEventToListeners(WebInspector.TextEditor.Events.WillHide);
+
         document.removeEventListener("selectionchange", this._boundSelectionChangeListener, false);
         delete this._boundSelectionChangeListener;
 

Modified: trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js (125879 => 125880)


--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-08-17 11:42:08 UTC (rev 125880)
@@ -52,6 +52,7 @@
     this.textEditor.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
 
     this.textEditor.addEventListener(WebInspector.TextEditor.Events.GutterClick, this._handleGutterClick.bind(this), this);
+    this.textEditor.addEventListener(WebInspector.TextEditor.Events.WillHide, this._popoverHelper.hidePopover.bind(this._popoverHelper));
 
     this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
     this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);
@@ -63,18 +64,6 @@
 }
 
 WebInspector._javascript_SourceFrame.prototype = {
-    // View events
-    wasShown: function()
-    {
-        WebInspector.SourceFrame.prototype.wasShown.call(this);
-    },
-
-    willHide: function()
-    {
-        WebInspector.SourceFrame.prototype.willHide.call(this);
-        this._popoverHelper.hidePopover();
-    },
-
     /**
      * @return {boolean}
      */

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (125879 => 125880)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-08-17 11:42:08 UTC (rev 125880)
@@ -29,14 +29,13 @@
  */
 
 /**
- * @extends {WebInspector.View}
  * @constructor
+ * @extends {WebInspector.Object}
  * @param {WebInspector.ContentProvider} contentProvider
  */
 WebInspector.SourceFrame = function(contentProvider)
 {
-    WebInspector.View.call(this);
-    this.element.addStyleClass("script-view");
+    WebInspector.Object.call(this);
 
     this._url = contentProvider.contentURL();
     this._contentProvider = contentProvider;
@@ -48,6 +47,9 @@
     else
         this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
 
+    this._textEditor.addEventListener(WebInspector.TextEditor.Events.WasShown, this._onTextEditorWasShown.bind(this), this);
+    this._textEditor.addEventListener(WebInspector.TextEditor.Events.WillHide, this._onTextEditorWillHide.bind(this), this);
+
     this._currentSearchResultIndex = -1;
     this._searchResults = [];
 
@@ -59,7 +61,7 @@
 
     this._shortcuts = {};
     this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)] = this._commitEditing.bind(this);
-    this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
+    this._textEditor.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
 }
 
 /**
@@ -92,17 +94,29 @@
 }
 
 WebInspector.SourceFrame.prototype = {
-    wasShown: function()
+    show: function(parent)
     {
+        this._textEditor.show(parent);
+    },
+
+    detach: function()
+    {
+        this._textEditor.detach();
+    },
+
+    focus: function()
+    {
+        this._textEditor.focus();
+    },
+
+    _onTextEditorWasShown: function()
+    {
         this._ensureContentLoaded();
-        this._textEditor.show(this.element);
         this._wasShownOrLoaded();
     },
 
-    willHide: function()
+    _onTextEditorWillHide: function()
     {
-        WebInspector.View.prototype.willHide.call(this);
-
         this._clearLineHighlight();
         this._clearLineToReveal();
     },
@@ -652,7 +666,7 @@
     }
 }
 
-WebInspector.SourceFrame.prototype.__proto__ = WebInspector.View.prototype;
+WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
 
 
 /**

Modified: trunk/Source/WebCore/inspector/front-end/TextEditor.js (125879 => 125880)


--- trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-08-17 11:42:08 UTC (rev 125880)
@@ -35,7 +35,9 @@
 WebInspector.TextEditor = function() { };
 
 WebInspector.TextEditor.Events = {
-    GutterClick: "gutterClick"
+    GutterClick: "gutterClick",
+    WasShown: "WasShown",
+    WillHide: "WillHide"
 };
 
 WebInspector.TextEditor.prototype = {

Modified: trunk/Source/WebCore/inspector/front-end/scriptsPanel.css (125879 => 125880)


--- trunk/Source/WebCore/inspector/front-end/scriptsPanel.css	2012-08-17 10:54:57 UTC (rev 125879)
+++ trunk/Source/WebCore/inspector/front-end/scriptsPanel.css	2012-08-17 11:42:08 UTC (rev 125880)
@@ -199,20 +199,6 @@
     left: 0;
 }
 
-.script-view {
-    display: none;
-    overflow: hidden;
-    position: absolute;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-}
-
-.script-view.visible {
-    display: block;
-}
-
 .dedicated-worker-item {
     margin: 5px 0px 5px 1px;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to