Title: [111677] trunk
Revision
111677
Author
[email protected]
Date
2012-03-22 05:56:47 -0700 (Thu, 22 Mar 2012)

Log Message

Source/WebCore: Web Inspector: dispatch styleSheetChanged event synchronously.
https://bugs.webkit.org/show_bug.cgi?id=81892

Reviewed by Vsevolod Vlasov.

Today, backend generates stylesheet change event synchronously from within set* command.
But CSSStyleModel defers its dispatching until the stylesheet content is available. This
prevents us from ignoring update events from within commands that initiated those updates.

This change makes stylesheet change event dispatch synchronously and delegates stylesheet
content fetching to the event client.

* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel.prototype._fireStyleSheetChanged):
(WebInspector.CSSStyleDeclaration.prototype.insertPropertyAt):
(WebInspector.CSSStyleModelResourceBinding.prototype.setContent):
(WebInspector.CSSStyleModelResourceBinding.prototype._innerSetContent.callbackWrapper):
(WebInspector.CSSStyleModelResourceBinding.prototype._innerSetContent):
(WebInspector.CSSStyleModelResourceBinding.prototype._styleSheetChanged.callback):
(WebInspector.CSSStyleModelResourceBinding.prototype._styleSheetChanged):
(WebInspector.CSSStyleModelResourceBinding.prototype._innerStyleSheetChanged):

Source/WebKit/chromium: [chromium] timing functions are getting incorrectly applied for accelerated css transitions
https://bugs.webkit.org/show_bug.cgi?id=81692

Patch by Ian Vollick <[email protected]> on 2012-03-21
Reviewed by Adrienne Walker.

* tests/CCAnimationTestCommon.cpp:
(WebCore::addOpacityTransition):
(WebKitTests::addOpacityTransitionToController):
(WebKitTests::addOpacityTransitionToLayer):
* tests/CCAnimationTestCommon.h:
(WebKitTests):
* tests/CCLayerAnimationControllerTest.cpp:
(WebKitTests::TEST):
* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
(WTF::CCLayerTreeHostTest::dispatchAddAnimation):
(WTF::TEST_F):
(WTF):
(CCLayerTreeHostTestAddAnimationWithTimingFunction):
(WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::CCLayerTreeHostTestAddAnimationWithTimingFunction):
(WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::beginTest):
(WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::animateLayers):
(WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::afterTest):

LayoutTests: Web Inspector: dispatch styleSheetChanged event synchronously.
https://bugs.webkit.org/show_bug.cgi?id=81892

Reviewed by Vsevolod Vlasov.

* http/tests/inspector/resources-test.js:
(initialize_ResourceTest.InspectorTest.showResource.callbackWrapper):
(initialize_ResourceTest.InspectorTest.showResource.showResourceCallback.visit):
(initialize_ResourceTest.InspectorTest.showResource.showResourceCallback):
(initialize_ResourceTest.InspectorTest.showResource):
(initialize_ResourceTest):
* inspector/styles/styles-history.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111676 => 111677)


--- trunk/LayoutTests/ChangeLog	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/LayoutTests/ChangeLog	2012-03-22 12:56:47 UTC (rev 111677)
@@ -1,3 +1,18 @@
+2012-03-22  Pavel Feldman  <[email protected]>
+
+        Web Inspector: dispatch styleSheetChanged event synchronously.
+        https://bugs.webkit.org/show_bug.cgi?id=81892
+
+        Reviewed by Vsevolod Vlasov.
+
+        * http/tests/inspector/resources-test.js:
+        (initialize_ResourceTest.InspectorTest.showResource.callbackWrapper):
+        (initialize_ResourceTest.InspectorTest.showResource.showResourceCallback.visit):
+        (initialize_ResourceTest.InspectorTest.showResource.showResourceCallback):
+        (initialize_ResourceTest.InspectorTest.showResource):
+        (initialize_ResourceTest):
+        * inspector/styles/styles-history.html:
+
 2012-03-22  Kaustubh Atrawalkar  <[email protected]>
 
         blur() on shadow host should work when a shadow host contains a focused element in its shadow DOM subtrees

