Changeset 72655 in webkit


Ignore:
Timestamp:
Nov 24, 2010 2:36:12 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2010-11-22 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: refactor ResourceView hierarchy.
https://bugs.webkit.org/show_bug.cgi?id=49864

This refactoring splits ResourceView.js into:

NetworkItemView.js (tabbed pane)
ResourceHeadersView.js (header tab)
ResourceCookiesView.js (cookies tab)
ResourceView.js (base class for content tab).

CookiesTable was extracted from CookieItemsView and
brushed up. headersVisible flag has been removed.

  • English.lproj/localizedStrings.js:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • inspector/front-end/CookieItemsView.js: (WebInspector.CookieItemsView): (WebInspector.CookieItemsView.prototype.get statusBarItems): (WebInspector.CookieItemsView.prototype.hide): (WebInspector.CookieItemsView.prototype.resize): (WebInspector.CookieItemsView.prototype._updateWithCookies): (WebInspector.CookieItemsView.prototype._filterCookiesForDomain): (WebInspector.CookieItemsView.prototype._deleteCookie): (WebInspector.CookieItemsView.prototype._deleteButtonClicked): (WebInspector.CookieItemsView.prototype._refreshButtonClicked): (WebInspector.SimpleCookiesTable): (WebInspector.SimpleCookiesTable.prototype.setCookies): (WebInspector.SimpleCookiesTable.prototype.resize):
  • inspector/front-end/CookiesTable.js: Added. (WebInspector.CookiesTable): (WebInspector.CookiesTable.prototype.updateWidths): (WebInspector.CookiesTable.prototype.setCookies): (WebInspector.CookiesTable.prototype.addCookiesFolder): (WebInspector.CookiesTable.prototype.get selectedCookie): (WebInspector.CookiesTable.prototype._rebuildTable): (WebInspector.CookiesTable.prototype.reset): (WebInspector.CookiesTable.prototype._populateNode): (WebInspector.CookiesTable.prototype._totalSize): (WebInspector.CookiesTable.prototype._sortCookies.localeCompare): (WebInspector.CookiesTable.prototype._sortCookies.numberCompare): (WebInspector.CookiesTable.prototype._sortCookies.expiresCompare): (WebInspector.CookiesTable.prototype._sortCookies): (WebInspector.CookiesTable.prototype._createGridNode): (WebInspector.CookiesTable.prototype._onDeleteFromGrid):
  • inspector/front-end/FileSystemView.js: (WebInspector.FileSystemView.prototype._selectFileSystemTab): (WebInspector.FileSystemView.prototype.selectTemporaryFileSystemTab):
  • inspector/front-end/FontView.js: (WebInspector.FontView.prototype.hasContent): (WebInspector.FontView.prototype._createContentIfNeeded): (WebInspector.FontView.prototype.show): (WebInspector.FontView.prototype.updateFontPreviewSize):
  • inspector/front-end/ImageView.js: (WebInspector.ImageView.prototype.hasContent): (WebInspector.ImageView.prototype.show):
  • inspector/front-end/NetworkItemView.js: Added. (WebInspector.NetworkItemView): (WebInspector.NetworkItemView.prototype.show): (WebInspector.NetworkItemView.prototype._selectTab): (WebInspector.NetworkItemView.prototype._tabSelected): (WebInspector.NetworkItemView.prototype.resize): (WebInspector.NetworkItemView.prototype.selectContentTab):
  • inspector/front-end/NetworkPanel.js: (WebInspector.NetworkPanel.prototype.show): (WebInspector.NetworkPanel.prototype.refreshResource): (WebInspector.NetworkPanel.prototype._showResource): (WebInspector.NetworkPanel.prototype._closeVisibleResource):
  • inspector/front-end/ResourceCookiesView.js: Added. (WebInspector.ResourceCookiesView): (WebInspector.ResourceCookiesView.prototype.show):
  • inspector/front-end/ResourceHeadersView.js: Added. (WebInspector.ResourceHeadersView): (WebInspector.ResourceHeadersView.prototype._refreshURL): (WebInspector.ResourceHeadersView.prototype._refreshQueryString): (WebInspector.ResourceHeadersView.prototype._refreshFormData): (WebInspector.ResourceHeadersView.prototype._refreshRequestPayload): (WebInspector.ResourceHeadersView.prototype._refreshParms): (WebInspector.ResourceHeadersView.prototype._toggleURLdecoding): (WebInspector.ResourceHeadersView.prototype._getHeaderValue): (WebInspector.ResourceHeadersView.prototype._refreshRequestHeaders): (WebInspector.ResourceHeadersView.prototype._refreshResponseHeaders): (WebInspector.ResourceHeadersView.prototype._refreshHTTPInformation): (WebInspector.ResourceHeadersView.prototype._refreshHeaders):
  • inspector/front-end/ResourceView.js: (WebInspector.ResourceView): (WebInspector.ResourceView.prototype.hasContent):
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourcesPanel.prototype.show): (WebInspector.ResourcesPanel.prototype.showResource): (WebInspector.ResourcesPanel.prototype._showResourceView):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype.show): (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
  • inspector/front-end/SourceView.js: (WebInspector.SourceView): (WebInspector.SourceView.prototype.show): (WebInspector.SourceView.prototype.hide): (WebInspector.SourceView.prototype.resize): (WebInspector.SourceView.prototype.setupSourceFrameIfNeeded): (WebInspector.SourceView.prototype.hasContent): (WebInspector.SourceView.prototype.updateLocalContent): (WebInspector.SourceView.prototype.selectLocalContentTab):
  • inspector/front-end/StylesSidebarPane.js:
  • inspector/front-end/TabbedPane.js: (WebInspector.TabbedPane): (WebInspector.TabbedPane.prototype.appendTab): (WebInspector.TabbedPane.prototype.selectTab): (WebInspector.TabbedPane.prototype._showTab): (WebInspector.TabbedPane.prototype._hideTab):
  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/inspector.css: (.webkit-line-gutter-backdrop): (.resource-view): (.resource-view.visible): (.resource-view.font): (.resource-view.image > .image): (.resource-view.image > .info): (.storage-view): (.storage-view .data-grid): (.storage-empty-view, .storage-view .storage-table-error): (.storage-view .storage-table-error):
  • inspector/front-end/inspector.html:
  • inspector/front-end/networkPanel.css: (.network-cell-subtitle): (.network-header-subtitle): (#network-views .network-item-view .tabbed-pane-header): (#network-views.small .network-item-view .tabbed-pane-header): (.network-item-view): (.network-item-view.visible): (.network-item-view .tabbed-pane-header): (.network-item-view .scope-bar li): (.resource-headers-view): (.resource-headers-view.visible): (.resource-headers-view .outline-disclosure .parent): (.resource-headers-view .outline-disclosure .children li): (.resource-headers-view .outline-disclosure li.expanded .header-count): (.resource-headers-view .outline-disclosure .header-name): (.resource-headers-view .outline-disclosure .header-value): (.resource-headers-view .outline-disclosure .raw-form-data): (.resource-cookies-view): (.resource-cookies-view.visible): (.resource-cookies-view .data-grid): (.resource-cookies-view .data-grid .row-group):
Location:
trunk/WebCore
Files:
4 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r72654 r72655  
     12010-11-22  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: refactor ResourceView hierarchy.
     6        https://bugs.webkit.org/show_bug.cgi?id=49864
     7
     8        This refactoring splits ResourceView.js into:
     9            NetworkItemView.js (tabbed pane)
     10            ResourceHeadersView.js (header tab)
     11            ResourceCookiesView.js (cookies tab)
     12            ResourceView.js (base class for content tab).
     13        CookiesTable was extracted from CookieItemsView and
     14        brushed up. headersVisible flag has been removed.
     15
     16        * English.lproj/localizedStrings.js:
     17        * WebCore.gypi:
     18        * WebCore.vcproj/WebCore.vcproj:
     19        * inspector/front-end/CookieItemsView.js:
     20        (WebInspector.CookieItemsView):
     21        (WebInspector.CookieItemsView.prototype.get statusBarItems):
     22        (WebInspector.CookieItemsView.prototype.hide):
     23        (WebInspector.CookieItemsView.prototype.resize):
     24        (WebInspector.CookieItemsView.prototype._updateWithCookies):
     25        (WebInspector.CookieItemsView.prototype._filterCookiesForDomain):
     26        (WebInspector.CookieItemsView.prototype._deleteCookie):
     27        (WebInspector.CookieItemsView.prototype._deleteButtonClicked):
     28        (WebInspector.CookieItemsView.prototype._refreshButtonClicked):
     29        (WebInspector.SimpleCookiesTable):
     30        (WebInspector.SimpleCookiesTable.prototype.setCookies):
     31        (WebInspector.SimpleCookiesTable.prototype.resize):
     32        * inspector/front-end/CookiesTable.js: Added.
     33        (WebInspector.CookiesTable):
     34        (WebInspector.CookiesTable.prototype.updateWidths):
     35        (WebInspector.CookiesTable.prototype.setCookies):
     36        (WebInspector.CookiesTable.prototype.addCookiesFolder):
     37        (WebInspector.CookiesTable.prototype.get selectedCookie):
     38        (WebInspector.CookiesTable.prototype._rebuildTable):
     39        (WebInspector.CookiesTable.prototype.reset):
     40        (WebInspector.CookiesTable.prototype._populateNode):
     41        (WebInspector.CookiesTable.prototype._totalSize):
     42        (WebInspector.CookiesTable.prototype._sortCookies.localeCompare):
     43        (WebInspector.CookiesTable.prototype._sortCookies.numberCompare):
     44        (WebInspector.CookiesTable.prototype._sortCookies.expiresCompare):
     45        (WebInspector.CookiesTable.prototype._sortCookies):
     46        (WebInspector.CookiesTable.prototype._createGridNode):
     47        (WebInspector.CookiesTable.prototype._onDeleteFromGrid):
     48        * inspector/front-end/FileSystemView.js:
     49        (WebInspector.FileSystemView.prototype._selectFileSystemTab):
     50        (WebInspector.FileSystemView.prototype.selectTemporaryFileSystemTab):
     51        * inspector/front-end/FontView.js:
     52        (WebInspector.FontView.prototype.hasContent):
     53        (WebInspector.FontView.prototype._createContentIfNeeded):
     54        (WebInspector.FontView.prototype.show):
     55        (WebInspector.FontView.prototype.updateFontPreviewSize):
     56        * inspector/front-end/ImageView.js:
     57        (WebInspector.ImageView.prototype.hasContent):
     58        (WebInspector.ImageView.prototype.show):
     59        * inspector/front-end/NetworkItemView.js: Added.
     60        (WebInspector.NetworkItemView):
     61        (WebInspector.NetworkItemView.prototype.show):
     62        (WebInspector.NetworkItemView.prototype._selectTab):
     63        (WebInspector.NetworkItemView.prototype._tabSelected):
     64        (WebInspector.NetworkItemView.prototype.resize):
     65        (WebInspector.NetworkItemView.prototype.selectContentTab):
     66        * inspector/front-end/NetworkPanel.js:
     67        (WebInspector.NetworkPanel.prototype.show):
     68        (WebInspector.NetworkPanel.prototype.refreshResource):
     69        (WebInspector.NetworkPanel.prototype._showResource):
     70        (WebInspector.NetworkPanel.prototype._closeVisibleResource):
     71        * inspector/front-end/ResourceCookiesView.js: Added.
     72        (WebInspector.ResourceCookiesView):
     73        (WebInspector.ResourceCookiesView.prototype.show):
     74        * inspector/front-end/ResourceHeadersView.js: Added.
     75        (WebInspector.ResourceHeadersView):
     76        (WebInspector.ResourceHeadersView.prototype._refreshURL):
     77        (WebInspector.ResourceHeadersView.prototype._refreshQueryString):
     78        (WebInspector.ResourceHeadersView.prototype._refreshFormData):
     79        (WebInspector.ResourceHeadersView.prototype._refreshRequestPayload):
     80        (WebInspector.ResourceHeadersView.prototype._refreshParms):
     81        (WebInspector.ResourceHeadersView.prototype._toggleURLdecoding):
     82        (WebInspector.ResourceHeadersView.prototype._getHeaderValue):
     83        (WebInspector.ResourceHeadersView.prototype._refreshRequestHeaders):
     84        (WebInspector.ResourceHeadersView.prototype._refreshResponseHeaders):
     85        (WebInspector.ResourceHeadersView.prototype._refreshHTTPInformation):
     86        (WebInspector.ResourceHeadersView.prototype._refreshHeaders):
     87        * inspector/front-end/ResourceView.js:
     88        (WebInspector.ResourceView):
     89        (WebInspector.ResourceView.prototype.hasContent):
     90        * inspector/front-end/ResourcesPanel.js:
     91        (WebInspector.ResourcesPanel.prototype.show):
     92        (WebInspector.ResourcesPanel.prototype.showResource):
     93        (WebInspector.ResourcesPanel.prototype._showResourceView):
     94        * inspector/front-end/ScriptsPanel.js:
     95        (WebInspector.ScriptsPanel.prototype.show):
     96        (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
     97        * inspector/front-end/SourceView.js:
     98        (WebInspector.SourceView):
     99        (WebInspector.SourceView.prototype.show):
     100        (WebInspector.SourceView.prototype.hide):
     101        (WebInspector.SourceView.prototype.resize):
     102        (WebInspector.SourceView.prototype.setupSourceFrameIfNeeded):
     103        (WebInspector.SourceView.prototype.hasContent):
     104        (WebInspector.SourceView.prototype.updateLocalContent):
     105        (WebInspector.SourceView.prototype.selectLocalContentTab):
     106        * inspector/front-end/StylesSidebarPane.js:
     107        * inspector/front-end/TabbedPane.js:
     108        (WebInspector.TabbedPane):
     109        (WebInspector.TabbedPane.prototype.appendTab):
     110        (WebInspector.TabbedPane.prototype.selectTab):
     111        (WebInspector.TabbedPane.prototype._showTab):
     112        (WebInspector.TabbedPane.prototype._hideTab):
     113        * inspector/front-end/WebKit.qrc:
     114        * inspector/front-end/inspector.css:
     115        (.webkit-line-gutter-backdrop):
     116        (.resource-view):
     117        (.resource-view.visible):
     118        (.resource-view.font):
     119        (.resource-view.image > .image):
     120        (.resource-view.image > .info):
     121        (.storage-view):
     122        (.storage-view .data-grid):
     123        (.storage-empty-view, .storage-view .storage-table-error):
     124        (.storage-view .storage-table-error):
     125        * inspector/front-end/inspector.html:
     126        * inspector/front-end/networkPanel.css:
     127        (.network-cell-subtitle):
     128        (.network-header-subtitle):
     129        (#network-views .network-item-view .tabbed-pane-header):
     130        (#network-views.small .network-item-view .tabbed-pane-header):
     131        (.network-item-view):
     132        (.network-item-view.visible):
     133        (.network-item-view .tabbed-pane-header):
     134        (.network-item-view .scope-bar li):
     135        (.resource-headers-view):
     136        (.resource-headers-view.visible):
     137        (.resource-headers-view .outline-disclosure .parent):
     138        (.resource-headers-view .outline-disclosure .children li):
     139        (.resource-headers-view .outline-disclosure li.expanded .header-count):
     140        (.resource-headers-view .outline-disclosure .header-name):
     141        (.resource-headers-view .outline-disclosure .header-value):
     142        (.resource-headers-view .outline-disclosure .raw-form-data):
     143        (.resource-cookies-view):
     144        (.resource-cookies-view.visible):
     145        (.resource-cookies-view .data-grid):
     146        (.resource-cookies-view .data-grid .row-group):
     147
    11482010-11-24  Pavel Feldman  <pfeldman@chromium.org>
    2149
  • trunk/WebCore/WebCore.gypi

    r72591 r72655  
    44344434            'inspector/front-end/CookieItemsView.js',
    44354435            'inspector/front-end/CookieParser.js',
     4436            'inspector/front-end/CookiesTable.js',
    44364437            'inspector/front-end/CSSCompletions.js',
    44374438            'inspector/front-end/CSSStyleModel.js',
     
    44684469            'inspector/front-end/KeyboardShortcut.js',
    44694470            'inspector/front-end/MetricsSidebarPane.js',
     4471            'inspector/front-end/NetworkItemView.js',
    44704472            'inspector/front-end/NetworkPanel.js',
    44714473            'inspector/front-end/Object.js',
     
    44834485            'inspector/front-end/Resource.js',
    44844486            'inspector/front-end/ResourceCategory.js',
     4487            'inspector/front-end/ResourceCookiesView.js',
    44854488            'inspector/front-end/ResourceManager.js',
     4489            'inspector/front-end/ResourceHeadersView.js',
    44864490            'inspector/front-end/ResourceView.js',
    44874491            'inspector/front-end/ResourcesPanel.js',
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r72590 r72655  
    6475164751                                </File>
    6475264752                                <File
     64753                                        RelativePath="..\inspector\front-end\CookiesTable.js"
     64754                                        >
     64755                                </File>
     64756                                <File
    6475364757                                        RelativePath="..\inspector\front-end\CookieParser.js"
    6475464758                                        >
     
    6490764911                                </File>
    6490864912                                <File
     64913                                        RelativePath="..\inspector\front-end\NetworkItemView.js"
     64914                                        >
     64915                                </File>
     64916                                <File
    6490964917                                        RelativePath="..\inspector\front-end\NetworkPanel.js"
    6491064918                                        >
     
    6496864976                                <File
    6496964977                                        RelativePath="..\inspector\front-end\ResourceCategory.js"
     64978                                        >
     64979                                </File>
     64980                                <File
     64981                                        RelativePath="..\inspector\front-end\ResourceCookiesView.js"
     64982                                        >
     64983                                </File>
     64984                                <File
     64985                                        RelativePath="..\inspector\front-end\ResourceHeadersView.js"
    6497064986                                        >
    6497164987                                </File>
  • trunk/WebCore/inspector/front-end/CookieItemsView.js

    r70853 r72655  
    2828 */
    2929
    30 WebInspector.CookiesTable = function()
     30WebInspector.CookieItemsView = function(treeElement, cookieDomain)
    3131{
    3232    WebInspector.View.call(this);
    3333
    34     this.element.addStyleClass("table");
    35 }
    36 
    37 WebInspector.CookiesTable.prototype = {
    38     resize: function()
    39     {
    40         if (!this._dataGrid)
    41             return;
    42 
    43         if (this._autoSizingDone)
    44             this._dataGrid.updateWidths();
    45         else {
    46             this._autoSizingDone = true;
    47             this._dataGrid.autoSizeColumns(4, 45, 1);
    48         }
    49     },
    50 
    51     _createDataGrid: function(expandable)
    52     {
    53         var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
    54         columns[0].title = WebInspector.UIString("Name");
    55         columns[0].sortable = true;
    56         columns[0].disclosure = expandable;
    57         columns[1].title = WebInspector.UIString("Value");
    58         columns[1].sortable = true;
    59         columns[2].title = WebInspector.UIString("Domain");
    60         columns[2].sortable = true;
    61         columns[3].title = WebInspector.UIString("Path");
    62         columns[3].sortable = true;
    63         columns[4].title = WebInspector.UIString("Expires");
    64         columns[4].sortable = true;
    65         columns[5].title = WebInspector.UIString("Size");
    66         columns[5].aligned = "right";
    67         columns[5].sortable = true;
    68         columns[6].title = WebInspector.UIString("HTTP");
    69         columns[6].aligned = "centered";
    70         columns[6].sortable = true;
    71         columns[7].title = WebInspector.UIString("Secure");
    72         columns[7].aligned = "centered";
    73         columns[7].sortable = true;
    74 
    75         var deleteCallback = this._deleteCookieCallback ? this._deleteCookieCallback.bind(this) : null;
    76         this._dataGrid = new WebInspector.DataGrid(columns, null, deleteCallback);
    77         this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
    78         this.element.appendChild(this._dataGrid.element);
    79     },
    80 
    81     _populateCookies: function(parentNode, cookies)
    82     {
    83         var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null;
    84         parentNode.removeChildren();
    85         if (!cookies)
    86             return;
    87         this._sortCookies(cookies);
    88         var totalSize = 0;
    89         for (var i = 0; i < cookies.length; ++i) {
    90             var cookieNode = this._createGridNode(cookies[i]);
    91             parentNode.appendChild(cookieNode);
    92             if (selectedCookie === cookies[i])
    93                 cookieNode.selected = true;
    94         }
    95     },
    96 
    97     _sortCookies: function(cookies)
    98     {
    99         var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
    100 
    101         function localeCompare(field, cookie1, cookie2)
    102         {
    103             return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")
    104         }
    105 
    106         function numberCompare(field, cookie1, cookie2)
    107         {
    108             return sortDirection * (cookie1[field] - cookie2[field]);
    109         }
    110 
    111         function expiresCompare(cookie1, cookie2)
    112         {
    113             if (cookie1.session !== cookie2.session)
    114                 return sortDirection * (cookie1.session ? 1 : -1);
    115 
    116             if (cookie1.session)
    117                 return 0;
    118 
    119             return sortDirection * (cookie1.expires - cookie2.expires);
    120         }
    121 
    122         var comparator;
    123         switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
    124             case 0: comparator = localeCompare.bind(this, "name"); break;
    125             case 1: comparator = localeCompare.bind(this, "value"); break;
    126             case 2: comparator = localeCompare.bind(this, "domain"); break;
    127             case 3: comparator = localeCompare.bind(this, "path"); break;
    128             case 4: comparator = expiresCompare; break;
    129             case 5: comparator = numberCompare.bind(this, "size"); break;
    130             case 6: comparator = localeCompare.bind(this, "httpOnly"); break;
    131             case 7: comparator = localeCompare.bind(this, "secure"); break;
    132             default: localeCompare.bind(this, "name");
    133         }
    134 
    135         cookies.sort(comparator);
    136     },
    137 
    138     _createGridNode: function(cookie)
    139     {
    140         var data = {};
    141         data[0] = cookie.name;
    142         data[1] = cookie.value;
    143         data[2] = cookie.domain || "";
    144         data[3] = cookie.path || "";
    145         data[4] = cookie.type === WebInspector.Cookie.Type.Request ? "" :
    146             (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());
    147         data[5] = cookie.size;
    148         data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark
    149         data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark
    150 
    151         var node = new WebInspector.DataGridNode(data);
    152         node.cookie = cookie;
    153         node.selectable = true;
    154         return node;
    155     }
    156 };
    157 
    158 WebInspector.CookiesTable.prototype.__proto__ = WebInspector.View.prototype;
    159 
    160 WebInspector.CookieItemsView = function(treeElement, cookieDomain)
    161 {
    162     WebInspector.CookiesTable.call(this);
    163 
    16434    this.element.addStyleClass("storage-view");
    16535
    166     this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
    167     this.deleteButton.visible = false;
    168     this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
    169 
    170     this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
    171     this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
    172    
     36    this._deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
     37    this._deleteButton.visible = false;
     38    this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
     39
     40    this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
     41    this._refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
     42
    17343    this._treeElement = treeElement;
    17444    this._cookieDomain = cookieDomain;
     
    18353    get statusBarItems()
    18454    {
    185         return [this.refreshButton.element, this.deleteButton.element];
     55        return [this._refreshButton.element, this._deleteButton.element];
    18656    },
    18757
     
    19565    {
    19666        WebInspector.View.prototype.hide.call(this);
    197         this.deleteButton.visible = false;
     67        this._deleteButton.visible = false;
     68    },
     69
     70    resize: function()
     71    {
     72        if (this._cookiesTable)
     73            this._cookiesTable.updateWidths();
    19874    },
    19975
     
    20581    _updateWithCookies: function(allCookies, isAdvanced)
    20682    {
    207         if (isAdvanced)
    208             this._filterCookiesForDomain(allCookies);
    209         else
    210             this._cookies = allCookies;
     83        this._cookies = isAdvanced ? this._filterCookiesForDomain(allCookies) : allCookies;
     84
    21185        if (!this._cookies.length) {
    21286            // Nothing to show.
    21387            this._emptyMsgElement.removeStyleClass("hidden");
    214             this.deleteButton.visible = false;
    215             if (this._dataGrid)
    216                 this._dataGrid.element.addStyleClass("hidden");
     88            this._deleteButton.visible = false;
     89            if (this._cookiesTable)
     90                this._cookiesTable.element.addStyleClass("hidden");
    21791            return;
    21892        }
    21993
    220         if (!this._dataGrid) {
    221             if (isAdvanced) {
    222                 this._createDataGrid();
    223                 this._populateDataGrid();
    224                 this._dataGrid.autoSizeColumns(6, 33);
    225                 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
    226                     Number.bytesToString(this._totalSize, WebInspector.UIString));
    227             } else {
    228                 this._createSimpleDataGrid();
    229                 this._populateSimpleDataGrid();
    230                 this._dataGrid.autoSizeColumns(20, 80);
    231             }
    232         } else {
    233             if (isAdvanced)
    234                 this._populateDataGrid();
    235             else
    236                 this._populateSimpleDataGrid();
    237         }
    238 
    239         this._dataGrid.element.removeStyleClass("hidden");
     94        if (!this._cookiesTable) {
     95            this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this)) : new WebInspector.SimpleCookiesTable();
     96            this.element.appendChild(this._cookiesTable.element);
     97        }
     98
     99        this._cookiesTable.setCookies(this._cookies);
     100        this._cookiesTable.element.removeStyleClass("hidden");
    240101        this._emptyMsgElement.addStyleClass("hidden");
    241         if (isAdvanced)
    242             this.deleteButton.visible = true;
     102        if (isAdvanced) {
     103            this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
     104                Number.bytesToString(this._totalSize, WebInspector.UIString));
     105            this._deleteButton.visible = true;
     106        }
    243107    },
    244108
    245109    _filterCookiesForDomain: function(allCookies)
    246110    {
    247         this._cookies = [];
     111        var cookies = [];
    248112        var resourceURLsForDocumentURL = [];
    249113        this._totalSize = 0;
     
    266130                    if (!pushed) {
    267131                        pushed = true;
    268                         this._cookies.push(allCookies[i]);
     132                        cookies.push(allCookies[i]);
    269133                    }
    270134                }
    271135            }
    272136        }
    273     },
    274 
    275     _populateDataGrid: function()
    276     {
    277         this._populateCookies(this._dataGrid, this._cookies);
    278     },
    279 
    280     _createSimpleDataGrid: function()
    281     {
    282         var columns = {};
    283         columns[0] = {};
    284         columns[1] = {};
    285         columns[0].title = WebInspector.UIString("Name");
    286         columns[1].title = WebInspector.UIString("Value");
    287 
    288         this._dataGrid = new WebInspector.DataGrid(columns);
    289         this.element.appendChild(this._dataGrid.element);
    290         this._dataGrid.updateWidths();
    291     },
    292 
    293     _populateSimpleDataGrid: function()
    294     {
    295         var cookies = this._cookies;
     137        return cookies;
     138    },
     139
     140    _deleteCookie: function(cookie)
     141    {
     142        InspectorBackend.deleteCookie(cookie.name, this._cookieDomain);
     143        this._update();
     144    },
     145
     146    _deleteButtonClicked: function()
     147    {
     148        if (this._cookiesTable.selectedCookie)
     149            this._deleteCookie(this._cookiesTable.selectedCookie);
     150    },
     151
     152    _refreshButtonClicked: function(event)
     153    {
     154        this._update();
     155    }
     156}
     157
     158WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype;
     159
     160WebInspector.SimpleCookiesTable = function()
     161{
     162    this.element = document.createElement("div");
     163    var columns = {};
     164    columns[0] = {};
     165    columns[1] = {};
     166    columns[0].title = WebInspector.UIString("Name");
     167    columns[1].title = WebInspector.UIString("Value");
     168
     169    this._dataGrid = new WebInspector.DataGrid(columns);
     170    this._dataGrid.autoSizeColumns(20, 80);
     171    this.element.appendChild(this._dataGrid.element);
     172    this._dataGrid.updateWidths();
     173}
     174
     175WebInspector.SimpleCookiesTable.prototype = {
     176    setCookies: function(cookies)
     177    {
    296178        this._dataGrid.removeChildren();
    297179        var addedCookies = {};
     
    311193    },
    312194
    313     _deleteButtonClicked: function(event)
    314     {
    315         if (!this._dataGrid || !this._dataGrid.selectedNode)
    316             return;
    317 
    318         this._deleteCookieCallback(this._dataGrid.selectedNode);
    319     },
    320 
    321     _deleteCookieCallback: function(node)
    322     {
    323         var cookie = node.cookie;
    324         InspectorBackend.deleteCookie(cookie.name, this._cookieDomain);
    325         this._update();
    326     },
    327 
    328     _refreshButtonClicked: function(event)
    329     {
    330         this._update();
     195    resize: function()
     196    {
     197        if (this._dataGrid)
     198            this._dataGrid.updateWidths();
    331199    }
    332200}
    333 
    334 WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.CookiesTable.prototype;
    335 
  • trunk/WebCore/inspector/front-end/FileSystemView.js

    r71366 r72655  
    126126    _selectFileSystemTab: function()
    127127    {
    128         this._tabbedPane.selectTabById("persistent");
     128        this._tabbedPane.selectTab("persistent");
    129129    },
    130130   
    131131    selectTemporaryFileSystemTab: function()
    132132    {
    133         this._tabbedPane.selectTabById("temp");
     133        this._tabbedPane.selectTab("temp");
    134134    },
    135135
  • trunk/WebCore/inspector/front-end/FontView.js

    r70529 r72655  
    3535
    3636WebInspector.FontView.prototype = {
    37     hasContentTab: function()
     37    hasContent: function()
    3838    {
    3939        return true;
    4040    },
    4141
    42     contentTabSelected: function()
     42    _createContentIfNeeded: function()
    4343    {
    4444        if (this.fontPreviewElement)
     
    5252
    5353        this.fontPreviewElement = document.createElement("div");
    54         this.contentElement.appendChild(this.fontPreviewElement);
     54        this.element.appendChild(this.fontPreviewElement);
    5555
    5656        this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null);
     
    6464    {
    6565        WebInspector.ResourceView.prototype.show.call(this, parentElement);
     66        this._createContentIfNeeded();
    6667        this.updateFontPreviewSize();
    6768    },
     
    8788
    8889        // Subtract some padding. This should match the padding in the CSS plus room for the scrollbar.
    89         const containerWidth = this.contentElement.offsetWidth - 50;
     90        const containerWidth = this.element.offsetWidth - 50;
    9091
    9192        if (!height || !width || !containerWidth) {
  • trunk/WebCore/inspector/front-end/ImageView.js

    r71254 r72655  
    3535
    3636WebInspector.ImageView.prototype = {
    37     hasContentTab: function()
     37    hasContent: function()
    3838    {
    3939        return true;
    4040    },
    4141
    42     contentTabSelected: function()
     42    show: function(parentElement)
     43    {
     44        WebInspector.ResourceView.prototype.show.call(this, parentElement);
     45        this._createContentIfNeeded();
     46    },
     47
     48    _createContentIfNeeded: function()
    4349    {
    4450        if (this._container)
    4551            return;
    46         this._container = document.createElement("div");
    47         this._container.className = "image";
    48         this.contentElement.appendChild(this._container);
     52
     53        var imageContainer = document.createElement("div");
     54        imageContainer.className = "image";
     55        this.element.appendChild(imageContainer);
    4956
    5057        var imagePreviewElement = document.createElement("img");
    5158        imagePreviewElement.addStyleClass("resource-image-view");
    52         this._container.appendChild(imagePreviewElement);
     59        imageContainer.appendChild(imagePreviewElement);
    5360
    5461        this._container = document.createElement("div");
    5562        this._container.className = "info";
    56         this.contentElement.appendChild(this._container);
     63        this.element.appendChild(this._container);
    5764
    5865        var imageNameElement = document.createElement("h1");
  • trunk/WebCore/inspector/front-end/NetworkPanel.js

    r72375 r72655  
    22 * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
    33 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
    4  * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
     4 * Copyright (C) 2010 Google Inc. All rights reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    642642    {
    643643        WebInspector.Panel.prototype.show.call(this);
    644 
    645644        this._refreshIfNeeded();
    646645
    647         var visibleView = this.visibleView;
    648         if (this.visibleResource) {
    649             this.visibleView.headersVisible = true;
     646        if (this.visibleView)
    650647            this.visibleView.show(this._viewsContainerElement);
    651         } else if (visibleView)
    652             visibleView.show();
    653 
    654         // Hide any views that are visible that are not this panel's current visible view.
    655         // This can happen when a ResourceView is visible in the Scripts panel then switched
    656         // to the this panel.
    657         var resourcesLength = this._resources.length;
    658         for (var i = 0; i < resourcesLength; ++i) {
    659             var resource = this._resources[i];
    660             var view = resource._resourcesView;
    661             if (!view || view === visibleView)
    662                 continue;
    663             view.visible = false;
    664         }
     648
    665649        this._dataGrid.updateWidths();
    666650        this._positionSummaryBar();
     
    695679    {
    696680        WebInspector.Panel.prototype.performSearch.call(this, query);
    697     },
    698 
    699     get visibleView()
    700     {
    701         if (this.visibleResource)
    702             return this.visibleResource._resourcesView;
    703         return null;
    704681    },
    705682
     
    830807        resource._resourcesView = newView;
    831808
    832         newView.headersVisible = oldView.headersVisible;
    833 
    834809        if (oldViewParentNode)
    835810            newView.show(oldViewParentNode);
     
    857832        this._toggleViewingResourceMode();
    858833
    859         if (this.visibleResource && this.visibleResource._resourcesView)
    860             this.visibleResource._resourcesView.hide();
    861 
    862         var view = WebInspector.ResourceManager.resourceViewForResource(resource);
    863         view.headersVisible = true;
     834        if (this.visibleView) {
     835            this.visibleView.detach();
     836            delete this.visibleView;
     837        }
     838
     839        var view = new WebInspector.NetworkItemView(resource);
    864840        view.show(this._viewsContainerElement);
    865 
    866         if (line) {
    867             view.selectContentTab();
    868             if (view.revealLine)
    869                 view.revealLine(line);
    870             if (view.highlightLine)
    871                 view.highlightLine(line);
    872         }
    873 
    874         this.visibleResource = resource;
     841        this.visibleView = view;
     842
    875843        this.updateSidebarWidth();
    876844    },
     
    880848        this.element.removeStyleClass("viewing-resource");
    881849
    882         if (this.visibleResource && this.visibleResource._resourcesView)
    883             this.visibleResource._resourcesView.hide();
    884         delete this.visibleResource;
     850        if (this.visibleView) {
     851            this.visibleView.detach();
     852            delete this.visibleView;
     853        }
    885854
    886855        if (this._lastSelectedGraphTreeElement)
  • trunk/WebCore/inspector/front-end/ResourceView.js

    r72072 r72655  
    88 *
    99 * 1.  Redistributions of source code must retain the above copyright
    10  *     notice, this list of conditions and the following disclaimer. 
     10 *     notice, this list of conditions and the following disclaimer.
    1111 * 2.  Redistributions in binary form must reproduce the above copyright
    1212 *     notice, this list of conditions and the following disclaimer in the
    13  *     documentation and/or other materials provided with the distribution. 
     13 *     documentation and/or other materials provided with the distribution.
    1414 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
    1515 *     its contributors may be used to endorse or promote products derived
    16  *     from this software without specific prior written permission. 
     16 *     from this software without specific prior written permission.
    1717 *
    1818 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     
    3131{
    3232    WebInspector.View.call(this);
    33 
    3433    this.element.addStyleClass("resource-view");
    35 
    3634    this.resource = resource;
    37 
    38     this.tabbedPane = new WebInspector.TabbedPane(this.element);
    39 
    40     this.headersElement = document.createElement("div");
    41     this.headersElement.className = "resource-view-headers";
    42     this.tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this.headersElement, this._selectTab.bind(this, "headers"));
    43 
    44     if (this.hasContentTab()) {
    45         this.contentElement = document.createElement("div");
    46         this.contentElement.className = "resource-view-content";
    47         this.tabbedPane.appendTab("content", WebInspector.UIString("Content"), this.contentElement, this._selectTab.bind(this, "content"));
    48     }
    49 
    50     this.headersListElement = document.createElement("ol");
    51     this.headersListElement.className = "outline-disclosure";
    52     this.headersElement.appendChild(this.headersListElement);
    53 
    54     this.headersTreeOutline = new TreeOutline(this.headersListElement);
    55     this.headersTreeOutline.expandTreeElementsWhenArrowing = true;
    56 
    57     this.urlTreeElement = new TreeElement("", null, false);
    58     this.urlTreeElement.selectable = false;
    59     this.headersTreeOutline.appendChild(this.urlTreeElement);
    60 
    61     this.requestMethodTreeElement = new TreeElement("", null, false);
    62     this.requestMethodTreeElement.selectable = false;
    63     this.headersTreeOutline.appendChild(this.requestMethodTreeElement);
    64 
    65     this.statusCodeTreeElement = new TreeElement("", null, false);
    66     this.statusCodeTreeElement.selectable = false;
    67     this.headersTreeOutline.appendChild(this.statusCodeTreeElement);
    68      
    69     this.requestHeadersTreeElement = new TreeElement("", null, true);
    70     this.requestHeadersTreeElement.expanded = true;
    71     this.requestHeadersTreeElement.selectable = false;
    72     this.headersTreeOutline.appendChild(this.requestHeadersTreeElement);
    73 
    74     this._decodeHover = WebInspector.UIString("Double-Click to toggle between URL encoded and decoded formats");
    75     this._decodeRequestParameters = true;
    76 
    77     this.queryStringTreeElement = new TreeElement("", null, true);
    78     this.queryStringTreeElement.expanded = true;
    79     this.queryStringTreeElement.selectable = false;
    80     this.queryStringTreeElement.hidden = true;
    81     this.headersTreeOutline.appendChild(this.queryStringTreeElement);
    82 
    83     this.formDataTreeElement = new TreeElement("", null, true);
    84     this.formDataTreeElement.expanded = true;
    85     this.formDataTreeElement.selectable = false;
    86     this.formDataTreeElement.hidden = true;
    87     this.headersTreeOutline.appendChild(this.formDataTreeElement);
    88 
    89     this.requestPayloadTreeElement = new TreeElement(WebInspector.UIString("Request Payload"), null, true);
    90     this.requestPayloadTreeElement.expanded = true;
    91     this.requestPayloadTreeElement.selectable = false;
    92     this.requestPayloadTreeElement.hidden = true;
    93     this.headersTreeOutline.appendChild(this.requestPayloadTreeElement);
    94 
    95     this.responseHeadersTreeElement = new TreeElement("", null, true);
    96     this.responseHeadersTreeElement.expanded = true;
    97     this.responseHeadersTreeElement.selectable = false;
    98     this.headersTreeOutline.appendChild(this.responseHeadersTreeElement);
    99 
    100     this.headersVisible = true;
    101 
    102     resource.addEventListener("requestHeaders changed", this._refreshRequestHeaders, this);
    103     resource.addEventListener("responseHeaders changed", this._refreshResponseHeaders, this);
    104     resource.addEventListener("finished", this._refreshHTTPInformation, this);
    105 
    106     this._refreshURL();
    107     this._refreshQueryString();
    108     this._refreshRequestHeaders();
    109     this._refreshResponseHeaders();
    110     this._refreshHTTPInformation();
    111     this._selectTab();
    11235}
    11336
    11437WebInspector.ResourceView.prototype = {
    115     attach: function()
     38    hasContent: function()
    11639    {
    117         if (!this.element.parentNode) {
    118             var parentElement = (document.getElementById("resource-views") || document.getElementById("script-resource-views"));
    119             if (parentElement)
    120                 parentElement.appendChild(this.element);
    121         }
    122     },
    123 
    124     show: function(parentElement)
    125     {
    126         WebInspector.View.prototype.show.call(this, parentElement);
    127         this._selectTab();
    128     },
    129 
    130     set headersVisible(x)
    131     {
    132         if (x === this._headersVisible)
    133             return;
    134         this._headersVisible = x;
    135         if (x)
    136             this.element.addStyleClass("headers-visible");
    137         else
    138             this.element.removeStyleClass("headers-visible");
    139         this._selectTab();
    140     },
    141 
    142     resize: function()
    143     {
    144         if (this._cookiesView && !this._cookiesView.element.hasStyleClass("hidden"))
    145             this._cookiesView.resize();
    146     },
    147 
    148     selectContentTab: function()
    149     {
    150         this._selectTab("content");
    151     },
    152 
    153     _selectTab: function(tab)
    154     {
    155         if (tab)
    156             WebInspector.settings.resourceViewTab = tab;
    157         else {
    158             var preferredTab = WebInspector.settings.resourceViewTab;
    159             tab = "content";
    160 
    161             // Honor user tab preference (if we can). Fallback to content if headers not visible, headers otherwise.
    162             if (this._headersVisible)
    163                 tab = this.tabbedPane.hasTab(preferredTab) ? preferredTab : "headers";
    164         }
    165         this.tabbedPane.selectTabById(tab);
    166         if (tab === "content" && this.hasContentTab())
    167             this.contentTabSelected();
    168     },
    169 
    170     hasContentTab: function()
    171     {
    172         // Derived classes should override this method and define this.contentTabSelected for content rendering.
    17340        return false;
    174     },
    175 
    176     _refreshURL: function()
    177     {
    178         this.urlTreeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +
    179             "<div class=\"header-value source-code\">" + this.resource.url.escapeHTML() + "</div>";
    180     },
    181 
    182     _refreshQueryString: function()
    183     {
    184         var queryParameters = this.resource.queryParameters;
    185         this.queryStringTreeElement.hidden = !queryParameters;
    186         if (queryParameters)
    187             this._refreshParms(WebInspector.UIString("Query String Parameters"), queryParameters, this.queryStringTreeElement);
    188     },
    189 
    190     _refreshFormData: function()
    191     {
    192         this.formDataTreeElement.hidden = true;
    193         this.requestPayloadTreeElement.hidden = true;
    194 
    195         var formData = this.resource.requestFormData;
    196         if (!formData)
    197             return;
    198 
    199         var formParameters = this.resource.formParameters;
    200         if (formParameters) {
    201             this.formDataTreeElement.hidden = false;
    202             this._refreshParms(WebInspector.UIString("Form Data"), formParameters, this.formDataTreeElement);
    203         } else {
    204             this.requestPayloadTreeElement.hidden = false;
    205             this._refreshRequestPayload(formData);
    206         }
    207     },
    208 
    209     _refreshRequestPayload: function(formData)
    210     {
    211         this.requestPayloadTreeElement.removeChildren();
    212 
    213         var title = "<div class=\"raw-form-data header-value source-code\">" + formData.escapeHTML() + "</div>";
    214         var parmTreeElement = new TreeElement(null, null, false);
    215         parmTreeElement.titleHTML = title;
    216         parmTreeElement.selectable = false;
    217         this.requestPayloadTreeElement.appendChild(parmTreeElement);
    218     },
    219 
    220     _refreshParms: function(title, parms, parmsTreeElement)
    221     {
    222         parmsTreeElement.removeChildren();
    223 
    224         parmsTreeElement.titleHTML = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>";
    225 
    226         for (var i = 0; i < parms.length; ++i) {
    227             var name = parms[i].name;
    228             var value = parms[i].value;
    229 
    230             var errorDecoding = false;
    231             if (this._decodeRequestParameters) {
    232                 if (value.indexOf("%") >= 0) {
    233                     try {
    234                         value = decodeURIComponent(value);
    235                     } catch(e) {
    236                         errorDecoding = true;
    237                     }
    238                 }
    239                    
    240                 value = value.replace(/\+/g, " ");
    241             }
    242 
    243             valueEscaped = value.escapeHTML();
    244             if (errorDecoding)
    245                 valueEscaped += " <span class=\"error-message\">" + WebInspector.UIString("(unable to decode value)").escapeHTML() + "</span>";
    246 
    247             var title = "<div class=\"header-name\">" + name.escapeHTML() + ":</div>";
    248             title += "<div class=\"header-value source-code\">" + valueEscaped + "</div>";
    249 
    250             var parmTreeElement = new TreeElement(null, null, false);
    251             parmTreeElement.titleHTML = title;
    252             parmTreeElement.selectable = false;
    253             parmTreeElement.tooltip = this._decodeHover;
    254             parmTreeElement.ondblclick = this._toggleURLdecoding.bind(this);
    255             parmsTreeElement.appendChild(parmTreeElement);
    256         }
    257     },
    258 
    259     _toggleURLdecoding: function(event)
    260     {
    261         this._decodeRequestParameters = !this._decodeRequestParameters;
    262         this._refreshQueryString();
    263         this._refreshFormData();
    264     },
    265 
    266     _getHeaderValue: function(headers, key)
    267     {
    268         var lowerKey = key.toLowerCase();
    269         for (var testKey in headers) {
    270             if (testKey.toLowerCase() === lowerKey)
    271                 return headers[testKey];
    272         }
    273     },
    274 
    275     _refreshRequestHeaders: function()
    276     {
    277         var additionalRow = null;
    278         if (typeof this.resource.webSocketRequestKey3 !== "undefined")
    279             additionalRow = {header: "(Key3)", value: this.resource.webSocketRequestKey3};
    280         this._refreshHeaders(WebInspector.UIString("Request Headers"), this.resource.sortedRequestHeaders, additionalRow, this.requestHeadersTreeElement);
    281         this._refreshFormData();
    282         this._refreshCookies();
    283     },
    284 
    285     _refreshResponseHeaders: function()
    286     {
    287         var additionalRow = null;
    288         if (typeof this.resource.webSocketChallengeResponse !== "undefined")
    289             additionalRow = {header: "(Challenge Response)", value: this.resource.webSocketChallengeResponse};
    290         this._refreshHeaders(WebInspector.UIString("Response Headers"), this.resource.sortedResponseHeaders, additionalRow, this.responseHeadersTreeElement);
    291         this._refreshCookies();
    292     },
    293 
    294     _refreshHTTPInformation: function()
    295     {
    296         var requestMethodElement = this.requestMethodTreeElement;
    297         requestMethodElement.hidden = !this.resource.statusCode;
    298         var statusCodeElement = this.statusCodeTreeElement;
    299         statusCodeElement.hidden = !this.resource.statusCode;
    300         var statusCodeImage = "";
    301 
    302         if (this.resource.statusCode) {
    303             var statusImageSource = "";
    304             if (this.resource.statusCode < 300)
    305                 statusImageSource = "Images/successGreenDot.png";
    306             else if (this.resource.statusCode < 400)
    307                 statusImageSource = "Images/warningOrangeDot.png";
    308             else
    309                 statusImageSource = "Images/errorRedDot.png";
    310 
    311             var statusTextEscaped = this.resource.statusCode + " " + this.resource.statusText.escapeHTML();
    312             statusCodeImage = "<img class=\"resource-status-image\" src=\"" + statusImageSource + "\" title=\"" + statusTextEscaped + "\">";
    313    
    314             requestMethodElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>" +
    315                 "<div class=\"header-value source-code\">" + this.resource.requestMethod + "</div>";
    316 
    317             statusCodeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>" +
    318                 statusCodeImage + "<div class=\"header-value source-code\">" + statusTextEscaped + "</div>";
    319         }
    320     },
    321    
    322     _refreshHeaders: function(title, headers, additionalRow, headersTreeElement)
    323     {
    324         headersTreeElement.removeChildren();
    325 
    326         var length = headers.length;
    327         headersTreeElement.titleHTML = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>";
    328         headersTreeElement.hidden = !length;
    329 
    330         var length = headers.length;
    331         for (var i = 0; i < length; ++i) {
    332             var title = "<div class=\"header-name\">" + headers[i].header.escapeHTML() + ":</div>";
    333             title += "<div class=\"header-value source-code\">" + headers[i].value.escapeHTML() + "</div>"
    334 
    335             var headerTreeElement = new TreeElement(null, null, false);
    336             headerTreeElement.titleHTML = title;
    337             headerTreeElement.selectable = false;
    338             headersTreeElement.appendChild(headerTreeElement);
    339         }
    340 
    341         if (additionalRow) {
    342             var title = "<div class=\"header-name\">" + additionalRow.header.escapeHTML() + ":</div>";
    343             title += "<div class=\"header-value source-code\">" + additionalRow.value.escapeHTML() + "</div>"
    344 
    345             var headerTreeElement = new TreeElement(null, null, false);
    346             headerTreeElement.titleHTML = title;
    347             headerTreeElement.selectable = false;
    348             headersTreeElement.appendChild(headerTreeElement);
    349         }
    350     },
    351 
    352     _refreshCookies: function()
    353     {
    354         if (!this._cookiesView) {
    355             if (!this.resource.requestCookies && !this.resource.responseCookies)
    356                 return;
    357             this._cookiesView = new WebInspector.ResourceCookiesTab();
    358             this.tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView, this._selectTab.bind(this, "cookies"));
    359         }
    360         this._cookiesView.requestCookies = this.resource.requestCookies;
    361         this._cookiesView.responseCookies = this.resource.responseCookies;
    36241    }
    36342}
    36443
    36544WebInspector.ResourceView.prototype.__proto__ = WebInspector.View.prototype;
    366 
    367 WebInspector.ResourceCookiesTab = function()
    368 {
    369     WebInspector.CookiesTable.call(this);
    370     this.element.addStyleClass("resource-view-cookies");
    371     this._requestCookies = [];
    372     this._responseCookies = [];
    373     this._createDataGrid(true);
    374     this._requestCookiesNode = this._createFolder(WebInspector.UIString("Request Cookies"));
    375     this._responseCookiesNode = this._createFolder(WebInspector.UIString("Response Cookies"));
    376 }
    377 
    378 WebInspector.ResourceCookiesTab.prototype = {
    379     show: function(parentElement)
    380     {
    381         WebInspector.CookiesTable.prototype.show.call(this, parentElement);
    382         this.resize();
    383     },
    384 
    385     set requestCookies(cookies)
    386     {
    387         if (this._requestCookies === cookies)
    388             return;
    389         this._requestCookies = cookies;
    390         this._populateCookies(this._requestCookiesNode, this._requestCookies);
    391     },
    392 
    393     set responseCookies(cookies)
    394     {
    395         if (this._responseCookies === cookies)
    396             return;
    397         this._responseCookies = cookies;
    398         this._populateCookies(this._responseCookiesNode, this._responseCookies);
    399     },
    400 
    401     _populateDataGrid: function()
    402     {
    403         this._populateCookies(this._requestCookiesNode, this._requestCookies);
    404         this._populateCookies(this._responseCookiesNode, this._responseCookies);
    405     },
    406 
    407     _populateCookies: function(parentNode, cookies)
    408     {
    409         WebInspector.CookiesTable.prototype._populateCookies.call(this, parentNode, cookies);
    410         var totalSize = 0;
    411         if (cookies) {
    412             for (var i = 0; i < cookies.length; ++i)
    413                 totalSize += cookies[i].size;
    414         }
    415         parentNode.expanded = true;
    416         parentNode.data[5] = totalSize;
    417         parentNode.refresh();
    418     },
    419 
    420     _createFolder: function(name)
    421     {
    422         var data = [ name, "", "", "", "", 0, "", "" ];
    423         var node = new WebInspector.DataGridNode(data);
    424         node.selectable = true;
    425         node.expanded = true;
    426         this._dataGrid.appendChild(node);
    427         node.element.addStyleClass("row-group");
    428         return node;
    429     }
    430 };
    431 
    432 WebInspector.ResourceCookiesTab.prototype.__proto__ = WebInspector.CookiesTable.prototype;
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r72654 r72655  
    105105        WebInspector.Panel.prototype.show.call(this);
    106106
    107         if (this.visibleView instanceof WebInspector.ResourceView) {
    108             // SourceViews are shared between the panels.
    109             this.visibleView.headersVisible = false;
     107        if (this.visibleView instanceof WebInspector.ResourceView)
    110108            this.visibleView.show(this.storageViews);
    111         }
    112109
    113110        if (this._initializedDefaultSelection)
     
    380377        if (line) {
    381378            var view = WebInspector.ResourceManager.resourceViewForResource(resource);
    382             view.selectContentTab();
    383379            if (view.revealLine)
    384380                view.revealLine(line);
     
    392388    {
    393389        var view = WebInspector.ResourceManager.resourceViewForResource(resource);
    394         view.headersVisible = false;
    395390        this._innerShowView(view);
    396391    },
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r72462 r72655  
    214214        this.sidebarResizeElement.style.right = (this.sidebarElement.offsetWidth - 3) + "px";
    215215
    216         if (this.visibleView) {
    217             if (this.visibleView instanceof WebInspector.ResourceView)
    218                 this.visibleView.headersVisible = false;
     216        if (this.visibleView)
    219217            this.visibleView.show(this.viewsContainerElement);
    220         }
     218
    221219        if (this._attachDebuggerWhenShown) {
    222220            InspectorBackend.enableDebugger(false);
     
    599597
    600598        var view;
    601         if (scriptOrResource instanceof WebInspector.Resource) {
     599        if (scriptOrResource instanceof WebInspector.Resource)
    602600            view = WebInspector.ResourceManager.resourceViewForResource(scriptOrResource);
    603             view.headersVisible = false;
    604         } else if (scriptOrResource instanceof WebInspector.Script)
     601        else if (scriptOrResource instanceof WebInspector.Script)
    605602            view = this.scriptViewForScript(scriptOrResource);
    606603
  • trunk/WebCore/inspector/front-end/SourceView.js

    r71254 r72655  
    3434
    3535    var canEditScripts = WebInspector.panels.scripts && WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script;
    36     this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));
     36    this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));
    3737    resource.addEventListener("finished", this._resourceLoadingFinished, this);
    3838    this._frameNeedsSetup = true;
     
    5151    {
    5252        WebInspector.ResourceView.prototype.show.call(this, parentElement);
     53        this.setupSourceFrameIfNeeded();
    5354        this.sourceFrame.visible = true;
    54         if (this.localSourceFrame)
    55             this.localSourceFrame.visible = true;
    5655        this.resize();
    5756    },
     
    6362            this.sourceFrame.clearLineHighlight();
    6463        WebInspector.View.prototype.hide.call(this);
    65         if (this.localSourceFrame)
    66             this.localSourceFrame.visible = false;
    6764        this._currentSearchResultIndex = -1;
    6865    },
     
    7269        if (this.sourceFrame)
    7370            this.sourceFrame.resize();
    74         if (this.localSourceFrame)
    75             this.localSourceFrame.resize();
    76         WebInspector.ResourceView.prototype.resize.call(this);
    7771    },
    7872
     
    8175        if (!this._frameNeedsSetup)
    8276            return;
    83 
    84         this.attach();
    8577
    8678        delete this._frameNeedsSetup;
     
    8880    },
    8981
    90     hasContentTab: function()
     82    hasContent: function()
    9183    {
    9284        return true;
    93     },
    94 
    95     contentTabSelected: function()
    96     {
    97         this.setupSourceFrameIfNeeded();
    9885    },
    9986
     
    209196    },
    210197
    211     updateLocalContent: function(content, mimeType)
    212     {
    213         if (!this.localContentElement) {
    214             this.localContentElement = document.createElement("div");
    215             this.localContentElement.className = "resource-view-content";
    216             this.tabbedPane.appendTab("local", WebInspector.UIString("Local"), this.localContentElement, this.selectLocalContentTab.bind(this));
    217             this.localSourceFrame = new WebInspector.SourceFrame(this.localContentElement, this._addBreakpoint.bind(this), null, this._continueToLine.bind(this));
    218         }
    219         this.localSourceFrame.setContent(mimeType, content, "");
    220     },
    221 
    222     selectLocalContentTab: function()
    223     {
    224         this.tabbedPane.selectTabById("local");
    225         this.localSourceFrame.visible = true;
    226         if ("resize" in this)
    227             this.resize();
    228     },
    229 
    230198    jumpToFirstSearchResult: function()
    231199    {
  • trunk/WebCore/inspector/front-end/TabbedPane.js

    r71967 r72655  
    3333    this.element = element || document.createElement("div");
    3434    this.element.addStyleClass("tabbed-pane");
    35     this.tabsElement = this.element.createChild("div", "tabbed-pane-header");
    36     this.contentElement = this.element.createChild("div", "tabbed-pane-content");
    37 
    38     this._tabObjects = {};
     35    this._tabsElement = this.element.createChild("div", "tabbed-pane-header");
     36    this._contentElement = this.element.createChild("div", "tabbed-pane-content");
     37    this._tabs = {};
    3938}
    4039
    4140WebInspector.TabbedPane.prototype = {
    42     appendTab: function(id, tabTitle, content, tabClickListener)
     41    appendTab: function(id, tabTitle, view)
    4342    {
    4443        var tabElement = document.createElement("li");
    4544        tabElement.textContent = tabTitle;
    46         tabElement.addEventListener("click", tabClickListener, false);
    47         this.tabsElement.appendChild(tabElement);
    48         var tabObject = { tab: tabElement };
    49         if (content instanceof HTMLElement) {
    50             tabObject.element = content;
    51             this.contentElement.appendChild(content);
    52         }
    53         else {
    54             this.contentElement.appendChild(content.element);
    55             tabObject.view = content;
    56         }
    57         this._tabObjects[id] = tabObject;
     45        tabElement.addEventListener("click", this.selectTab.bind(this, id, true), false);
     46
     47        this._tabsElement.appendChild(tabElement);
     48        this._contentElement.appendChild(view.element);
     49
     50        this._tabs[id] = { tabElement: tabElement, view: view }
    5851    },
    5952
    60     hasTab: function(tabId)
     53    selectTab: function(id, userGesture)
    6154    {
    62         return tabId in this._tabObjects;
    63     },
    64      
    65     selectTabById: function(tabId)
    66     {
    67         for (var id in this._tabObjects) {
    68             if (id === tabId)
    69                 this._showTab(this._tabObjects[id]);
    70             else
    71                 this._hideTab(this._tabObjects[id]);
     55        if (!(id in this._tabs))
     56            return false;
     57
     58        if (this._currentTab) {
     59            this._hideTab(this._currentTab)
     60            delete this._currentTab;
    7261        }
    73         return this.hasTab(tabId);
     62
     63        var tab = this._tabs[id];
     64        this._showTab(tab);
     65        this._currentTab = tab;
     66        if (userGesture) {
     67            var event = {tabId: id};
     68            this.dispatchEventToListeners("tab-selected", event);
     69        }
     70        return true;
    7471    },
    7572
    76     _showTab: function(tabObject)
     73    _showTab: function(tab)
    7774    {
    78         tabObject.tab.addStyleClass("selected");
    79         if (tabObject.element)
    80             tabObject.element.removeStyleClass("hidden");
    81         else
    82             tabObject.view.visible = true;
     75        tab.tabElement.addStyleClass("selected");
     76        tab.view.show(this._contentElement);
    8377    },
    8478
    85     _hideTab: function(tabObject)
     79    _hideTab: function(tab)
    8680    {
    87         tabObject.tab.removeStyleClass("selected");
    88         if (tabObject.element)
    89             tabObject.element.addStyleClass("hidden");
    90         else
    91             tabObject.view.visible = false;
     81        tab.tabElement.removeStyleClass("selected");
     82        tab.view.visible = false;
    9283    }
    9384}
     85
     86WebInspector.TabbedPane.prototype.__proto__ = WebInspector.Object.prototype;
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r72090 r72655  
    2222    <file>CookieItemsView.js</file>
    2323    <file>CookieParser.js</file>
     24    <file>CookiesTable.js</file>
    2425    <file>CSSCompletions.js</file>
    2526    <file>CSSStyleModel.js</file>
     
    5657    <file>KeyboardShortcut.js</file>
    5758    <file>MetricsSidebarPane.js</file>
     59    <file>NetworkItemView.js</file>
    5860    <file>NetworkPanel.js</file>
    5961    <file>Object.js</file>
     
    7173    <file>Resource.js</file>
    7274    <file>ResourceCategory.js</file>
     75    <file>ResourceCookiesView.js</file>
     76    <file>ResourceHeadersView.js</file>
    7377    <file>ResourceManager.js</file>
    7478    <file>ResourceView.js</file>
  • trunk/WebCore/inspector/front-end/inspector.css

    r72598 r72655  
    799799}
    800800
    801 .resource-view {
    802     display: none;
    803     position: absolute;
    804     background: white;
    805     top: 0;
    806     left: 0;
    807     right: 0;
    808     bottom: 0;
    809 }
    810 
    811 .resource-view.visible {
    812     display: -webkit-box;
    813 }
    814 
    815 .resource-view .tabbed-pane-header {
    816     display: none;
    817     height: 20px;
    818     background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
    819     border-bottom: 1px solid rgb(163, 163, 163);
    820 }
    821 
    822 .resource-view.headers-visible .tabbed-pane-header {
    823     display: block;
    824 }
    825 
    826 .resource-view .scope-bar li {
    827     border-bottom-left-radius: 0;
    828     border-bottom-right-radius: 0;
    829 }
    830 
    831 .resource-view-headers {
    832     padding: 6px;
    833     -webkit-user-select: text;   
    834     position: absolute;
    835     top: 0;
    836     left: 0;
    837     right: 0;
    838     bottom: 0;
    839     overflow: auto;
    840 }
    841 
    842 .resource-view-headers .outline-disclosure .parent {
    843     -webkit-user-select: none;
    844     font-weight: bold;
    845 }
    846 
    847 .resource-view-headers .outline-disclosure .children li {
    848     white-space: nowrap;
    849 }
    850 
    851 .resource-view-headers .outline-disclosure li.expanded .header-count {
    852     display: none;
    853 }
    854 
    855 .resource-view-headers .outline-disclosure .header-name {
    856     color: rgb(33%, 33%, 33%);
    857     display: inline-block;
    858     margin-right: 0.5em;
    859     font-weight: bold;
    860     vertical-align: top;
    861     white-space: pre-wrap;
    862 }
    863 
    864 .resource-view-headers .outline-disclosure .header-value {
    865     display: inline;
    866     margin-right: 100px;
    867     white-space: pre-wrap;
    868     word-break: break-all;
    869     margin-top: 1px;
    870 }
    871 
    872 .resource-view-headers .outline-disclosure .raw-form-data {
    873     white-space:pre-wrap;
    874 }
    875 
    876 .resource-view .resource-view-content {
    877     position: absolute;
    878     top: 0;
    879     right: 0;
    880     left: 0;
    881     bottom: 0;
    882     overflow: auto;
    883 }
    884 
    885 .resource-view-cookies {
    886     display: none;
    887     position: absolute;
    888     top: 0;
    889     right: 0;
    890     left: 0;
    891     bottom: 0;
    892     overflow: auto;
    893     padding: 12px;
    894     height: 100%;
    895 }
    896 
    897 .resource-view-cookies.visible {
    898     display: block;
    899 }
    900 
    901 .resource-view-cookies.table .data-grid {
    902     height: 100%;
    903 }
    904 
    905 .resource-view-cookies .data-grid .row-group {
    906     font-weight: bold;
    907     font-size: 11px;
    908 }
    909 
    910801.webkit-line-gutter-backdrop {
    911802    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
     
    920811}
    921812
    922 .resource-view.font .resource-view-content {
     813.resource-view {
     814    display: none;
     815    position: absolute;
     816    top: 0;
     817    right: 0;
     818    left: 0;
     819    bottom: 0;
     820    overflow: auto;
     821}
     822
     823.resource-view.visible {
     824    display: block;
     825}
     826
     827.resource-view.font {
    923828    font-size: 60px;
    924829    white-space: pre-wrap;
     
    928833}
    929834
    930 .resource-view.image .resource-view-content > .image {
     835.resource-view.image > .image {
    931836    padding: 20px 20px 10px 20px;
    932837    text-align: center;
    933838}
    934839
    935 .resource-view.image .resource-view-content > .info {
     840.resource-view.image > .info {
    936841    padding-bottom: 10px;
    937842    font-size: 11px;
     
    20031908}
    20041909
    2005 .storage-view.table {
     1910.storage-view {
    20061911    overflow: hidden;
    20071912}
    20081913
    2009 .storage-view.table .data-grid {
     1914.storage-view .data-grid {
    20101915    border: none;
    20111916    height: 100%;
    20121917}
    20131918
    2014 .storage-empty-view, .storage-view.table .storage-table-error {
     1919.storage-empty-view, .storage-view .storage-table-error {
    20151920    position: absolute;
    20161921    top: 0;
     
    20301935}
    20311936
    2032 .storage-view.table .storage-table-error {
     1937.storage-view .storage-table-error {
    20331938    color: rgb(66%, 33%, 33%);
    20341939}
  • trunk/WebCore/inspector/front-end/inspector.html

    r72090 r72655  
    6868    <script type="text/javascript" src="DOMStorageItemsView.js"></script>
    6969    <script type="text/javascript" src="DataGrid.js"></script>
     70    <script type="text/javascript" src="CookiesTable.js"></script>
    7071    <script type="text/javascript" src="CookieItemsView.js"></script>
    7172    <script type="text/javascript" src="ApplicationCacheItemsView.js"></script>
     
    113114    <script type="text/javascript" src="AuditCategories.js"></script>
    114115    <script type="text/javascript" src="AuditFormatters.js"></script>
     116    <script type="text/javascript" src="ResourceHeadersView.js"></script>
     117    <script type="text/javascript" src="ResourceCookiesView.js"></script>
     118    <script type="text/javascript" src="NetworkItemView.js"></script>
    115119    <script type="text/javascript" src="ResourceView.js"></script>
    116120    <script type="text/javascript" src="SourceFrame.js"></script>
  • trunk/WebCore/inspector/front-end/networkPanel.css

    r71906 r72655  
    9898.network-cell-subtitle {
    9999    font-weight: normal;
    100     color: grey;
     100    color: gray;
     101}
     102
     103.network-sidebar tr.selected .network-cell-subtitle {
     104    color: white;
    101105}
    102106
    103107.network-header-subtitle {
    104     color: grey;
     108    color: gray;
    105109}
    106110
     
    630634}
    631635
    632 #network-views .resource-view .tabbed-pane-header {
     636#network-views .network-item-view .tabbed-pane-header {
    633637    height: 31px;
    634638    padding-top: 8px;
     
    636640}
    637641
    638 #network-views.small .resource-view .tabbed-pane-header {
     642#network-views.small .network-item-view .tabbed-pane-header {
    639643    height: 23px;
    640644    padding-top: 0;
     
    644648    padding-right: 0;
    645649}
     650
     651.network-item-view {
     652    display: none;
     653    position: absolute;
     654    background: white;
     655    top: 0;
     656    left: 0;
     657    right: 0;
     658    bottom: 0;
     659}
     660
     661.network-item-view.visible {
     662    display: -webkit-box;
     663}
     664
     665.network-item-view .tabbed-pane-header {
     666    height: 20px;
     667    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
     668    border-bottom: 1px solid rgb(163, 163, 163);
     669}
     670
     671.network-item-view .scope-bar li {
     672    border-bottom-left-radius: 0;
     673    border-bottom-right-radius: 0;
     674}
     675
     676.resource-headers-view {
     677    display: none;
     678    padding: 6px;
     679    -webkit-user-select: text;   
     680    position: absolute;
     681    top: 0;
     682    left: 0;
     683    right: 0;
     684    bottom: 0;
     685    overflow: auto;
     686}
     687
     688.resource-headers-view.visible {
     689    display: block;
     690}
     691
     692.resource-headers-view .outline-disclosure .parent {
     693    -webkit-user-select: none;
     694    font-weight: bold;
     695}
     696
     697.resource-headers-view .outline-disclosure .children li {
     698    white-space: nowrap;
     699}
     700
     701.resource-headers-view .outline-disclosure li.expanded .header-count {
     702    display: none;
     703}
     704
     705.resource-headers-view .outline-disclosure .header-name {
     706    color: rgb(33%, 33%, 33%);
     707    display: inline-block;
     708    margin-right: 0.5em;
     709    font-weight: bold;
     710    vertical-align: top;
     711    white-space: pre-wrap;
     712}
     713
     714.resource-headers-view .outline-disclosure .header-value {
     715    display: inline;
     716    margin-right: 100px;
     717    white-space: pre-wrap;
     718    word-break: break-all;
     719    margin-top: 1px;
     720}
     721
     722.resource-headers-view .outline-disclosure .raw-form-data {
     723    white-space: pre-wrap;
     724}
     725
     726.resource-cookies-view {
     727    display: none;
     728    position: absolute;
     729    top: 0;
     730    right: 0;
     731    left: 0;
     732    bottom: 0;
     733    overflow: auto;
     734    padding: 12px;
     735    height: 100%;
     736}
     737
     738.resource-cookies-view.visible {
     739    display: block;
     740}
     741
     742.resource-cookies-view .data-grid {
     743    height: 100%;
     744}
     745
     746.resource-cookies-view .data-grid .row-group {
     747    font-weight: bold;
     748    font-size: 11px;
     749}
Note: See TracChangeset for help on using the changeset viewer.