Changeset 101381 in webkit


Ignore:
Timestamp:
Nov 29, 2011 8:01:30 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: split Preferences into Preferences and Capabilities.
https://bugs.webkit.org/show_bug.cgi?id=73321

Source/WebCore:

Part of the Preferences defined in Settings.js are in fact backend capabilities.
Split them into two separate objects for further capabilities refactoring.

Reviewed by Yury Semikhatsky.

  • inspector/front-end/DebuggerModel.js:
  • inspector/front-end/ElementsPanel.js:

(WebInspector.ElementsPanel):
(WebInspector.ElementsPanel.prototype.wasShown):
(WebInspector.ElementsPanel.prototype._populateContextMenu):

  • inspector/front-end/NetworkItemView.js:

(WebInspector.NetworkItemView):

  • inspector/front-end/NetworkPanel.js:

(WebInspector.NetworkLogView.prototype._createTable):
(WebInspector.NetworkLogView.prototype.switchToDetailedView):
(WebInspector.NetworkLogView.prototype.switchToBriefView):
(WebInspector.NetworkLogView.prototype._contextMenu):
(WebInspector.NetworkDataGridNode.prototype.createCells):
(WebInspector.NetworkDataGridNode.prototype.refreshResource):

  • inspector/front-end/ProfileDataGridTree.js:

(WebInspector.ProfileDataGridNode.prototype.get data.formatMilliseconds):

  • inspector/front-end/ProfileView.js:
  • inspector/front-end/ProfilesPanel.js:

(WebInspector.ProfilesPanel.prototype._enableDetailedHeapProfiles):

  • inspector/front-end/Resource.js:

(WebInspector.Resource.prototype.populateImageSource):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype.wasShown):
(WebInspector.ScriptsPanel.prototype._clearInterface):

  • inspector/front-end/Settings.js:
  • inspector/front-end/SettingsScreen.js:

(WebInspector.SettingsScreen):

  • inspector/front-end/StylesSidebarPane.js:
  • inspector/front-end/inspector.js:

Source/WebKit/chromium:

