Changeset 84623 in webkit


Ignore:
Timestamp:
Apr 22, 2011 6:18:13 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-04-21 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: group content scripts in the scripts panel drop down.
https://bugs.webkit.org/show_bug.cgi?id=59108

  • English.lproj/localizedStrings.js:
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.optionCompare): (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84622 r84623  
     12011-04-21  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: group content scripts in the scripts panel drop down.
     6        https://bugs.webkit.org/show_bug.cgi?id=59108
     7
     8        * English.lproj/localizedStrings.js:
     9        * inspector/front-end/ScriptsPanel.js:
     10        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.optionCompare):
     11        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):
     12
    1132011-04-22  Mike West  <mkwst@google.com>
    214
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r84484 r84623  
    280280        var option = document.createElement("option");
    281281        option.text = sourceFile.url ? WebInspector.displayNameForURL(sourceFile.url) : WebInspector.UIString("(program)");
     282        option.isContentScript = sourceFile.isContentScript;
    282283        if (sourceFile.isContentScript)
    283284            option.addStyleClass("extension-script");
    284285        function optionCompare(a, b)
    285286        {
     287            if (a === select.contentScriptSection)
     288                return b.isContentScript ? -1 : 1;
     289            if (b === select.contentScriptSection)
     290                return a.isContentScript ? 1 : -1;
     291
     292            if (a.isContentScript && !b.isContentScript)
     293                return 1;
     294            if (!a.isContentScript && b.isContentScript)
     295                return -1;
     296
    286297            if (a.text === b.text)
    287298                return 0;
    288299            return a.text < b.text ? -1 : 1;
    289300        }
     301
    290302        var insertionIndex = insertionIndexForObjectInListSortedByFunction(option, select.childNodes, optionCompare);
    291         if (insertionIndex < 0)
    292             select.appendChild(option);
    293         else
    294             select.insertBefore(option, select.childNodes.item(insertionIndex));
    295 
     303        select.insertBefore(option, insertionIndex < 0 ? null : select.childNodes.item(insertionIndex));
     304
     305        if (sourceFile.isContentScript && !select.contentScriptSection) {
     306            var contentScriptSection = document.createElement("option");
     307            contentScriptSection.text = WebInspector.UIString("Content scripts");
     308            contentScriptSection.disabled = true;
     309            select.contentScriptSection = contentScriptSection;
     310
     311            var insertionIndex = insertionIndexForObjectInListSortedByFunction(contentScriptSection, select.childNodes, optionCompare);
     312            select.insertBefore(contentScriptSection, insertionIndex < 0 ? null : select.childNodes.item(insertionIndex));
     313        }
    296314        option._sourceFileId = sourceFileId;
    297315        this._sourceFileIdToFilesSelectOption[sourceFileId] = option;
Note: See TracChangeset for help on using the changeset viewer.