Title: [108075] trunk
- Revision
- 108075
- Author
- pfeld...@chromium.org
- Date
- 2012-02-17 08:13:59 -0800 (Fri, 17 Feb 2012)
Log Message
Web Inspector: check undo-redo boundaries based on current action index, not history size.
https://bugs.webkit.org/show_bug.cgi?id=78895
Reviewed by Vsevolod Vlasov.
Source/WebCore:
Tests: inspector/elements/perform-undo-undo.html
inspector/styles/perform-undo-perform-of-mergable-action.html
* inspector/InspectorHistory.cpp:
(WebCore::InspectorHistory::perform):
LayoutTests:
* inspector/elements/perform-undo-undo-expected.txt: Added.
* inspector/elements/perform-undo-undo.html: Added.
* inspector/styles/perform-undo-perform-of-mergable-action-expected.txt: Added.
* inspector/styles/perform-undo-perform-of-mergable-action.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (108074 => 108075)
--- trunk/LayoutTests/ChangeLog 2012-02-17 16:06:14 UTC (rev 108074)
+++ trunk/LayoutTests/ChangeLog 2012-02-17 16:13:59 UTC (rev 108075)
@@ -1,3 +1,15 @@
+2012-02-17 Pavel Feldman <pfeld...@google.com>
+
+ Web Inspector: check undo-redo boundaries based on current action index, not history size.
+ https://bugs.webkit.org/show_bug.cgi?id=78895
+
+ Reviewed by Vsevolod Vlasov.
+
+ * inspector/elements/perform-undo-undo-expected.txt: Added.
+ * inspector/elements/perform-undo-undo.html: Added.
+ * inspector/styles/perform-undo-perform-of-mergable-action-expected.txt: Added.
+ * inspector/styles/perform-undo-perform-of-mergable-action.html: Added.
+
2012-02-17 Philippe Normand <pnorm...@igalia.com>
Unreviewed, skipping 2 new test failures on GTK.
Added: trunk/LayoutTests/inspector/elements/perform-undo-undo-expected.txt (0 => 108075)
--- trunk/LayoutTests/inspector/elements/perform-undo-undo-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/elements/perform-undo-undo-expected.txt 2012-02-17 16:13:59 UTC (rev 108075)
@@ -0,0 +1,11 @@
+Tests that client can call undo multiple times with non-empty history.
+
+========= Original ========
+ <div style="display:none" id="container"></div>
+===== Modified element =====
+ <div style="display:none" id="container" foo="bar"></div>
+===== Undo 1 =====
+ <div style="display:none" id="container"></div>
+===== Undo 2 =====
+ <div style="display:none" id="container"></div>
+
Property changes on: trunk/LayoutTests/inspector/elements/perform-undo-undo-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/elements/perform-undo-undo.html (0 => 108075)
--- trunk/LayoutTests/inspector/elements/perform-undo-undo.html (rev 0)
+++ trunk/LayoutTests/inspector/elements/perform-undo-undo.html 2012-02-17 16:13:59 UTC (rev 108075)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+ var containerNode;
+ InspectorTest.expandElementsTree(step1);
+
+ function step1(node)
+ {
+ containerNode = InspectorTest.expandedNodeWithId("container");
+ InspectorTest.addResult("========= Original ========");
+ InspectorTest.dumpElementsTree(containerNode);
+ step2();
+ }
+
+ function step2()
+ {
+ function callback()
+ {
+ InspectorTest.addResult("===== Modified element =====");
+ InspectorTest.dumpElementsTree(containerNode);
+ step3();
+ }
+ containerNode.setAttribute("", "foo=\"bar\"", callback);
+ }
+
+ function step3()
+ {
+ function callback()
+ {
+ InspectorTest.addResult("===== Undo 1 =====");
+ InspectorTest.dumpElementsTree(containerNode);
+ step4();
+ }
+ WebInspector.domAgent.undo(callback);
+ }
+
+ function step4()
+ {
+ function callback()
+ {
+ InspectorTest.addResult("===== Undo 2 =====");
+ InspectorTest.dumpElementsTree(containerNode);
+ InspectorTest.completeTest();
+ }
+ WebInspector.domAgent.undo(callback);
+ }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that client can call undo multiple times with non-empty history.
+</p>
+
+<div style="display:none" id="container">
+</div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/elements/perform-undo-undo.html
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action-expected.txt (0 => 108075)
--- trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action-expected.txt 2012-02-17 16:13:59 UTC (rev 108075)
@@ -0,0 +1,59 @@
+Tests that perform-undo-perform of the mergeable action does not crash.
+
+Initial value
+[expanded]
+element.style { ()
+
+======== Matched CSS Rules ========
+[expanded]
+.container { (perform-undo-perform-of-mergable-action.html:7)
+font-weight: bold;
+
+[expanded]
+div { (user agent stylesheet)
+display: block;
+
+
+After changing property
+[expanded]
+element.style { ()
+
+======== Matched CSS Rules ========
+[expanded]
+.container { (perform-undo-perform-of-mergable-action.html:7)
+font-weight: normal;
+
+[expanded]
+div { (user agent stylesheet)
+display: block;
+
+
+After undo
+[expanded]
+element.style { ()
+
+======== Matched CSS Rules ========
+[expanded]
+.container { (perform-undo-perform-of-mergable-action.html:7)
+font-weight: bold;
+
+[expanded]
+div { (user agent stylesheet)
+display: block;
+
+
+After perform
+[expanded]
+element.style { ()
+
+======== Matched CSS Rules ========
+[expanded]
+.container { (perform-undo-perform-of-mergable-action.html:7)
+font-weight: normal;
+
+[expanded]
+div { (user agent stylesheet)
+display: block;
+
+
+
Property changes on: trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action.html (0 => 108075)
--- trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action.html (rev 0)
+++ trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action.html 2012-02-17 16:13:59 UTC (rev 108075)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<script src=""
+<script src=""
+
+<style>
+.container {
+ font-weight: bold
+}
+</style>
+
+<script>
+
+function test()
+{
+ InspectorTest.selectNodeAndWaitForStyles("container", step1);
+
+ function step1()
+ {
+ InspectorTest.addResult("Initial value");
+ InspectorTest.dumpSelectedElementStyles(true);
+
+ var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("font-weight");
+ treeItem.applyStyleText("font-weight: normal", true, false);
+ InspectorTest.waitForStyles("container", step2);
+ }
+
+ function step2()
+ {
+ InspectorTest.addResult("After changing property");
+ InspectorTest.dumpSelectedElementStyles(true);
+
+ WebInspector.domAgent.undo();
+ InspectorTest.waitForStyles("container", step3);
+ }
+
+ function step3()
+ {
+ InspectorTest.addResult("After undo");
+ InspectorTest.dumpSelectedElementStyles(true);
+
+ var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("font-weight");
+ treeItem.applyStyleText("font-weight: normal", true, false);
+ InspectorTest.waitForStyles("container", step4);
+ }
+
+ function step4()
+ {
+ InspectorTest.addResult("After perform");
+ InspectorTest.dumpSelectedElementStyles(true);
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that perform-undo-perform of the mergeable action does not crash.
+</p>
+
+<div id="container" class="container"></div>
+<div id="other" class="container"></div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/styles/perform-undo-perform-of-mergable-action.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (108074 => 108075)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 16:06:14 UTC (rev 108074)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 16:13:59 UTC (rev 108075)
@@ -1,3 +1,16 @@
+2012-02-17 Pavel Feldman <pfeld...@google.com>
+
+ Web Inspector: check undo-redo boundaries based on current action index, not history size.
+ https://bugs.webkit.org/show_bug.cgi?id=78895
+
+ Reviewed by Vsevolod Vlasov.
+
+ Tests: inspector/elements/perform-undo-undo.html
+ inspector/styles/perform-undo-perform-of-mergable-action.html
+
+ * inspector/InspectorHistory.cpp:
+ (WebCore::InspectorHistory::perform):
+
2012-02-17 Ilya Tikhonovsky <loi...@chromium.org>
Unreviewed, rolling out r108071.
Modified: trunk/Source/WebCore/inspector/InspectorHistory.cpp (108074 => 108075)
--- trunk/Source/WebCore/inspector/InspectorHistory.cpp 2012-02-17 16:06:14 UTC (rev 108074)
+++ trunk/Source/WebCore/inspector/InspectorHistory.cpp 2012-02-17 16:13:59 UTC (rev 108075)
@@ -90,7 +90,7 @@
if (!action->perform(ec))
return false;
- if (!m_history.isEmpty() && !action->mergeId().isEmpty() && action->mergeId() == m_history[m_afterLastActionIndex - 1]->mergeId())
+ if (!action->mergeId().isEmpty() && m_afterLastActionIndex > 0 && action->mergeId() == m_history[m_afterLastActionIndex - 1]->mergeId())
m_history[m_afterLastActionIndex - 1]->merge(action);
else {
m_history.resize(m_afterLastActionIndex);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes