Title: [126579] trunk
Revision
126579
Author
[email protected]
Date
2012-08-24 06:25:40 -0700 (Fri, 24 Aug 2012)

Log Message

Web Inspector: make ui component compile
https://bugs.webkit.org/show_bug.cgi?id=94827

Reviewed by Vsevolod Vlasov.

Moved buildImagePreviewContents into the sdk-aware code.
Drive-by more compilation fixes.

* inspector/compile-front-end.py:
* inspector/front-end/DOMPresentationUtils.js:
(WebInspector.DOMPresentationUtils.buildImagePreviewContents.errorCallback):
(WebInspector.DOMPresentationUtils.buildImagePreviewContents.buildContent):
(WebInspector.DOMPresentationUtils.buildImagePreviewContents):
* inspector/front-end/Database.js:
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel):
(WebInspector.TextEditorMainPanel.prototype._createLink):
* inspector/front-end/ElementsPanel.js:
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkDataGridNode.prototype._refreshNameCell):
* inspector/front-end/ParsedURL.js:
(WebInspector.ParsedURL.prototype.get displayName):
* inspector/front-end/ResourceUtils.js:
* inspector/front-end/SourceFrame.js:
(WebInspector.TextEditorDelegateForSourceFrame.prototype.populateTextAreaContextMenu):
(WebInspector.TextEditorDelegateForSourceFrame.prototype.createLink):
* inspector/front-end/TextEditor.js:
(WebInspector.TextEditorDelegate.prototype.populateTextAreaContextMenu):
(WebInspector.TextEditorDelegate.prototype.createLink):
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
* inspector/front-end/UIUtils.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/inspector/editor/indentation.html (126578 => 126579)


--- trunk/LayoutTests/inspector/editor/indentation.html	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/LayoutTests/inspector/editor/indentation.html	2012-08-24 13:25:40 UTC (rev 126579)
@@ -12,7 +12,7 @@
     var model = new WebInspector.TextEditorModel();
     model.setText(src);
     function noop() {}
-    var textEditorMainPanel = new WebInspector.TextEditorMainPanel(model, '', noop, noop, noop, noop);
+    var textEditorMainPanel = new WebInspector.TextEditorMainPanel(null, model, '', noop, noop, noop, noop);
 
     var selection;
     function dumpTextModel(msg)

Modified: trunk/Source/WebCore/ChangeLog (126578 => 126579)


--- trunk/Source/WebCore/ChangeLog	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/ChangeLog	2012-08-24 13:25:40 UTC (rev 126579)
@@ -1,3 +1,38 @@
+2012-08-24  Pavel Feldman  <[email protected]>
+
+        Web Inspector: make ui component compile
+        https://bugs.webkit.org/show_bug.cgi?id=94827
+
+        Reviewed by Vsevolod Vlasov.
+
+        Moved buildImagePreviewContents into the sdk-aware code.
+        Drive-by more compilation fixes.
+
+        * inspector/compile-front-end.py:
+        * inspector/front-end/DOMPresentationUtils.js:
+        (WebInspector.DOMPresentationUtils.buildImagePreviewContents.errorCallback):
+        (WebInspector.DOMPresentationUtils.buildImagePreviewContents.buildContent):
+        (WebInspector.DOMPresentationUtils.buildImagePreviewContents):
+        * inspector/front-end/Database.js:
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.TextEditorMainPanel):
+        (WebInspector.TextEditorMainPanel.prototype._createLink):
+        * inspector/front-end/ElementsPanel.js:
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkDataGridNode.prototype._refreshNameCell):
+        * inspector/front-end/ParsedURL.js:
+        (WebInspector.ParsedURL.prototype.get displayName):
+        * inspector/front-end/ResourceUtils.js:
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.TextEditorDelegateForSourceFrame.prototype.populateTextAreaContextMenu):
+        (WebInspector.TextEditorDelegateForSourceFrame.prototype.createLink):
+        * inspector/front-end/TextEditor.js:
+        (WebInspector.TextEditorDelegate.prototype.populateTextAreaContextMenu):
+        (WebInspector.TextEditorDelegate.prototype.createLink):
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
+        * inspector/front-end/UIUtils.js:
+
 2012-08-24  'Pavel Feldman'  <[email protected]>
 
         Not reviewed: fixing inspector/elements/iframe-load-event.html broken by r126572.

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (126578 => 126579)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2012-08-24 13:25:40 UTC (rev 126579)
@@ -370,11 +370,13 @@
 modules_dir = tempfile.mkdtemp()
 compiler_command = "java -jar ~/closure/compiler.jar --summary_detail_level 3 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword --module_output_path_prefix %s/ \\\n" % modules_dir
 
