Source/WebCore/ChangeLog

 12012-05-12 Keishi Hattori <keishi@webkit.org>
 2
 3 [chromium] Add WebKit API to access inner text value of input element
 4 https://bugs.webkit.org/show_bug.cgi?id=85353
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Test: fast/forms/editing-value.html
 9
 10 We need this to implement the datalist UI for <input type=email multiple>.
 11 HTMLInputElement.value gives you the sanitized value so the whitespace between values are trimmed.
 12 We need to append the selected suggestion to the end without modifying the rest of the text.
 13
 14 * WebCore.exp.in: Added HTMLInputElement::setEditingValue
 15 * html/HTMLInputElement.cpp:
 16 (WebCore::HTMLInputElement::setEditingValue):
 17 (WebCore):
 18 * html/HTMLInputElement.h:
 19 (HTMLInputElement):
 20 * testing/Internals.cpp:
 21 (WebCore::Internals::setEditingValue):
 22 (WebCore):
 23 * testing/Internals.h:
 24 (Internals):
 25 * testing/Internals.idl:
 26
1272012-05-14 Gavin Peters <gavinp@chromium.org>
228
329 Add Prerenderer, PrerenderHandle and a chromium interface for Prerendering.

Source/WebKit/chromium/ChangeLog

 12012-05-12 Keishi Hattori <keishi@webkit.org>
 2
 3 [chromium] Add WebKit API to access inner text value of input element
 4 https://bugs.webkit.org/show_bug.cgi?id=85353
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * public/WebInputElement.h:
 9 (WebInputElement):
 10 * src/WebInputElement.cpp:
 11 (WebKit::WebInputElement::editingValue):
 12 (WebKit):
 13 (WebKit::WebInputElement::setEditingValue):
 14
1152012-05-14 Gavin Peters <gavinp@chromium.org>
216
317 Add Prerenderer, PrerenderHandle and a chromium interface for Prerendering.

Source/WebKit2/ChangeLog

 12012-05-15 Keishi Hattori <keishi@webkit.org>
 2
 3 [chromium] Add WebKit API to access inner text value of input element
 4 https://bugs.webkit.org/show_bug.cgi?id=85353
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * win/WebKit2.def: Added HTMLInputElement::setEditingValue
 9 * win/WebKit2CFLite.def: Added HTMLInputElement::setEditingValue
 10
1112012-05-14 Luke Macpherson <macpherson@chromium.org>
212
313 Introduce ENABLE_CSS_VARIABLES compile flag.

Source/WebCore/WebCore.exp.in

@@__ZN7WebCore16FontPlatformDataD1Ev
484484__ZN7WebCore16HTMLInputElement13setAutofilledEb
485485__ZN7WebCore16HTMLInputElement15setValueForUserERKN3WTF6StringE
486486__ZN7WebCore16HTMLInputElement17setSuggestedValueERKN3WTF6StringE
 487__ZN7WebCore16HTMLInputElement15setEditingValueERKN3WTF6StringE
487488__ZN7WebCore16IconDatabaseBase28synchronousIconURLForPageURLERKN3WTF6StringE
488489__ZN7WebCore16IconDatabaseBase4openERKN3WTF6StringES4_
489490__ZN7WebCore16LegacyWebArchive19createFromSelectionEPNS_5FrameE

Source/WebCore/html/HTMLInputElement.cpp

@@void HTMLInputElement::setSuggestedValue(const String& value)
889889 updateInnerTextValue();
890890}
891891
 892void HTMLInputElement::setEditingValue(const String& value)
 893{
 894 if (!renderer() || !isTextField())
 895 return;
 896 setInnerTextValue(value);
 897 subtreeHasChanged();
 898 dispatchInputEvent();
 899}
 900
