[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Thu Apr 8 01:09:42 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 26b4b55c329c973f18747a4e21e8e70072449302
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 15 11:20:21 2010 +0000

    2010-01-14  Mikhail Naganov  <mnaganov at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Add welcome screen to Profiles pane to provide some instructions for novices.
    
            https://bugs.webkit.org/show_bug.cgi?id=19268
    
            * English.lproj/localizedStrings.js:
            * WebCore.gypi:
            * WebCore.vcproj/WebCore.vcproj:
            * inspector/front-end/ProfileView.js:
            (WebInspector.CPUProfileType.prototype.get welcomeMessage):
            * inspector/front-end/ProfilesPanel.js:
            (WebInspector.ProfileType.prototype.get welcomeMessage):
            (WebInspector.ProfilesPanel):
            (WebInspector.ProfilesPanel.prototype.show):
            (WebInspector.ProfilesPanel.prototype.registerProfileType):
            (WebInspector.ProfilesPanel.prototype._addWelcomeMessage.messageButtonClicked):
            (WebInspector.ProfilesPanel.prototype._addWelcomeMessage):
            (WebInspector.ProfilesPanel.prototype.showProfile):
            (WebInspector.ProfilesPanel.prototype.closeVisibleView):
            (WebInspector.ProfilesPanel.prototype._updateInterface):
            * inspector/front-end/WebKit.qrc:
            * inspector/front-end/WelcomeView.js: Added.
            (WebInspector.WelcomeView):
            (WebInspector.WelcomeView.prototype._windowResized):
            (WebInspector.WelcomeView.prototype.addMessage):
            * inspector/front-end/inspector.css:
            * inspector/front-end/inspector.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0610b56..c987aa8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-01-14  Mikhail Naganov  <mnaganov at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Add welcome screen to Profiles pane to provide some instructions for novices.
+
+        https://bugs.webkit.org/show_bug.cgi?id=19268
+
+        * English.lproj/localizedStrings.js:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/front-end/ProfileView.js:
+        (WebInspector.CPUProfileType.prototype.get welcomeMessage):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfileType.prototype.get welcomeMessage):
+        (WebInspector.ProfilesPanel):
+        (WebInspector.ProfilesPanel.prototype.show):
+        (WebInspector.ProfilesPanel.prototype.registerProfileType):
+        (WebInspector.ProfilesPanel.prototype._addWelcomeMessage.messageButtonClicked):
+        (WebInspector.ProfilesPanel.prototype._addWelcomeMessage):
+        (WebInspector.ProfilesPanel.prototype.showProfile):
+        (WebInspector.ProfilesPanel.prototype.closeVisibleView):
+        (WebInspector.ProfilesPanel.prototype._updateInterface):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/WelcomeView.js: Added.
+        (WebInspector.WelcomeView):
+        (WebInspector.WelcomeView.prototype._windowResized):
+        (WebInspector.WelcomeView.prototype.addMessage):
+        * inspector/front-end/inspector.css:
+        * inspector/front-end/inspector.html:
+
 2010-01-13  Girish Ramakrishnan  <girish at forwardbias.in>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index 6df6c84..9374bcd 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 2a610b2..1a7a4df 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3737,6 +3737,7 @@
             'inspector/front-end/utilities.js',
             'inspector/front-end/View.js',
             'inspector/front-end/WatchExpressionsSidebarPane.js',
+            'inspector/front-end/WelcomeView.js',
             'inspector/front-end/audits.css',
             'inspector/front-end/inspector.css',
             'inspector/front-end/inspectorSyntaxHighlight.css',
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 18aac4c..bc40848 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -42931,6 +42931,10 @@
 					RelativePath="..\inspector\front-end\WatchExpressionsSidebarPane.js"
 					>
 				</File>
+				<File
+					RelativePath="..\inspector\front-end\WelcomeView.js"
+					>
+				</File>
 			</Filter>
 		</Filter>
 		<Filter
diff --git a/WebCore/inspector/front-end/ProfileView.js b/WebCore/inspector/front-end/ProfileView.js
index c164e94..9ced869 100644
--- a/WebCore/inspector/front-end/ProfileView.js
+++ b/WebCore/inspector/front-end/ProfileView.js
@@ -599,6 +599,11 @@ WebInspector.CPUProfileType.prototype = {
             InspectorBackend.stopProfiling();
     },
 
