Title: [122422] trunk
Revision
122422
Author
tk...@chromium.org
Date
2012-07-12 00:31:14 -0700 (Thu, 12 Jul 2012)

Log Message

Do not save the form state signature if nothing is saved
https://bugs.webkit.org/show_bug.cgi?id=91050

Reviewed by Hajime Morita.

Source/WebCore:

This change will reduce the size of HistoyItem.

Test: fast/forms/state-restore-empty-state.html

* html/FormController.cpp:
(WebCore::FormController::formElementsState):
If stateVector has only the signature string, clear it.

LayoutTests:

* fast/forms/resources/state-restore-empty-state-1.html: Added.
* fast/forms/state-restore-empty-state-expected.txt: Added.
* fast/forms/state-restore-empty-state.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122421 => 122422)


--- trunk/LayoutTests/ChangeLog	2012-07-12 06:18:09 UTC (rev 122421)
+++ trunk/LayoutTests/ChangeLog	2012-07-12 07:31:14 UTC (rev 122422)
@@ -1,3 +1,14 @@
+2012-07-12  Kent Tamura  <tk...@chromium.org>
+
+        Do not save the form state signature if nothing is saved
+        https://bugs.webkit.org/show_bug.cgi?id=91050
+
+        Reviewed by Hajime Morita.
+
+        * fast/forms/resources/state-restore-empty-state-1.html: Added.
+        * fast/forms/state-restore-empty-state-expected.txt: Added.
+        * fast/forms/state-restore-empty-state.html: Added.
+
 2012-07-11  Matt Falkenhagen  <fal...@chromium.org>
 
         Add dialog element feature toggle to InternalSettings

Added: trunk/LayoutTests/fast/forms/resources/state-restore-empty-state-1.html (0 => 122422)


--- trunk/LayoutTests/fast/forms/resources/state-restore-empty-state-1.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/resources/state-restore-empty-state-1.html	2012-07-12 07:31:14 UTC (rev 122422)
@@ -0,0 +1,13 @@
+<script src=""
+<script>
+description('State vector should be empty if nothing is saved.');
+if (window.internals) {
+    var states = internals.formControlStateOfPreviousHistoryItem();
+    shouldBe('states.length', '0');
+} else {
+    debug('Need window.internals.formControlStateOfPreviousHistoryItem().');
+}
+jsTestIsAsync = true;
+finishJSTest();
+</script>
+<script src=""

Added: trunk/LayoutTests/fast/forms/state-restore-empty-state-expected.txt (0 => 122422)


--- trunk/LayoutTests/fast/forms/state-restore-empty-state-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/state-restore-empty-state-expected.txt	2012-07-12 07:31:14 UTC (rev 122422)
@@ -0,0 +1,10 @@
+State vector should be empty if nothing is saved.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS states.length is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/state-restore-empty-state.html (0 => 122422)


--- trunk/LayoutTests/fast/forms/state-restore-empty-state.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/state-restore-empty-state.html	2012-07-12 07:31:14 UTC (rev 122422)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<input type=submit>
+
+<script>
+jsTestIsAsync = true;
+
+window._onload_ = function() {
+    setTimeout(function() {
+        location.href = '';
+    }, 0);
+};
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (122421 => 122422)


--- trunk/Source/WebCore/ChangeLog	2012-07-12 06:18:09 UTC (rev 122421)
+++ trunk/Source/WebCore/ChangeLog	2012-07-12 07:31:14 UTC (rev 122422)
@@ -1,3 +1,18 @@
+2012-07-12  Kent Tamura  <tk...@chromium.org>
+
+        Do not save the form state signature if nothing is saved
+        https://bugs.webkit.org/show_bug.cgi?id=91050
+
+        Reviewed by Hajime Morita.
+
+        This change will reduce the size of HistoyItem.
+
+        Test: fast/forms/state-restore-empty-state.html
+
+        * html/FormController.cpp:
+        (WebCore::FormController::formElementsState):
+        If stateVector has only the signature string, clear it.
+
 2012-07-11  Mark Rowe  <mr...@apple.com>
 
         <http://webkit.org/b/91051> Fix the Qt Mac build after r122400.

Modified: trunk/Source/WebCore/html/FormController.cpp (122421 => 122422)


--- trunk/Source/WebCore/html/FormController.cpp	2012-07-12 06:18:09 UTC (rev 122421)
+++ trunk/Source/WebCore/html/FormController.cpp	2012-07-12 07:31:14 UTC (rev 122422)
@@ -172,6 +172,9 @@
         stateVector.append(keyGenerator->formKey(*elementWithState).string());
         elementWithState->saveFormControlState().serializeTo(stateVector);
     }
+    bool hasOnlySignature = stateVector.size() == 1;
+    if (hasOnlySignature)
+        stateVector.clear();
     return stateVector;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to