892901void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior eventBehavior)
893902{
894903 if (!m_inputType->canSetValue(value))

Source/WebCore/html/HTMLInputElement.h

@@public:
156156 const String& suggestedValue() const;
157157 void setSuggestedValue(const String&);
158158
 159 void setEditingValue(const String&);
 160
159161 double valueAsDate() const;
160162 void setValueAsDate(double, ExceptionCode&);
161163

Source/WebCore/testing/Internals.cpp

@@void Internals::setSuggestedValue(Element* element, const String& value, Excepti
634634 inputElement->setSuggestedValue(value);
635635}
636636
 637void Internals::setEditingValue(Element* element, const String& value, ExceptionCode& ec)
 638{
 639 if (!element) {
 640 ec = INVALID_ACCESS_ERR;
 641 return;
 642 }
 643
 644 HTMLInputElement* inputElement = element->toInputElement();
 645 if (!inputElement) {
 646 ec = INVALID_NODE_TYPE_ERR;
 647 return;
 648 }
 649
 650 inputElement->setEditingValue(value);
 651}
 652
637653void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionCode& ec)
638654{
639655 if (!element || !element->document() || !element->document()->view()) {

Source/WebCore/testing/Internals.h

@@public:
113113 bool wasLastChangeUserEdit(Element* textField, ExceptionCode&);
114114 String suggestedValue(Element* inputElement, ExceptionCode&);
115115 void setSuggestedValue(Element* inputElement, const String&, ExceptionCode&);
 116 void setEditingValue(Element* inputElement, const String&, ExceptionCode&);
116117 void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionCode&);
117118
118119 void paintControlTints(Document*, ExceptionCode&);

Source/WebCore/testing/Internals.idl

@@module window {
8585 boolean wasLastChangeUserEdit(in Element textField) raises (DOMException);
8686 DOMString suggestedValue(in Element inputElement) raises (DOMException);
8787 void setSuggestedValue(in Element inputElement, in DOMString value) raises (DOMException);
 88 void setEditingValue(in Element inputElement, in DOMString value) raises (DOMException);
8889
8990 void paintControlTints(in Document document) raises (DOMException);
9091

Source/WebKit/chromium/public/WebInputElement.h

@@namespace WebKit {
7474 WEBKIT_EXPORT int size() const;
7575 WEBKIT_EXPORT void setValue(const WebString&, bool sendChangeEvent = false);
7676 WEBKIT_EXPORT WebString value() const;
 77 // This returns the non-sanitized, exact value inside the text field.
 78 WEBKIT_EXPORT WebString editingValue() const;
 79 // Sets the value inside the text field without being sanitized.
 80 // Can't be used if a renderer doesn't exist or on a non text field type.
 81 WEBKIT_EXPORT void setEditingValue(const WebString&);
7782 WEBKIT_EXPORT void setSuggestedValue(const WebString&);
7883 WEBKIT_EXPORT WebString suggestedValue() const;
7984 WEBKIT_EXPORT void setPlaceholder(const WebString&);

Source/WebKit/chromium/src/WebInputElement.cpp

@@WebString WebInputElement::value() const
9898 return constUnwrap<HTMLInputElement>()->value();
9999}
100100
 101WebString WebInputElement::editingValue() const
 102{
 103 return constUnwrap<HTMLInputElement>()->innerTextValue();
 104}
 105
 106void WebInputElement::setEditingValue(const WebString& value)
 107{
 108 unwrap<HTMLInputElement>()->setEditingValue(value);
 109}
 110
101111void WebInputElement::setSuggestedValue(const WebString& value)
102112{
103113 unwrap<HTMLInputElement>()->setSuggestedValue(value);

Source/WebKit2/win/WebKit2.def

@@EXPORTS
224224 ?setSerifFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z
225225 ?setStandardFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z
226226 ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
 227 ?setEditingValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
227228 ?settings@Document@WebCore@@QBEPAVSettings@2@XZ
228229 ?settings@Frame@WebCore@@QBEPAVSettings@2@XZ
229230 ?setFixedElementsLayoutRelativeToFrame@Settings@WebCore@@QAEX_N@Z

Source/WebKit2/win/WebKit2CFLite.def

@@EXPORTS
217217 ?setSerifFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z
218218 ?setStandardFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z
219219 ?setSuggestedValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
 220 ?setEditingValue@HTMLInputElement@WebCore@@QAEXABVString@WTF@@@Z
220221 ?settings@Document@WebCore@@QBEPAVSettings@2@XZ
221222 ?settings@Frame@WebCore@@QBEPAVSettings@2@XZ
222223 ?setFixedElementsLayoutRelativeToFrame@Settings@WebCore@@QAEX_N@Z

Source/autotools/symbols.filter

@@_ZN7WebCore14ClientRectListC1Ev;
5555_ZN7WebCore14ClientRectListD1Ev;
5656_ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi;
5757_ZN7WebCore16HTMLInputElement17setSuggestedValueERKN3WTF6StringE;
 58_ZN7WebCore16HTMLInputElement15setEditingValueERKN3WTF6StringE;
5859_ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10StringImplENS0_4WeakINS0_8JSStringEEENS3_10StringHashENS3_10HashTraitsIS6_EENSB_IS9_EEEES6_;
5960_ZN7WebCore16scriptNameToCodeERKN3WTF6StringE;
6061_ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE;

LayoutTests/ChangeLog

 12012-05-12 Keishi Hattori <keishi@webkit.org>
 2
 3 [chromium] Add WebKit API to access inner text value of input element
 4 https://bugs.webkit.org/show_bug.cgi?id=85353
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/forms/editing-value-expected.txt: Added.
 9 * fast/forms/editing-value.html: Added. Tests that setting the editing value takes care of the style and placeholder, and that it fires an input event.
 10
1112012-05-14 Kent Tamura <tkent@chromium.org>
212
313 [Chromium] Update test expectations.

LayoutTests/fast/forms/editing-value-expected.txt

 1This tests setting the editing value of an input.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS oninput event was fired.
 7PASS input.value is "foo"
 8PASS document.querySelector(":invalid") is input
 9PASS onchange event was fired.
 10PASS successfullyParsed is true
 11
 12TEST COMPLETE
 13

LayoutTests/fast/forms/editing-value.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<script src="../../fast/js/resources/js-test-pre.js"></script>
 5</head>
 6<body>
 7<p id="description"></p>
 8<div id="console"></div>
 9
 10<input type="email" id="test" placeholder="FAIL: placeholder should disappear">
 11
 12<script>
 13description('This tests setting the editing value of an input.');
 14
 15var input = document.getElementById('test');
 16input.onchange = function() {
 17 testPassed("onchange event was fired.");
 18};
 19input.oninput = function() {
 20 testPassed("oninput event was fired.");
 21};
 22
 23input.focus();
 24if (window.internals)
 25 internals.setEditingValue(input, " foo ");
 26shouldBe('input.value', '"foo"');
 27shouldBe('document.querySelector(":invalid")', 'input');
 28input.blur();
 29
 30</script>
 31
 32<script src="../../fast/js/resources/js-test-post.js"></script>
 33</body>
 34</html>

ChangeLog

 12012-05-15 Keishi Hattori <keishi@webkit.org>
 2
 3 [chromium] Add WebKit API to access inner text value of input element
 4 https://bugs.webkit.org/show_bug.cgi?id=85353
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * Source/autotools/symbols.filter: Added HTMLInputElement::setEditingValue
 9
1102012-05-14 Luke Macpherson <macpherson@chromium.org>
211
312 Introduce ENABLE_CSS_VARIABLES compile flag.