+    get welcomeMessage()
+    {
+        return WebInspector.UIString("Start CPU profiling by pressing<br>the %s button on the status bar.");
+    },
+
     setRecordingProfile: function(isProfiling)
     {
         this._recording = isProfiling;
diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js
index b276ecb..bd839f8 100644
--- a/WebCore/inspector/front-end/ProfilesPanel.js
+++ b/WebCore/inspector/front-end/ProfilesPanel.js
@@ -70,6 +70,11 @@ WebInspector.ProfileType.prototype = {
         return profile._profileView;
     },
 
+    get welcomeMessage()
+    {
+        return "";
+    },
+
     // Must be implemented by subclasses.
     createView: function(profile)
     {
@@ -111,6 +116,9 @@ WebInspector.ProfilesPanel = function()
     this.profileViewStatusBarItemsContainer = document.createElement("div");
     this.profileViewStatusBarItemsContainer.id = "profile-view-status-bar-items";
 
+    this.welcomeView = new WebInspector.WelcomeView("profiles", WebInspector.UIString("Welcome to the Profiles panel"));
+    this.element.appendChild(this.welcomeView.element);
+
     this._profiles = [];
     this.reset();
 }
@@ -149,6 +157,7 @@ WebInspector.ProfilesPanel.prototype = {
     show: function()
     {
         WebInspector.Panel.prototype.show.call(this);
+        this.welcomeView.show();
         if (this._shouldPopulateProfiles)
             this._populateProfiles();
     },
@@ -203,6 +212,32 @@ WebInspector.ProfilesPanel.prototype = {
         profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.name, null, true);
         this.sidebarTree.appendChild(profileType.treeElement);
         profileType.treeElement.expand();
+        this._addWelcomeMessage(profileType);
+    },
+
+    _addWelcomeMessage: function(profileType)
+    {
+        var message = profileType.welcomeMessage;
+        // Message text is supposed to have a '%s' substring as a placeholder
+        // for a status bar button. If it is there, we split the message in two
+        // parts, and insert the button between them.
+        var buttonPos = message.indexOf("%s");
+        if (buttonPos > -1) {
+            var container = document.createDocumentFragment();
+            var part1 = document.createElement("span");
+            part1.innerHTML = message.substr(0, buttonPos);
+            container.appendChild(part1);
+     
+            var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle, profileType.buttonCaption);
+            button.element.addEventListener("click", profileType.buttonClicked.bind(profileType), false);
+            container.appendChild(button.element);
+       
+            var part2 = document.createElement("span");
+            part2.innerHTML = message.substr(buttonPos + 2);
+            container.appendChild(part2);
+            this.welcomeView.addMessage(container);
+        } else
+            this.welcomeView.addMessage(message);
     },
 
     _makeKey: function(text, profileTypeId)
@@ -276,6 +311,7 @@ WebInspector.ProfilesPanel.prototype = {
         if (!profile)
             return;
 
+        this.welcomeView.hide();
         if (this.visibleView)
             this.visibleView.hide();
 
@@ -329,6 +365,7 @@ WebInspector.ProfilesPanel.prototype = {
         if (this.visibleView)
             this.visibleView.hide();
         delete this.visibleView;
+        this.welcomeView.show();
     },
 
     displayTitleForProfileLink: function(title, typeId)
@@ -407,12 +444,14 @@ WebInspector.ProfilesPanel.prototype = {
                 this._profileTypeButtonsByIdMap[typeId].removeStyleClass("hidden");
             this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
             this.panelEnablerView.visible = false;
+            this.welcomeView.visible = true;
         } else {
             this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
             this.enableToggleButton.toggled = false;
             for (var typeId in this._profileTypeButtonsByIdMap)
                 this._profileTypeButtonsByIdMap[typeId].addStyleClass("hidden");
             this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
+            this.welcomeView.visible = false;
             this.panelEnablerView.visible = true;
         }
     },
diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc
index 5e15cd6..ed92a2f 100644
--- a/WebCore/inspector/front-end/WebKit.qrc
+++ b/WebCore/inspector/front-end/WebKit.qrc
@@ -85,6 +85,7 @@
     <file>utilities.js</file>
     <file>View.js</file>
     <file>WatchExpressionsSidebarPane.js</file>