-process_recursively = len(sys.argv) == 2
+process_recursively = len(sys.argv) > 1
 if process_recursively:
     module_name = sys.argv[1]
     if module_name != "all":
-        modules = [modules_by_name[sys.argv[1]]]
+        modules = []
+        for i in range(1, len(sys.argv)):
+            modules.append(modules_by_name[sys.argv[i]])
     for module in modules:
         command = compiler_command
         command += "    --externs " + inspector_frontend_path + "/externs.js"

Modified: trunk/Source/WebCore/inspector/front-end/DOMPresentationUtils.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/DOMPresentationUtils.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/DOMPresentationUtils.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -96,3 +96,51 @@
         return document.createTextNode(WebInspector.UIString("<node>"));
     return WebInspector.DOMPresentationUtils.linkifyNodeReference(node);
 }
+
+/**
+ * @param {string} imageURL
+ * @param {boolean} showDimensions
+ * @param {function(Element=)} userCallback
+ * @param {Object=} precomputedDimensions
+ */
+WebInspector.DOMPresentationUtils.buildImagePreviewContents = function(imageURL, showDimensions, userCallback, precomputedDimensions)
+{
+    var resource = WebInspector.resourceTreeModel.resourceForURL(imageURL);
+    if (!resource) {
+        userCallback();
+        return;
+    }
+
+    var imageElement = document.createElement("img");
+    imageElement.addEventListener("load", buildContent, false);
+    imageElement.addEventListener("error", errorCallback, false);
+    resource.populateImageSource(imageElement);
+
+    function errorCallback()
+    {
+        // Drop the event parameter when invoking userCallback.
+        userCallback();
+    }
+
+    function buildContent()
+    {
+        var container = document.createElement("table");
+        container.className = "image-preview-container";
+        var naturalWidth = precomputedDimensions ? precomputedDimensions.naturalWidth : imageElement.naturalWidth;
+        var naturalHeight = precomputedDimensions ? precomputedDimensions.naturalHeight : imageElement.naturalHeight;
+        var offsetWidth = precomputedDimensions ? precomputedDimensions.offsetWidth : naturalWidth;
+        var offsetHeight = precomputedDimensions ? precomputedDimensions.offsetHeight : naturalHeight;
+        var description;
+        if (showDimensions) {
+            if (offsetHeight === naturalHeight && offsetWidth === naturalWidth)
+                description = WebInspector.UIString("%d \xd7 %d pixels", offsetWidth, offsetHeight);
+            else
+                description = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight);
+        }
+
+        container.createChild("tr").createChild("td", "image-container").appendChild(imageElement);
+        if (description)
+            container.createChild("tr").createChild("td").createChild("span", "description").textContent = description;
+        userCallback(container);
+    }
+}

Modified: trunk/Source/WebCore/inspector/front-end/Database.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/Database.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/Database.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -79,12 +79,6 @@
         this._domain = x;
     },
 
-    /** @return {string} */
-    get displayDomain()
-    {
-        return WebInspector.displayDomain(this._domain);
-    },
-
     /**
      * @param {function(Array.<string>)} callback
      */

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


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -55,7 +55,7 @@
     var syncScrollListener = this._syncScroll.bind(this);
     var syncDecorationsForLineListener = this._syncDecorationsForLine.bind(this);
     var syncLineHeightListener = this._syncLineHeight.bind(this);
-    this._mainPanel = new WebInspector.TextEditorMainPanel(this._textModel, url, syncScrollListener, syncDecorationsForLineListener, enterTextChangeMode, exitTextChangeMode);
+    this._mainPanel = new WebInspector.TextEditorMainPanel(this._delegate, this._textModel, url, syncScrollListener, syncDecorationsForLineListener, enterTextChangeMode, exitTextChangeMode);
     this._gutterPanel = new WebInspector.TextEditorGutterPanel(this._textModel, syncDecorationsForLineListener, syncLineHeightListener);
 
     this._mainPanel.element.addEventListener("scroll", this._handleScrollChanged.bind(this), false);
