REGRESSION(r94274): FormManagerTest.PreviewForm and FillFormNonEmptyField fail on...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Sep 2011 19:00:51 +0000 (19:00 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Sep 2011 19:00:51 +0000 (19:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67453

Reviewed by Kent Tamura.

.:

Add symbols for internals.

* Source/autotools/symbols.filter:

Source/WebCore:

Fixed the bug by updating inner text value in setSuggestedValue.

Also added a suggestedValue and setSuggestedValue on window.internals for testing purposes.

Test: fast/forms/suggested-value.html

* WebCore.exp.in:
* testing/Internals.cpp:
(WebCore::Internals::suggestedValue):
(WebCore::Internals::setSuggestedValue):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit/chromium:

Chromium code incorrectly calls Node::isFocusable without updating layout, and was hitting assertions.
Fix the assertion failure (and a potential crash) by updating layout in WebCore::isFocusable.

* src/WebNode.cpp:
(WebKit::WebNode::isFocusable):

Source/WebKit2:

Add symbols for internals.

* win/WebKit2.def:
* win/WebKit2CFLite.def:

LayoutTests:

Added a regression test to ensure HTMLInputElement updates its inner text value when the suggested value is set.

* fast/forms/suggested-value-expected.txt: Added.
* fast/forms/suggested-value.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94586 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/forms/suggested-value-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/suggested-value.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebNode.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter

index cec152ce4a32491247f605fd027a230adf29ff12..67f266037909924b9b6d5b36e46b6381d9fd8c74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r94274): FormManagerTest.PreviewForm and FillFormNonEmptyField fail on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=67453
+
+        Reviewed by Kent Tamura.
+
+        Add symbols for internals.
+
+        * Source/autotools/symbols.filter:
+
 2011-09-04  Robin Dunn  <robin@alldunn.com>
 
         [wx] Enable wxWebKit to run using the wxGC Cairo backend on platforms other than GTK.
index d7c3e8a9e6e7efee3d3922c2824d55436506f5e6..2470146b99d5b48d8d74311ac5f2ff8355f6f46f 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r94274): FormManagerTest.PreviewForm and FillFormNonEmptyField fail on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=67453
+
+        Reviewed by Kent Tamura.
+
+        Added a regression test to ensure HTMLInputElement updates its inner text value when the suggested value is set.
+
+        * fast/forms/suggested-value-expected.txt: Added.
+        * fast/forms/suggested-value.html: Added.
+
 2011-09-06  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
 
         Web Inspector: [Extensions API] rename webInspector.resources to webInspector.network
diff --git a/LayoutTests/fast/forms/suggested-value-expected.txt b/LayoutTests/fast/forms/suggested-value-expected.txt
new file mode 100644 (file)
index 0000000..a5d3a27
--- /dev/null
@@ -0,0 +1,14 @@
+This test setting a suggested value on an input element.
+The dump below should have the "suggested value" instead of "initial value".
+| <input>
+|   id="test"
+|   type="text"
+|   value="initial value"
+|   this.value="initial value"
+|   <shadow:root>
+|     <div>
+|       "suggested value"
+| "input.value: initial value"
+| "internals.suggestedValue(input): suggested value"
+| "input.selectionStart: 0"
+| "input.selectionEnd: 0"
diff --git a/LayoutTests/fast/forms/suggested-value.html b/LayoutTests/fast/forms/suggested-value.html
new file mode 100644 (file)
index 0000000..482d496
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p id="description">This test setting a suggested value on an input element.
+The dump below should have the "suggested value" instead of "initial value".</p>
+<pre><input id="test" type="text" value="initial value"></pre>
+<script src="../../resources/dump-as-markup.js"></script>
+<script>
+
+var input = document.getElementById('test');
+var result = document.getElementById('result');
+if (!window.internals)
+    testFailed('This test requires internals object');
+else {
+    input.focus();
+    input.selectionStart = input.selectionEnd = 0;
+
+    internals.setSuggestedValue(input, 'suggested value');
+
+    Markup.description(document.getElementById('description').textContent)
+
+    function addTextResult(value) { input.parentNode.appendChild(document.createTextNode(value + ': ' + eval(value))); }
+    addTextResult('input.value');
+    addTextResult('internals.suggestedValue(input)');
+    addTextResult('input.selectionStart');
+    addTextResult('input.selectionEnd');
+
+    Markup.dump(input.parentNode);
+}
+
+</script>
+</body>
+</html>
index 6a28bd161fe4ef11c7b18b272cb3b4c0928966ab..8dec875cdda7a1cb0a8a5ba7c61f2783f6823790 100644 (file)
@@ -1,3 +1,23 @@
+2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r94274): FormManagerTest.PreviewForm and FillFormNonEmptyField fail on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=67453
+
+        Reviewed by Kent Tamura.
+
+        Fixed the bug by updating inner text value in setSuggestedValue.
+
+        Also added a suggestedValue and setSuggestedValue on window.internals for testing purposes.
+
+        Test: fast/forms/suggested-value.html
+
+        * WebCore.exp.in:
+        * testing/Internals.cpp:
+        (WebCore::Internals::suggestedValue):
+        (WebCore::Internals::setSuggestedValue):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2011-09-06  Eric Carlson  <eric.carlson@apple.com>
 
         load() does not reset the resource selection algorithm