+    <file>WelcomeView.js</file>
     <file>audits.css</file>
     <file>inspector.css</file>
     <file>inspectorSyntaxHighlight.css</file>
diff --git a/WebCore/inspector/front-end/WelcomeView.js b/WebCore/inspector/front-end/WelcomeView.js
new file mode 100644
index 0000000..1e16c4e
--- /dev/null
+++ b/WebCore/inspector/front-end/WelcomeView.js
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.WelcomeView = function(identifier, headingText, instructionsText)
+{
+    WebInspector.View.call(this);
+
+    this.element.addStyleClass("panel-enabler-view");
+    this.element.addStyleClass(identifier);
+    this.element.addStyleClass("welcome");
+
+    this.contentElement = document.createElement("div");
+    this.contentElement.className = "panel-enabler-view-content";
+    this.element.appendChild(this.contentElement);
+
+    this.imageElement = document.createElement("img");
+    this.contentElement.appendChild(this.imageElement);
+
+    this.instructionsElement = document.createElement("div");
+    this.instructionsElement.className = "instructions";
+    this.contentElement.appendChild(this.instructionsElement);
+
+    this.headerElement = document.createElement("h1");
+    this.headerElement.textContent = headingText;
+    this.instructionsElement.appendChild(this.headerElement);
+
+    if (instructionsText)
+        this.addMessage(instructionsText);
+
+    window.addEventListener("resize", this._windowResized.bind(this), true);
+}
+
+WebInspector.WelcomeView.prototype = {
+    _windowResized: function()
+    {
+        this.imageElement.removeStyleClass("hidden");
+
+        if (this.element.offsetWidth < (this.instructionsElement.offsetWidth + this.imageElement.offsetWidth))
+            this.imageElement.addStyleClass("hidden");
+    },
+
+    addMessage: function(message)
+    {
+        var messageElement = document.createElement("div");
+        messageElement.className = "message";
+        if (typeof message == "string")
+            // Message text can contain <br> tags for better text balancing, so we
+            // put it into elements using 'innerHTML', not 'textContent'.
+            messageElement.innerHTML = message;
+        else
+            messageElement.appendChild(message);
+        this.instructionsElement.appendChild(messageElement);
+    }
+}
+
+WebInspector.WelcomeView.prototype.__proto__ = WebInspector.View.prototype;
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 3d96372..43edf3f 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -2256,7 +2256,7 @@ body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-des
     margin: 0 0 5px 20px;
 }
 
-.panel-enabler-view button, .pane button {
+.panel-enabler-view button:not(.status-bar-item), .pane button {
     color: rgb(6, 6, 6);
     background-color: transparent;
     border: 1px solid rgb(165, 165, 165);
@@ -2266,13 +2266,42 @@ body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-des
     -webkit-appearance: none;
 }
 
-.panel-enabler-view button {
+.panel-enabler-view button:not(.status-bar-item) {
     font-size: 13px;
     margin: 6px 0 0 0;
     padding: 3px 20px;
     height: 24px;
 }
 
+.panel-enabler-view.welcome {
+    z-index: auto;
+    left: 200px;
+}
+
+.panel-enabler-view.welcome img {
+    height: 90%;
+    min-height: 180px;
+    max-width: 90%;
+}
+
+.panel-enabler-view.welcome .instructions {
+    display: inline-block;
+    vertical-align: middle;
+    width: 330px;
+    margin: 0;
+    padding: 15px;
+    white-space: normal;
+    line-height: 175%;
+}
+
+.panel-enabler-view.welcome .message {
+    margin-bottom: 2ex;
+}
+
+.panel-enabler-view.welcome button.status-bar-item {
+    vertical-align: middle;
+}
+
 .pane button {
     margin: 6px 0 6px 3px;
     padding: 2px 9px;
diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html
index 9662c02..e34bd09 100644
--- a/WebCore/inspector/front-end/inspector.html
+++ b/WebCore/inspector/front-end/inspector.html
@@ -78,6 +78,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="Color.js"></script>
     <script type="text/javascript" src="StylesSidebarPane.js"></script>
     <script type="text/javascript" src="PanelEnablerView.js"></script>
+    <script type="text/javascript" src="WelcomeView.js"></script>
     <script type="text/javascript" src="StatusBarButton.js"></script>
     <script type="text/javascript" src="SummaryBar.js"></script>
     <script type="text/javascript" src="ElementsPanel.js"></script>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list