Reviewed by Yury Semikhatsky.

  • src/js/DevTools.js:
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/inspector/profiler/detailed-heapshots-test.js

    r89372 r101381  
    1414        InspectorTest.addSniffer(WebInspector.DetailedHeapshotView.prototype, "_updatePercentButton", InspectorTest._snapshotViewShown, true);
    1515
    16         if (Preferences.detailedHeapProfiles)
     16        if (Capabilities.detailedHeapProfiles)
    1717            detailedHeapProfilesEnabled();
    1818        else {
     
    6363InspectorTest.runDetailedHeapshotTestSuite = function(testSuite)
    6464{
    65     if (!Preferences.heapProfilerPresent) {
     65    if (!Capabilities.heapProfilerPresent) {
    6666        InspectorTest.addResult("Heap profiler is disabled");
    6767        InspectorTest.completeTest();
  • trunk/Source/WebCore/ChangeLog

    r101376 r101381  
     12011-11-29  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: split Preferences into Preferences and Capabilities.
     4        https://bugs.webkit.org/show_bug.cgi?id=73321
     5
     6        Part of the Preferences defined in Settings.js are in fact backend capabilities.
     7        Split them into two separate objects for further capabilities refactoring.
     8
     9        Reviewed by Yury Semikhatsky.
     10
     11        * inspector/front-end/DebuggerModel.js:
     12        * inspector/front-end/ElementsPanel.js:
     13        (WebInspector.ElementsPanel):
     14        (WebInspector.ElementsPanel.prototype.wasShown):
     15        (WebInspector.ElementsPanel.prototype._populateContextMenu):
     16        * inspector/front-end/NetworkItemView.js:
     17        (WebInspector.NetworkItemView):
     18        * inspector/front-end/NetworkPanel.js:
     19        (WebInspector.NetworkLogView.prototype._createTable):
     20        (WebInspector.NetworkLogView.prototype.switchToDetailedView):
     21        (WebInspector.NetworkLogView.prototype.switchToBriefView):
     22        (WebInspector.NetworkLogView.prototype._contextMenu):
     23        (WebInspector.NetworkDataGridNode.prototype.createCells):
     24        (WebInspector.NetworkDataGridNode.prototype.refreshResource):
     25        * inspector/front-end/ProfileDataGridTree.js:
     26        (WebInspector.ProfileDataGridNode.prototype.get data.formatMilliseconds):
     27        * inspector/front-end/ProfileView.js:
     28        * inspector/front-end/ProfilesPanel.js:
     29        (WebInspector.ProfilesPanel.prototype._enableDetailedHeapProfiles):
     30        * inspector/front-end/Resource.js:
     31        (WebInspector.Resource.prototype.populateImageSource):
     32        * inspector/front-end/ScriptsPanel.js:
     33        (WebInspector.ScriptsPanel.prototype.wasShown):
     34        (WebInspector.ScriptsPanel.prototype._clearInterface):
     35        * inspector/front-end/Settings.js:
     36        * inspector/front-end/SettingsScreen.js:
     37        (WebInspector.SettingsScreen):
     38        * inspector/front-end/StylesSidebarPane.js:
     39        * inspector/front-end/inspector.js:
     40
    1412011-11-29  Simon Hausmann  <simon.hausmann@nokia.com>
    242
  • trunk/Source/WebCore/inspector/front-end/DebuggerModel.js

    r101367 r101381  
    9090        /**
    9191         * @param {Protocol.Error} error
    92          * @param {Array.<string>} capabilities
     92         * @param {Array.<MetaAgent.DomainCapabilities>} capabilities
    9393         */
    9494        function callback(error, capabilities)
  • trunk/Source/WebCore/inspector/front-end/ElementsPanel.js

    r100994 r101381  
    7171    this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
    7272    this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
    73     if (Preferences.nativeInstrumentationEnabled)
     73    if (Capabilities.nativeInstrumentationEnabled)
    7474        this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane;
    7575    this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPane();
     
    138138            WebInspector.domAgent.requestDocument();
    139139
    140         if (Preferences.nativeInstrumentationEnabled)
     140        if (Capabilities.nativeInstrumentationEnabled)
    141141            this.sidebarElement.insertBefore(this.sidebarPanes.domBreakpoints.element, this.sidebarPanes.eventListeners.element);
    142142    },
     
    202202        }
    203203
    204         if (Preferences.nativeInstrumentationEnabled)
     204        if (Capabilities.nativeInstrumentationEnabled)
    205205            this.sidebarPanes.domBreakpoints.restoreBreakpoints();
    206206
     
    320320    _populateContextMenu: function(contextMenu, node)
    321321    {
    322         if (Preferences.nativeInstrumentationEnabled) {
     322        if (Capabilities.nativeInstrumentationEnabled) {
    323323            // Add debbuging-related actions
    324324            contextMenu.appendSeparator();
  • trunk/Source/WebCore/inspector/front-end/NetworkItemView.js

    r98194 r101381  
    4848    this.appendTab("response", WebInspector.UIString("Response"), responseView);
    4949
    50     if (Preferences.showCookiesTab) {
     50    if (Capabilities.showCookiesTab) {
    5151        this._cookiesView = new WebInspector.ResourceCookiesView(resource);
    5252        this.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView);
    5353    }
    5454
    55     if (Preferences.showTimingTab) {
     55    if (Capabilities.showTimingTab) {
    5656        var timingView = new WebInspector.ResourceTimingView(resource);
    5757        this.appendTab("timing", WebInspector.UIString("Timing"), timingView);
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r101154 r101381  
    140140    {
    141141        var columns;
    142         if (Preferences.showNetworkPanelInitiatorColumn)
     142        if (Capabilities.nativeInstrumentationEnabled)
    143143            columns = {name: {}, method: {}, status: {}, type: {}, initiator: {}, size: {}, time: {}, timeline: {}};
    144144        else
     
    161161        columns.type.width = "6%";
    162162
    163         if (Preferences.showNetworkPanelInitiatorColumn) {
     163        if (Capabilities.nativeInstrumentationEnabled) {
    164164            columns.initiator.title = WebInspector.UIString("Initiator");
    165165            columns.initiator.sortable = true;
     
    179179        columns.timeline.title = "";
    180180        columns.timeline.sortable = false;
    181         if (Preferences.showNetworkPanelInitiatorColumn)
     181        if (Capabilities.nativeInstrumentationEnabled)
    182182            columns.timeline.width = "40%";
    183183        else
     
    832832        this._dataGrid.showColumn("status");
    833833        this._dataGrid.showColumn("type");
    834         if (Preferences.showNetworkPanelInitiatorColumn)
     834        if (Capabilities.nativeInstrumentationEnabled)
    835835            this._dataGrid.showColumn("initiator");
    836836        this._dataGrid.showColumn("size");
     
    843843        widths.status = 6;
    844844        widths.type = 6;
    845         if (Preferences.showNetworkPanelInitiatorColumn)
     845        if (Capabilities.nativeInstrumentationEnabled)
    846846            widths.initiator = 10;
    847847        widths.size = 6;
    848848        widths.time = 6;
    849         if (Preferences.showNetworkPanelInitiatorColumn)
     849        if (Capabilities.nativeInstrumentationEnabled)
    850850            widths.timeline = 40;
    851851        else
     
    863863        this._dataGrid.hideColumn("status");
    864864        this._dataGrid.hideColumn("type");
    865         if (Preferences.showNetworkPanelInitiatorColumn)
     865        if (Capabilities.nativeInstrumentationEnabled)
    866866            this._dataGrid.hideColumn("initiator");
    867867        this._dataGrid.hideColumn("size");
     
    941941        }
    942942
    943         if (Preferences.canClearCacheAndCookies) {
     943        if (Capabilities.canClearCacheAndCookies) {
    944944            contextMenu.appendSeparator();
    945945            contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear browser cache" : "Clear Browser Cache"), this._clearBrowserCache.bind(this));
     
    16871687        this._statusCell = this._createDivInTD("status");
    16881688        this._typeCell = this._createDivInTD("type");
    1689         if (Preferences.showNetworkPanelInitiatorColumn)
     1689        if (Capabilities.nativeInstrumentationEnabled)
    16901690            this._initiatorCell = this._createDivInTD("initiator");
    16911691        this._sizeCell = this._createDivInTD("size");
     
    17811781        this._refreshStatusCell();
    17821782        this._refreshTypeCell();
    1783         if (Preferences.showNetworkPanelInitiatorColumn)
     1783        if (Capabilities.nativeInstrumentationEnabled)
    17841784            this._refreshInitiatorCell();
    17851785        this._refreshSizeCell();
  • trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js

    r97977 r101381  
    5151        function formatMilliseconds(time)
    5252        {
    53             return Number.secondsToString(time / 1000, !Preferences.samplingCPUProfiler);
     53            return Number.secondsToString(time / 1000, !Capabilities.samplingCPUProfiler);
    5454        }
    5555
  • trunk/Source/WebCore/inspector/front-end/ProfileView.js

    r100903 r101381  
    4343                    "function": { title: WebInspector.UIString("Function"), disclosure: true, sortable: true } };
    4444
    45     if (Preferences.samplingCPUProfiler) {
     45    if (Capabilities.samplingCPUProfiler) {
    4646        delete columns.average;
    4747        delete columns.calls;
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r100991 r101381  
    120120    this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
    121121    this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false);
    122     if (Preferences.profilerAlwaysEnabled)
     122    if (Capabilities.profilerAlwaysEnabled)
    123123        this.enableToggleButton.element.addStyleClass("hidden");
    124124
     
    132132
    133133    this._profiles = [];
    134     this._profilerEnabled = Preferences.profilerAlwaysEnabled;
     134    this._profilerEnabled = Capabilities.profilerAlwaysEnabled;
    135135    this._reset();
    136136
    137137    this._registerProfileType(new WebInspector.CPUProfileType());
    138     if (Preferences.heapProfilerPresent)
     138    if (Capabilities.heapProfilerPresent)
    139139        this._registerProfileType(new WebInspector.DetailedHeapshotProfileType());
    140140
    141141    InspectorBackend.registerProfilerDispatcher(new WebInspector.ProfilerDispatcher(this));
    142142
    143     if (Preferences.profilerAlwaysEnabled || WebInspector.settings.profilerEnabled.get())
     143    if (Capabilities.profilerAlwaysEnabled || WebInspector.settings.profilerEnabled.get())
    144144        ProfilerAgent.enable();
    145145    else {
     
    890890        profileType.treeElement = oldProfileType.treeElement;
    891891        this._profileTypesByIdMap[profileType.id] = profileType;
    892         Preferences.detailedHeapProfiles = true;
     892        Capabilities.detailedHeapProfiles = true;
    893893        this.detach();
    894894        this.show();
  • trunk/Source/WebCore/inspector/front-end/Resource.js

    r101126 r101381  
    892892        }
    893893
    894         if (Preferences.useDataURLForResourceImageIcons)
    895             this.requestContent(onResourceContent.bind(this));
    896         else
    897             image.src = this.url;
     894        this.requestContent(onResourceContent.bind(this));
    898895    },
    899896
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r101160 r101381  
    6969    this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
    7070    this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane(this._presentationModel, this._showSourceLine.bind(this));
    71     if (Preferences.nativeInstrumentationEnabled) {
     71    if (Capabilities.nativeInstrumentationEnabled) {
    7272        this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane;
    7373        this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPane();
     
    7575    }
    7676
    77     if (Preferences.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFrontend()) {
     77    if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFrontend()) {
    7878        WorkerAgent.setWorkerInspectionEnabled(true);
    7979        this.sidebarPanes.workerList = new WebInspector.WorkerListSidebarPane(WebInspector.workerManager);
     
    104104    this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
    105105    this.enableToggleButton.addEventListener("click", this.toggleDebugging, this);
    106     if (Preferences.debuggerAlwaysEnabled)
     106    if (Capabilities.debuggerAlwaysEnabled)
    107107        this.enableToggleButton.element.addStyleClass("hidden");
    108108
     
    117117    this._scriptViewStatusBarItemsContainer.style.display = "inline-block";
    118118
    119     this._debuggerEnabled = Preferences.debuggerAlwaysEnabled;
     119    this._debuggerEnabled = Capabilities.debuggerAlwaysEnabled;
    120120
    121121    this._reset(false);
     
    138138    this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerReset, this._reset.bind(this, false));
    139139   
    140     var enableDebugger = Preferences.debuggerAlwaysEnabled || WebInspector.settings.debuggerEnabled.get();
     140    var enableDebugger = Capabilities.debuggerAlwaysEnabled || WebInspector.settings.debuggerEnabled.get();
    141141    if (enableDebugger)
    142142        WebInspector.debuggerModel.enableDebugger();
     
    178178    {
    179179        WebInspector.Panel.prototype.wasShown.call(this);
    180         if (Preferences.nativeInstrumentationEnabled)
     180        if (Capabilities.nativeInstrumentationEnabled)
    181181            this.sidebarElement.insertBefore(this.sidebarPanes.domBreakpoints.element, this.sidebarPanes.xhrBreakpoints.element);
    182182        this.sidebarPanes.watchExpressions.show();
     
    803803        this.sidebarPanes.scopechain.update(null);
    804804        this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight();
    805         if (Preferences.nativeInstrumentationEnabled) {
     805        if (Capabilities.nativeInstrumentationEnabled) {
    806806            this.sidebarPanes.domBreakpoints.clearBreakpointHighlight();
    807807            this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight();
  • trunk/Source/WebCore/inspector/front-end/Settings.js

    r100695 r101381  
    3838    styleRulesExpandedState: {},
    3939    showMissingLocalizedStrings: false,
     40    showColorNicknames: true,
     41    saveAsAvailable: false,
     42    useLowerCaseMenuTitlesOnWindows: false,
     43    hasExtensions: false,
     44    sharedWorkersDebugNote: undefined,
     45    localizeUI: true,
     46    applicationTitle: "Web Inspector - %s"
     47}
     48
     49var Capabilities = {
    4050    samplingCPUProfiler: false,
    41     showColorNicknames: true,
    4251    debuggerAlwaysEnabled: false,
    4352    profilerAlwaysEnabled: false,
    4453    nativeInstrumentationEnabled: false,
    45     useDataURLForResourceImageIcons: true,
    4654    showTimingTab: false,
    4755    showCookiesTab: false,
    48     debugMode: false,
    4956    heapProfilerPresent: false,
    5057    detailedHeapProfiles: false,
    51     saveAsAvailable: false,
    52     useLowerCaseMenuTitlesOnWindows: false,
    5358    canInspectWorkers: false,
    5459    canClearCacheAndCookies: false,
    55     canDisableCache: false,
    56     showNetworkPanelInitiatorColumn: false,
    57     haveExtensions: false,
    58     sharedWorkersDebugNote: undefined,
    59     localizeUI: true,
    60     applicationTitle: "Web Inspector - %s"
     60    canDisableCache: false
    6161}
    6262
  • trunk/Source/WebCore/inspector/front-end/SettingsScreen.js

    r100595 r101381  
    6060
    6161    p = this._appendSection(WebInspector.UIString("Network"), true);
    62     if (Preferences.canDisableCache)
     62    if (Capabilities.canDisableCache)
    6363        p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled));
    6464    p.appendChild(this._createUserActionControl());
     
    7272    p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Preserve log upon navigation"), WebInspector.settings.preserveConsoleLog));
    7373
    74     if (Preferences.haveExtensions) {
     74    if (Preferences.hasExtensions) {
    7575        var handlerSelector = new WebInspector.HandlerSelector(WebInspector.openAnchorLocationRegistry);
    7676        p = this._appendSection(WebInspector.UIString("Extensions"), true);
  • trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js

    r101341 r101381  
    890890    this._selectorElement.textContent = styleRule.selectorText;
    891891    selectorContainer.appendChild(this._selectorElement);
    892     if (Preferences.debugMode)
    893         this._selectorElement.addEventListener("click", this._debugShowStyle.bind(this), false);
    894892
    895893    var openBrace = document.createElement("span");
     
    11341132        item.updateTitle();
    11351133        return item;
    1136     },
    1137 
    1138     _debugShowStyle: function(event)
    1139     {
    1140         var boundHandler;
    1141         function removeStyleBox(element, event)
    1142         {
    1143             if (event.target === element) {
    1144                 event.stopPropagation();
    1145                 return;
    1146             }
    1147             document.body.removeChild(element);
    1148             document.getElementById("main").removeEventListener("mousedown", boundHandler, true);
    1149         }
    1150 
    1151         if (!event.shiftKey)
    1152             return;
    1153 
    1154         var container = document.createElement("div");
    1155         var element = document.createElement("span");
    1156         container.appendChild(element);
    1157         element.style.background = "yellow";
    1158         element.style.display = "inline-block";
    1159         container.style.cssText = "z-index: 2000000; position: absolute; top: 50px; left: 50px; white-space: pre; overflow: auto; background: white; font-family: monospace; font-size: 12px; border: 1px solid black; opacity: 0.85; -webkit-user-select: text; padding: 2px;";
    1160         container.style.width = (document.body.offsetWidth - 100) + "px";
    1161         container.style.height = (document.body.offsetHeight - 100) + "px";
    1162         document.body.appendChild(container);
    1163         if (this.rule)
    1164             element.textContent = this.rule.selectorText + " {" + ((this.styleRule.style.cssText !== undefined) ? this.styleRule.style.cssText : "<no cssText>") + "}";
    1165         else
    1166             element.textContent = this.styleRule.style.cssText;
    1167         boundHandler = removeStyleBox.bind(null, container);
    1168         document.getElementById("main").addEventListener("mousedown", boundHandler, true);
    11691134    },
    11701135
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r101359 r101381  
    359359    this.advancedSearchController = new WebInspector.AdvancedSearchController();
    360360
    361     if (Preferences.nativeInstrumentationEnabled)
     361    if (Capabilities.nativeInstrumentationEnabled)
    362362        this.domBreakpointsSidebarPane = new WebInspector.DOMBreakpointsSidebarPane();
    363363
  • trunk/Source/WebKit/chromium/ChangeLog

    r101337 r101381  
     12011-11-29  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: split Preferences into Preferences and Capabilities.
     4        https://bugs.webkit.org/show_bug.cgi?id=73321
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * src/js/DevTools.js:
     9
    1102011-11-29  Jing Zhao  <jingzhao@chromium.org>
    211
  • trunk/Source/WebKit/chromium/src/js/DevTools.js

    r100695 r101381  
    3636{(function () {
    3737    Preferences.ignoreWhitespace = false;
    38     Preferences.samplingCPUProfiler = true;
    39     Preferences.heapProfilerPresent = true;
    40     Preferences.detailedHeapProfiles = true;
    41     Preferences.debuggerAlwaysEnabled = true;
    42     Preferences.profilerAlwaysEnabled = true;
    43     Preferences.nativeInstrumentationEnabled = true;
    44     Preferences.fileSystemEnabled = false;
    45     Preferences.showTimingTab = true;
    46     Preferences.showCookiesTab = true;
    4738    Preferences.saveAsAvailable = true;
    4839    Preferences.useLowerCaseMenuTitlesOnWindows = true;
    49     Preferences.canInspectWorkers = true;
    50     Preferences.canClearCacheAndCookies = true;
    51     Preferences.canDisableCache = true;
    52     Preferences.showNetworkPanelInitiatorColumn = true;
    53     Preferences.haveExtensions = true;
     40    Preferences.hasExtensions = true;
    5441    Preferences.sharedWorkersDebugNote = "Shared workers can be inspected in the Task Manager";
    5542    Preferences.localizeUI = false;
    5643    Preferences.applicationTitle = "Developer Tools - %s";
     44
     45    Capabilities.samplingCPUProfiler = true;
     46    Capabilities.heapProfilerPresent = true;
     47    Capabilities.detailedHeapProfiles = true;
     48    Capabilities.debuggerAlwaysEnabled = true;
     49    Capabilities.profilerAlwaysEnabled = true;
     50    Capabilities.nativeInstrumentationEnabled = true;
     51    Capabilities.showTimingTab = true;
     52    Capabilities.showCookiesTab = true;
     53    Capabilities.canInspectWorkers = true;
     54    Capabilities.canClearCacheAndCookies = true;
     55    Capabilities.canDisableCache = true;
    5756})();}
    5857
Note: See TracChangeset for help on using the changeset viewer.