Modified: trunk/LayoutTests/http/tests/inspector/resources-test.js (111676 => 111677)


--- trunk/LayoutTests/http/tests/inspector/resources-test.js	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/LayoutTests/http/tests/inspector/resources-test.js	2012-03-22 12:56:47 UTC (rev 111677)
@@ -61,6 +61,15 @@
 
 InspectorTest.showResource = function(resourceURL, callback)
 {
+    var reported = false;
+    function callbackWrapper(sourceFrame)
+    {
+        if (reported)
+            return;
+        callback(sourceFrame);
+        reported = true;
+    }
+
     function showResourceCallback()
     {
         WebInspector.resourceTreeModel.forAllResources(visit);
@@ -70,9 +79,9 @@
                 WebInspector.panels.resources.showResource(resource, 1);
                 var sourceFrame = WebInspector.panels.resources._resourceViewForResource(resource);
                 if (sourceFrame.loaded)
-                    callback(sourceFrame);
+                    callbackWrapper(sourceFrame);
                 else
-                    sourceFrame.addEventListener(WebInspector.SourceFrame.Events.Loaded, callback.bind(null, sourceFrame));
+                    sourceFrame.addEventListener(WebInspector.SourceFrame.Events.Loaded, callbackWrapper.bind(null, sourceFrame));
                 return true;
             }
         }

Modified: trunk/LayoutTests/inspector/styles/styles-history-expected.txt (111676 => 111677)


--- trunk/LayoutTests/inspector/styles/styles-history-expected.txt	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/LayoutTests/inspector/styles/styles-history-expected.txt	2012-03-22 12:56:47 UTC (rev 111677)
@@ -5,14 +5,14 @@
 
 Running: testSetResourceContentMinor
 History length: 0
-
-Running: testSetResourceContentMajor
 Item <tip>:
 body {
   margin: 10px;
   padding: 10px;
 }
 
+
+Running: testSetResourceContentMajor
 History length: 1
 Item 0:
 body {

Modified: trunk/LayoutTests/inspector/styles/styles-history.html (111676 => 111677)


--- trunk/LayoutTests/inspector/styles/styles-history.html	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/LayoutTests/inspector/styles/styles-history.html	2012-03-22 12:56:47 UTC (rev 111677)
@@ -26,7 +26,6 @@
                     if (resource.url.indexOf("styles-history.css") === -1)
                         return;
                     styleResource = resource;
-                    styleResource.addEventListener(WebInspector.Resource.Events.RevisionAdded, dumpHistory);
                     next();
                 }
                 WebInspector.resourceTreeModel.forAllResources(visitResource);
@@ -34,18 +33,12 @@
 
             function testSetResourceContentMinor(next)
             {
-                function callback()
-                {
-                    dumpHistory();
-                    next();
-                }
-                styleResource.setContent("body {\n  margin: 15px;\n  padding: 10px;\n}", false, callback);
+                styleResource.setContent("body {\n  margin: 15px;\n  padding: 10px;\n}", false, dumpHistory(next));
             },
 
             function testSetResourceContentMajor(next)
             {
-                waitForRevision(next);
-                styleResource.setContent("body {\n  margin: 20px;\n  padding: 10px;\n}", true);
+                styleResource.setContent("body {\n  margin: 20px;\n  padding: 10px;\n}", true, dumpHistory(next));
             },
 
             function testSetContentViaModelMinor(next)
@@ -56,14 +49,8 @@
                 {
                     var style = styleSheet.rules[0].style;
                     var property = style.getLiveProperty("margin");
-                    property.setText("margin:25px;", false, true, step2);
+                    property.setText("margin:25px;", false, true, dumpHistory(next));
                 }
-
-                function step2()
-                {
-                    dumpHistory();
-                    next();
-                }
             },
 
             function testSetContentViaModelMajor(next)
@@ -74,8 +61,8 @@
                 {
                     var style = styleSheet.rules[0].style;
                     var property = style.getLiveProperty("margin");
-                    waitForRevision(next);
                     property.setText("margin:30px;", true, true);
+                    InspectorTest.runAfterPendingDispatches(dumpHistory(next));
                 }
             }
         ]);