@@ -413,6 +413,9 @@
 
     _contextMenu: function(event)
     {
+        var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
+        if (anchor)
+            return;
         var contextMenu = new WebInspector.ContextMenu();
         var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
         if (target)
@@ -1208,13 +1211,15 @@
 /**
  * @constructor
  * @extends {WebInspector.TextEditorChunkedPanel}
+ * @param {WebInspector.TextEditorDelegate} delegate
  * @param {WebInspector.TextEditorModel} textModel
  * @param {?string} url
  */
-WebInspector.TextEditorMainPanel = function(textModel, url, syncScrollListener, syncDecorationsForLineListener, enterTextChangeMode, exitTextChangeMode)
+WebInspector.TextEditorMainPanel = function(delegate, textModel, url, syncScrollListener, syncDecorationsForLineListener, enterTextChangeMode, exitTextChangeMode)
 {
     WebInspector.TextEditorChunkedPanel.call(this, textModel);
 
+    this._delegate = delegate;
     this._syncScrollListener = syncScrollListener;
     this._syncDecorationsForLineListener = syncDecorationsForLineListener;
     this._enterTextChangeMode = enterTextChangeMode;
@@ -2091,28 +2096,16 @@
         else
             quote = null;
 
-        var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, undefined, isExternal);
         var span = document.createElement("span");
         span.className = "webkit-html-attribute-value";
         if (quote)
             span.appendChild(document.createTextNode(quote));
-        span.appendChild(a);
+        span.appendChild(this._delegate.createLink(content, isExternal));
         if (quote)
             span.appendChild(document.createTextNode(quote));
         return span;
     },
 
-    /**
-     * @param {string=} hrefValue
-     * @param {boolean=} isExternal
-     */
-    _rewriteHref: function(hrefValue, isExternal)
-    {
-        if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0)
-            return hrefValue;
-        return WebInspector.ParsedURL.completeURL(this._url, hrefValue);
-    },
-
     _handleDOMUpdates: function(e)
     {
         if (this._domUpdateCoalescingLevel)

Modified: trunk/Source/WebCore/inspector/front-end/ElementsPanel.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -432,9 +432,9 @@
     {
         var listItem = anchor.enclosingNodeOrSelfWithNodeName("li");
         if (listItem && listItem.treeElement)
-            this._loadDimensionsForNode(listItem.treeElement, WebInspector.buildImagePreviewContents.bind(WebInspector, anchor.href, true, showPopover));
+            this._loadDimensionsForNode(listItem.treeElement, WebInspector.DOMPresentationUtils.buildImagePreviewContents.bind(WebInspector.DOMPresentationUtils, anchor.href, true, showPopover));
         else
-            WebInspector.buildImagePreviewContents(anchor.href, true, showPopover);
+            WebInspector.DOMPresentationUtils.buildImagePreviewContents(anchor.href, true, showPopover);
 
         /**
          * @param {Element=} contents

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -1925,9 +1925,8 @@
         this._nameCell.appendChild(iconElement);
         this._nameCell.appendChild(document.createTextNode(this._fileName()));
 
+        var subtitle = this._request.parsedURL.host === WebInspector.inspectedPageDomain ? "" : this._request.parsedURL.host;
 
-        var subtitle = WebInspector.displayDomain(this._request.parsedURL.host);
-
         if (this._request.parsedURL.path)
             subtitle += this._request.folder;
 

Modified: trunk/Source/WebCore/inspector/front-end/ParsedURL.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/ParsedURL.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/ParsedURL.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -158,7 +158,7 @@
 
         this._displayName = this.lastPathComponent;
         if (!this._displayName)
-            this._displayName = WebInspector.displayDomain(this.host);
+            this._displayName = this.host;
         if (!this._displayName && this.url)
             this._displayName = this.url.trimURL(WebInspector.inspectedPageDomain ? WebInspector.inspectedPageDomain : "");
         if (this._displayName === "/")

Modified: trunk/Source/WebCore/inspector/front-end/ResourceUtils.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -46,16 +46,6 @@
 }
 
 /**
- * @param {string} host
- */
-WebInspector.displayDomain = function(host)
-{
-    if (host && (!WebInspector.inspectedPageDomain || (WebInspector.inspectedPageDomain && host !== WebInspector.inspectedPageDomain)))
-        return host;
-    return "";
-}
-
-/**
  * @param {string} url
  * @return {string}
  */

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


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -695,6 +695,19 @@
     populateTextAreaContextMenu: function(contextMenu, lineNumber)
     {
         this._sourceFrame.populateTextAreaContextMenu(contextMenu, lineNumber);
+    },
+
+    /**
+     * @param {string} hrefValue
+     * @param {boolean} isExternal
+     * @return {Element}
+     */
+    createLink: function(hrefValue, isExternal)
+    {
+        var targetLocation = hrefValue;
+        if (this._sourceFrame._url && hrefValue && hrefValue.indexOf("://") === -1)
+            targetLocation = WebInspector.ParsedURL.completeURL(this._sourceFrame._url, hrefValue);
+        return WebInspector.linkifyURLAsNode(targetLocation, hrefValue, undefined, isExternal);
     }
 }
 

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


--- trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/TextEditor.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -236,6 +236,12 @@
      * @param {WebInspector.ContextMenu} contextMenu
      * @param {number} lineNumber
      */
-    populateTextAreaContextMenu: function(contextMenu, lineNumber) { }
+    populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
+
+    /**
+     * @param {string} hrefValue
+     * @param {boolean} isExternal
+     * @return {Element}
+     */
+    createLink: function(hrefValue, isExternal) { }
 }
