[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

apavlov at chromium.org apavlov at chromium.org
Wed Dec 22 17:47:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a04ab0679325636470dedb242da1f1562c18435b
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 30 15:28:53 2010 +0000

    2010-11-30  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: Enable switching between revisions of stylesheets
            https://bugs.webkit.org/show_bug.cgi?id=50227
    
            Drive-by fix: styleSheetChanged() call needed after a stylesheet reparsing on setStyleSheetText2().
    
            * English.lproj/localizedStrings.js:
            * inspector/InspectorStyleSheet.cpp:
            (WebCore::InspectorStyleSheet::reparseStyleSheet):
            * inspector/front-end/CSSStyleModel.js:
            (WebInspector.CSSStyleModel.prototype.setStyleSheetText):
            (WebInspector.CSSStyleModel.prototype._styleSheetChanged.callback):
            (WebInspector.CSSStyleModel.prototype._styleSheetChanged):
            (WebInspector.CSSStyleSheet.prototype.getText):
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourceRevisionTreeElement.prototype.onattach):
            (WebInspector.ResourceRevisionTreeElement.prototype._ondragstart):
            (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1317767..d29e7ff 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-30  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: Enable switching between revisions of stylesheets
+        https://bugs.webkit.org/show_bug.cgi?id=50227
+
+        Drive-by fix: styleSheetChanged() call needed after a stylesheet reparsing on setStyleSheetText2().
+
+        * English.lproj/localizedStrings.js:
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::reparseStyleSheet):
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleModel.prototype.setStyleSheetText):
+        (WebInspector.CSSStyleModel.prototype._styleSheetChanged.callback):
+        (WebInspector.CSSStyleModel.prototype._styleSheetChanged):
+        (WebInspector.CSSStyleSheet.prototype.getText):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourceRevisionTreeElement.prototype.onattach):
+        (WebInspector.ResourceRevisionTreeElement.prototype._ondragstart):
+        (WebInspector.ResourceRevisionTreeElement.prototype._handleContextMenuEvent):
+
 2010-11-30  John Knottenbelt  <jknotten at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index 5ffe861..f1644cd 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/inspector/InspectorStyleSheet.cpp b/WebCore/inspector/InspectorStyleSheet.cpp
index ec1bb39..5b67a26 100644
--- a/WebCore/inspector/InspectorStyleSheet.cpp
+++ b/WebCore/inspector/InspectorStyleSheet.cpp
@@ -588,6 +588,7 @@ void InspectorStyleSheet::reparseStyleSheet(const String& text)
     for (unsigned i = 0, size = m_pageStyleSheet->length(); i < size; ++i)
         m_pageStyleSheet->remove(i);
     m_pageStyleSheet->parseString(text, m_pageStyleSheet->useStrictParsing());
+    m_pageStyleSheet->styleSheetChanged();
     m_inspectorStyles.clear();
 }
 
diff --git a/WebCore/inspector/front-end/CSSStyleModel.js b/WebCore/inspector/front-end/CSSStyleModel.js
index baf44c9..b54c455 100644
--- a/WebCore/inspector/front-end/CSSStyleModel.js
+++ b/WebCore/inspector/front-end/CSSStyleModel.js
@@ -155,6 +155,11 @@ WebInspector.CSSStyleModel.prototype = {
         InspectorBackend.addRule2(nodeId, selector, callback.bind(this, successCallback, failureCallback, selector));
     },
 
+    setStyleSheetText: function(styleSheetId, newText)
+    {
+        InspectorBackend.setStyleSheetText2(styleSheetId, newText, this._styleSheetChanged.bind(this, styleSheetId, true));
+    },
+
     _styleSheetChanged: function(styleSheetId, majorChange)
     {
         if (!majorChange || !styleSheetId)
@@ -163,8 +168,10 @@ WebInspector.CSSStyleModel.prototype = {
         function callback(href, content)
         {
             var resource = WebInspector.resourceManager.resourceForURL(href);
-            if (resource && resource.type === WebInspector.Resource.Type.Stylesheet)
+            if (resource && resource.type === WebInspector.Resource.Type.Stylesheet) {
+                resource.styleSheetId = styleSheetId;
                 resource.content = content;
+            }
         }
         InspectorBackend.getStyleSheetText2(styleSheetId, callback);
     }
@@ -531,20 +538,5 @@ WebInspector.CSSStyleSheet.prototype = {
     getText: function()
     {
         return this._text;
-    },
-
-    setText: function(newText, userCallback)
-    {
-        function callback(styleSheetPayload)
-        {
-            if (!styleSheetPayload)
-                userCallback(null);
-            else {
-                userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
-                WebInspector.cssModel._styleSheetChanged(this.id, true);
-            }
-        }
-
-        InspectorBackend.setStyleSheetText2(this.id, newText, callback.bind(this));
     }
 }
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 5c5c5d6..74273c0 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -1094,6 +1094,7 @@ WebInspector.FrameResourceTreeElement.prototype = {
         var revisionResource = new WebInspector.Resource(null, this._resource.url);
         revisionResource.type = this._resource.type;
         revisionResource.loader = this._resource.loader;
+        revisionResource.styleSheetId = this._resource.styleSheetId;
         if (this._resource.finished)
             revisionResource.finished = true;
         else {
@@ -1261,6 +1262,7 @@ WebInspector.ResourceRevisionTreeElement.prototype = {
         WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
         this.listItemElement.draggable = true;
         this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
+        this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
     },
 
     onselect: function()
@@ -1274,6 +1276,17 @@ WebInspector.ResourceRevisionTreeElement.prototype = {
         event.dataTransfer.setData("text/plain", this._resource.content);
         event.dataTransfer.effectAllowed = "copy";
         return true;
+    },
+
+    _handleContextMenuEvent: function(event)
+    {
+        if (!this._resource.styleSheetId)
+            return;
+
+        var contextMenu = new WebInspector.ContextMenu();
+        var itemAction = WebInspector.cssModel.setStyleSheetText.bind(WebInspector.cssModel, this._resource.styleSheetId, this._resource.content);
+        contextMenu.appendItem(WebInspector.UIString("Revert to this revision"), itemAction);
+        contextMenu.show(event);
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list