@@ -104,29 +91,25 @@
         }
     }
 
-    function dumpHistory()
+    function dumpHistory(next)
     {
-        InspectorTest.addResult("History length: " + styleResource.history.length);
-        for (var i = 0; i < styleResource.history.length; ++i)
-            styleResource.history[i].requestContent(dumpRevision.bind(this, i));
-        styleResource.requestContent(dumpRevision.bind(this, "<tip>"));
-
-        var copy = pendingCallbacks.slice();
-        pendingCallbacks = [];
-        for (var i = 0; i < copy.length; ++i)
-            copy[i]();
+        function result()
+        {
+            InspectorTest.addResult("History length: " + styleResource.history.length);
+            for (var i = 0; i < styleResource.history.length; ++i)
+                styleResource.history[i].requestContent(dumpRevision.bind(this, i, null));
+            styleResource.requestContent(dumpRevision.bind(this, "<tip>", next));
+        }
+        return result;
     }
 
-    function dumpRevision(index, content)
+    function dumpRevision(index, next, content)
     {
         InspectorTest.addResult("Item " + index + ":");
         InspectorTest.addResult(content);
+        if (next)
+            next();
     }
-
-    function waitForRevision(callback)
-    {
-        pendingCallbacks.push(callback);
-    }
 }
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (111676 => 111677)


--- trunk/Source/WebCore/ChangeLog	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/Source/WebCore/ChangeLog	2012-03-22 12:56:47 UTC (rev 111677)
@@ -1,5 +1,40 @@
 2012-03-22  Pavel Feldman  <[email protected]>
 
+        Web Inspector: dispatch styleSheetChanged event synchronously.
+        https://bugs.webkit.org/show_bug.cgi?id=81892
+
+        Reviewed by Vsevolod Vlasov.
+
+        Today, backend generates stylesheet change event synchronously from within set* command.
+        But CSSStyleModel defers its dispatching until the stylesheet content is available. This
+        prevents us from ignoring update events from within commands that initiated those updates.
+
+        This change makes stylesheet change event dispatch synchronously and delegates stylesheet
+        content fetching to the event client.
+
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleModel.prototype._fireStyleSheetChanged):
+        (WebInspector.CSSStyleDeclaration.prototype.insertPropertyAt):
+        (WebInspector.CSSStyleModelResourceBinding.prototype.setContent):
+        (WebInspector.CSSStyleModelResourceBinding.prototype._innerSetContent.callbackWrapper):
+        (WebInspector.CSSStyleModelResourceBinding.prototype._innerSetContent):
+        (WebInspector.CSSStyleModelResourceBinding.prototype._styleSheetChanged.callback):
+        (WebInspector.CSSStyleModelResourceBinding.prototype._styleSheetChanged):
+        (WebInspector.CSSStyleModelResourceBinding.prototype._innerStyleSheetChanged):
+
+2012-03-21  Ian Vollick  <[email protected]>
+
+        [chromium] timing functions are getting incorrectly applied for accelerated css transitions
+        https://bugs.webkit.org/show_bug.cgi?id=81692
+
+        Reviewed by Adrienne Walker.
+
+        Tested in CCLayerTreeHostTestAddAnimationWithTimingFunction
+
+        * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
+
+2012-03-22  Pavel Feldman  <[email protected]>
+
         Web Inspector: allow on-hover popover while in edit mode.
         https://bugs.webkit.org/show_bug.cgi?id=81898
 

Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (111676 => 111677)


--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-03-22 12:56:47 UTC (rev 111677)
@@ -268,17 +268,11 @@
             return;
 
         var majorChange = this._pendingCommandsMajorState[this._pendingCommandsMajorState.length - 1];
-        
+
         if (!majorChange || !styleSheetId || !this.hasEventListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged))
             return;
 