-

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -664,7 +664,7 @@
     generatePopupContent: function(callback)
     {
         if (WebInspector.TimelinePresentationModel.needsPreviewElement(this.type))
-            WebInspector.buildImagePreviewContents(this.url, false, this._generatePopupContentWithImagePreview.bind(this, callback));
+            WebInspector.DOMPresentationUtils.buildImagePreviewContents(this.url, false, this._generatePopupContentWithImagePreview.bind(this, callback));
         else
             this._generatePopupContentWithImagePreview(callback);
     },

Modified: trunk/Source/WebCore/inspector/front-end/UIUtils.js (126578 => 126579)


--- trunk/Source/WebCore/inspector/front-end/UIUtils.js	2012-08-24 13:21:24 UTC (rev 126578)
+++ trunk/Source/WebCore/inspector/front-end/UIUtils.js	2012-08-24 13:25:40 UTC (rev 126579)
@@ -1031,54 +1031,6 @@
     }
 }
 
-/**
- * @param {string} imageURL
- * @param {boolean} showDimensions
- * @param {function(Element=)} userCallback
- * @param {Object=} precomputedDimensions
- */
-WebInspector.buildImagePreviewContents = function(imageURL, showDimensions, userCallback, precomputedDimensions)
-{
-    var resource = WebInspector.resourceTreeModel.resourceForURL(imageURL);
-    if (!resource) {
-        userCallback();
-        return;
-    }
-
-    var imageElement = document.createElement("img");
-    imageElement.addEventListener("load", buildContent, false);
-    imageElement.addEventListener("error", errorCallback, false);
-    resource.populateImageSource(imageElement);
-
-    function errorCallback()
-    {
-        // Drop the event parameter when invoking userCallback.
-        userCallback();
-    }
-
-    function buildContent()
-    {
-        var container = document.createElement("table");
-        container.className = "image-preview-container";
-        var naturalWidth = precomputedDimensions ? precomputedDimensions.naturalWidth : imageElement.naturalWidth;
-        var naturalHeight = precomputedDimensions ? precomputedDimensions.naturalHeight : imageElement.naturalHeight;
-        var offsetWidth = precomputedDimensions ? precomputedDimensions.offsetWidth : naturalWidth;
-        var offsetHeight = precomputedDimensions ? precomputedDimensions.offsetHeight : naturalHeight;
-        var description;
-        if (showDimensions) {
-            if (offsetHeight === naturalHeight && offsetWidth === naturalWidth)
-                description = WebInspector.UIString("%d \xd7 %d pixels", offsetWidth, offsetHeight);
-            else
-                description = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight);
-        }
-
-        container.createChild("tr").createChild("td", "image-container").appendChild(imageElement);
-        if (description)
-            container.createChild("tr").createChild("td").createChild("span", "description").textContent = description;
-        userCallback(container);
-    }
-}
-
 WebInspector._coalescingLevel = 0;
 
 WebInspector.startBatchUpdate = function()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to