index 82f85cd46ced42dd83911436b1515ebb8f851fe4..03a810c9b81dbbab8282c3f8b1f45fe8bab4518e 100644 (file)
@@ -452,6 +452,7 @@ __ZN7WebCore16FontPlatformDataC1EP6NSFontfbbNS_15FontOrientationENS_15TextOrient
 __ZN7WebCore16FontPlatformDataD1Ev
 __ZN7WebCore16HTMLInputElement13setAutofilledEb
 __ZN7WebCore16HTMLInputElement15setValueForUserERKN3WTF6StringE
+__ZN7WebCore16HTMLInputElement17setSuggestedValueERKN3WTF6StringE
 __ZN7WebCore16IconDatabaseBase28synchronousIconURLForPageURLERKN3WTF6StringE
 __ZN7WebCore16IconDatabaseBase4openERKN3WTF6StringES4_
 __ZN7WebCore16LegacyWebArchive19createFromSelectionEPNS_5FrameE
@@ -1182,6 +1183,7 @@ __ZNK7WebCore15VisiblePosition4nextENS_27EditingBoundaryCrossingRuleE
 __ZNK7WebCore15VisiblePosition8previousENS_27EditingBoundaryCrossingRuleE
 __ZNK7WebCore16FontFallbackList10fontDataAtEPKNS_4FontEj
 __ZNK7WebCore16HTMLInputElement11isTextFieldEv
+__ZNK7WebCore16HTMLInputElement14suggestedValueEv
 __ZNK7WebCore16HTMLInputElement15isPasswordFieldEv
 __ZNK7WebCore16HTMLInputElement18shouldAutocompleteEv
 __ZNK7WebCore16IconDatabaseBase12databasePathEv
index 777ca8632fa91717eb423e7e2f72ee9e4a7512b1..e243d5644b15d1710563e17b92bfae935a04da42 100644 (file)
@@ -1073,9 +1073,8 @@ void HTMLInputElement::setSuggestedValue(const String& value)
     setFormControlValueMatchesRenderer(false);
     m_suggestedValue = sanitizeValue(value);
     updatePlaceholderVisibility(false);
-    if (renderer())
-        renderer()->updateFromElement();
     setNeedsStyleRecalc();
+    updateInnerTextValue();
 }
 
 void HTMLInputElement::setValue(const String& value, bool sendChangeEvent)
index e44b5f75e61299b9589b31ae6f04f41fb4ae1c60..a327abdb743626ace0c827d9a1fe37599edf3887 100644 (file)
@@ -303,4 +303,34 @@ bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
     return false;
 }
 
+String Internals::suggestedValue(Element* inputElement, ExceptionCode& ec)
+{
+    if (!inputElement) {
+        ec = INVALID_ACCESS_ERR;
+        return String();
+    }
+
+    if (!inputElement->hasTagName(HTMLNames::inputTag)) {
+        ec = INVALID_NODE_TYPE_ERR;
+        return String();
+    }
+
+    return static_cast<HTMLInputElement*>(inputElement)->suggestedValue();
+}
+
+void Internals::setSuggestedValue(Element* inputElement, const String& value, ExceptionCode& ec)
+{
+    if (!inputElement) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    if (!inputElement->hasTagName(HTMLNames::inputTag)) {
+        ec = INVALID_NODE_TYPE_ERR;
+        return;
+    }
+
+    static_cast<HTMLInputElement*>(inputElement)->setSuggestedValue(value);
+}
+
 }
index 59249e3f1faf7fc855a1de96ac3d5ffdd889ce3e..8f314a18953769d4cf4a0503366b99f12f78ed46 100644 (file)
@@ -82,6 +82,8 @@ public:
     void setPasswordEchoDurationInSeconds(Document*, double durationInSeconds, ExceptionCode&);
 
     bool wasLastChangeUserEdit(Element* textField, ExceptionCode&);
+    String suggestedValue(Element* inputElement, ExceptionCode&);
+    void setSuggestedValue(Element* inputElement, const String&, ExceptionCode&);
 
     static const char* internalsId;
 