-        function callback(error, content)
-        {
-            if (!error)
-                this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged, { styleSheetId: styleSheetId, content: content, majorChange: majorChange });
-        }
-
-        CSSAgent.getStyleSheetText(styleSheetId, callback.bind(this));
+        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged, { styleSheetId: styleSheetId, majorChange: majorChange });
     },
 
     setStyleSheetText: function(styleSheetId, newText, majorChange, userCallback)
@@ -496,7 +490,7 @@
                 return;
 
             if (error) {
-                console.error(JSON.stringify(error));
+                console.error(error);
                 userCallback(null);
             } else {
                 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
@@ -811,6 +805,9 @@
 WebInspector.CSSStyleModelResourceBinding.prototype = {
     setContent: function(resource, content, majorChange, userCallback)
     {
+        if (majorChange && resource.type === WebInspector.Resource.Type.Stylesheet)
+            resource.addRevision(content);
+
         if (this._urlToStyleSheetId[resource.url]) {
             this._innerSetContent(resource.url, content, majorChange, userCallback, null);
             return;
@@ -843,7 +840,15 @@
                 userCallback("No stylesheet found: " + url);
             return;
         }
-        this._cssModel.setStyleSheetText(styleSheetId, content, majorChange, userCallback);
+
+        this._isSettingContent = true;
+        function callbackWrapper(error)
+        {
+            if (userCallback)
+                userCallback(error);
+            delete this._isSettingContent;
+        }
+        this._cssModel.setStyleSheetText(styleSheetId, content, majorChange, callbackWrapper.bind(this));
     },
 
     _loadStyleSheetHeaders: function(callback)
@@ -867,7 +872,22 @@
 
     _styleSheetChanged: function(event)
     {
-        var styleSheetId = event.data.styleSheetId;
+        if (this._isSettingContent)
+            return;
+
+        if (!event.data.majorChange)
+            return;
+
+        function callback(error, content)
+        {
+            if (!error)
+                this._innerStyleSheetChanged(event.data.styleSheetId, content);
+        }
+        CSSAgent.getStyleSheetText(event.data.styleSheetId, callback.bind(this));
+    },
+
+    _innerStyleSheetChanged: function(styleSheetId, content)
+    {
         function setContent()
         {
             var url = ""
@@ -875,12 +895,8 @@
                 return;
 
             var resource = WebInspector.resourceForURL(url);
-            if (!resource || resource.type !== WebInspector.Resource.Type.Stylesheet)
-                return;
-
-            var majorChange = event.data.majorChange;
-            if (majorChange)
-                resource.addRevision(event.data.content);
+            if (resource && resource.type === WebInspector.Resource.Type.Stylesheet)
+                resource.addRevision(content);
         }
 
         if (!this._styleSheetIdToURL[styleSheetId]) {

Modified: trunk/Source/WebKit/chromium/ChangeLog (111676 => 111677)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-22 12:54:32 UTC (rev 111676)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-22 12:56:47 UTC (rev 111677)
@@ -1,3 +1,29 @@
+2012-03-21  Ian Vollick  <[email protected]>
+
+        [chromium] timing functions are getting incorrectly applied for accelerated css transitions
+        https://bugs.webkit.org/show_bug.cgi?id=81692
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCAnimationTestCommon.cpp:
+        (WebCore::addOpacityTransition):
+        (WebKitTests::addOpacityTransitionToController):
+        (WebKitTests::addOpacityTransitionToLayer):
+        * tests/CCAnimationTestCommon.h:
+        (WebKitTests):
+        * tests/CCLayerAnimationControllerTest.cpp:
+        (WebKitTests::TEST):
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
+        (WTF::CCLayerTreeHostTest::dispatchAddAnimation):
+        (WTF::TEST_F):
+        (WTF):
+        (CCLayerTreeHostTestAddAnimationWithTimingFunction):
+        (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::CCLayerTreeHostTestAddAnimationWithTimingFunction):
+        (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::beginTest):
+        (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::animateLayers):
+        (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::afterTest):
+
 2012-03-22  Kenichi Ishibashi  <[email protected]>
 
         [Chromium] Should check m_socket in SocketStreamHandleInternal::close()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to