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 <vollick@chromium.org> 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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111677
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-22 Pavel Feldman <pfeldman@chromium.org>
+
+ 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 <kaustubh@motorola.com>
blur() on shadow host should work when a shadow host contains a focused element in its shadow DOM subtrees
InspectorTest.showResource = function(resourceURL, callback)
{
+ var reported = false;
+ function callbackWrapper(sourceFrame)
+ {
+ if (reported)
+ return;
+ callback(sourceFrame);
+ reported = true;
+ }
+
function showResourceCallback()
{
WebInspector.resourceTreeModel.forAllResources(visit);
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;
}
}
Running: testSetResourceContentMinor
History length: 0
-
-Running: testSetResourceContentMajor
Item <tip>:
body {
margin: 10px;
padding: 10px;
}
+
+Running: testSetResourceContentMajor
History length: 1
Item 0:
body {
if (resource.url.indexOf("styles-history.css") === -1)
return;
styleResource = resource;
- styleResource.addEventListener(WebInspector.Resource.Events.RevisionAdded, dumpHistory);
next();
}
WebInspector.resourceTreeModel.forAllResources(visitResource);
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)
{
var style = styleSheet.rules[0].style;
var property = style.getLiveProperty("margin");
- property.setText("margin:25px;", false, true, step2);
- }
-
- function step2()
- {
- dumpHistory();
- next();
+ property.setText("margin:25px;", false, true, dumpHistory(next));
}
},
{
var style = styleSheet.rules[0].style;
var property = style.getLiveProperty("margin");
- waitForRevision(next);
property.setText("margin:30px;", true, true);
+ InspectorTest.runAfterPendingDispatches(dumpHistory(next));
}
}
]);
}
}
- 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);
- }
-
- function waitForRevision(callback)
- {
- pendingCallbacks.push(callback);
+ if (next)
+ next();
}
}
+2012-03-22 Pavel Feldman <pfeldman@chromium.org>
+
+ 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 <vollick@chromium.org>
+
+ [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 <pfeldman@chromium.org>
Web Inspector: allow on-hover popover while in edit mode.
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)
return;
if (error) {
- console.error(JSON.stringify(error));
+ console.error(error);
userCallback(null);
} else {
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
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;
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)
_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 = this._styleSheetIdToURL[styleSheetId];
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]) {
+2012-03-21 Ian Vollick <vollick@chromium.org>
+
+ [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 <bashi@chromium.org>
[Chromium] Should check m_socket in SocketStreamHandleInternal::close()