index 2de3fc4b1e8f40eb9dddd6a9dad97c61204e2c64..2c49cada24a064c2f173422bc88cdaffedc8c0a3 100644 (file)
@@ -56,6 +56,8 @@ module window {
         void setPasswordEchoDurationInSeconds(in Document document, in double durationInSeconds) raises(DOMException);
 
         boolean wasLastChangeUserEdit(in Element textField) raises (DOMException);
+        DOMString suggestedValue(in Element inputElement) raises (DOMException);
+        void setSuggestedValue(in Element inputElement, in DOMString value) raises (DOMException);
     };
 }
 
index 73d3ec3dbc07ea552205af340161b5ea94a855e6..01a3fd89135d4e90c513d9fad0e4f8ab80716bc5 100644 (file)
@@ -1,3 +1,16 @@
+2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r94274): FormManagerTest.PreviewForm and FillFormNonEmptyField fail on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=67453
+
+        Reviewed by Kent Tamura.
+
+        Chromium code incorrectly calls Node::isFocusable without updating layout, and was hitting assertions.
+        Fix the assertion failure (and a potential crash) by updating layout in WebCore::isFocusable.
+
+        * src/WebNode.cpp:
+        (WebKit::WebNode::isFocusable):
+
 2011-09-04  Adam Barth  <abarth@webkit.org>
 
         [Chromium] Add mutliple to WebPopupMenuInfo for Android
index cfb8528c80628b4dc584027bb013c733fd48d934..2e4e3bec71d70d4dbfa624b1b2b69e3252b28a4d 100644 (file)
@@ -147,6 +147,7 @@ bool WebNode::isTextNode() const
 
 bool WebNode::isFocusable() const
 {
+    m_private->document()->updateLayout();
     return m_private->isFocusable();
 }
 
index ce5fd9ac034845b8e3b0381ba4125c48374cd593..9bb2841d83036407362fe0627185b5837f1abc6b 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r94274): FormManagerTest.PreviewForm and FillFormNonEmptyField fail on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=67453
+
+        Reviewed by Kent Tamura.
+
+        Add symbols for internals.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2011-09-06  Wajahat Siddiqui  <mdwajahatali.siddiqui@motorola.com>
 
         [GTK] Use soup_session_add_feature_by_type uniformly in WebKit2.
index a2f0663ef10950055252167b31659c02243bda5d..0c56c19aabe8f1b4e1b6e1674230fa589e3896bc 100644 (file)
@@ -165,8 +165,10 @@ EXPORTS
         ?setDisabled@MemoryCache@WebCore@@QAEX_N@Z
         ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
         ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
+        ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
         ?settings@Document@WebCore@@QBEPAVSettings@2@XZ
         ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
+        ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
         ?textareaTag@HTMLNames@WebCore@@3VQualifiedName@2@B
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
index b4c75f2a24170e3f3cccf3c93a915ec4f2b7217f..4f079e1d25687ae5e0bb07f24d7cb67b0f1e6657 100644 (file)
@@ -159,8 +159,10 @@ EXPORTS
         ?setDisabled@MemoryCache@WebCore@@QAEX_N@Z
         ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
         ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
+        ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
         ?settings@Document@WebCore@@QBEPAVSettings@2@XZ
         ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
+        ?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ
         ?textareaTag@HTMLNames@WebCore@@3VQualifiedName@2@B
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
index 32abc35e6989fe96acfe71afaeaf34d834acadd3..5aa510c4698ccbbffbe2ff8bf6e36b6858910f7b 100644 (file)
@@ -46,6 +46,7 @@ _ZN7WebCore12JSDOMWrapper34virtualFunctionToPreventWeakVtableEv;
 _ZN7WebCore12RenderObject23absoluteBoundingBoxRectEb;
 _ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE;
 _ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi;
+_ZN7WebCore16HTMLInputElement17setSuggestedValueERKN3WTF6StringE;
 _ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10StringImplENS0_4WeakINS0_8JSStringEEENS3_10StringHashENS3_10HashTraitsIS6_EENSB_IS9_EEEES6_;
 _ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE;
 _ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii;
@@ -64,6 +65,7 @@ _ZN7WebCore7Element16removeShadowRootEv;
 _ZN7WebCore9JSElement3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
 _ZN7WebCore9JSElement6s_infoE;
 _ZN7WebCore9toElementEN3JSC7JSValueE;
+_ZNK7WebCore16HTMLInputElement14suggestedValueEv;
 _ZNK7WebCore20CachedResourceLoader11isPreloadedERKN3WTF6StringE;
 _ZNK7WebCore26HTMLTextFormControlElement21lastChangeWasUserEditEv;
 _ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE;