Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
LayoutTests:
Reviewed by Maciej. - test for <rdar://problem/4887428> REGRESSION: Implement slight delay for firing incremental onSearch event * fast/forms/search-event-delay-expected.txt: Added. * fast/forms/search-event-delay.html: Added. WebCore: Reviewed by Maciej. - fix <rdar://problem/4887428> REGRESSION: Implement slight delay for firing incremental onSearch event * rendering/RenderTextControl.h: * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::RenderTextControl): Set up timer. (WebCore::RenderTextControl::subtreeHasChanged): Start timer here instead of immediately sending event. (WebCore::RenderTextControl::searchEventTimerFired): Added. Sends search event. (WebCore::RenderTextControl::stopSearchEventTimer): Added. (WebCore::RenderTextControl::startSearchEventTimer): Added. Sends search event right away if there is no text. If there is some text, sets the timer using the same delay rule as NSSearchField. If you keep typing, then the timer keeps getting reset 0.2 seconds into the future until you pause. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::onSearch): Tell the renderer to stop the timer, since we're sending a search event. This helps when a caller other than the timer decides to send an explicit search event. Canonical link: https://commits.webkit.org/16261@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,10 @@ | ||
This tests the delay between when you type and the search event fires. | ||
|
||
As of this writing we can't use DOM events to type into a search field, so the test uses the event sender and only runs under DumpRenderTree. | ||
|
||
|
||
|
||
The two rows below should match. | ||
0.5 0.4 0.3 0.2 0.2 0 | ||
0.5 0.4 0.3 0.2 0.2 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,64 @@ | ||
<script> | ||
|
||
var count = 0; | ||
var keyEventTime; | ||
|
||
function sendKeyEvent() | ||
{ | ||
if (window.eventSender) | ||
eventSender.keyDown("x"); | ||
} | ||
|
||
function sendDeleteKeyEvent() | ||
{ | ||
if (window.eventSender) | ||
eventSender.keyDown("\x7F"); | ||
} | ||
|
||
function keyEvent(event) | ||
{ | ||
keyEventTime = event.timeStamp; | ||
} | ||
|
||
function searchEvent(event) | ||
{ | ||
document.getElementById("times").innerHTML += " " + (Math.round((event.timeStamp - keyEventTime) / 100) / 10); | ||
count += 1; | ||
if (count != 6) { | ||
if (count != 5) | ||
sendKeyEvent(); | ||
else { | ||
document.getElementById("search").select(); | ||
sendDeleteKeyEvent(); | ||
} | ||
} else { | ||
if (window.layoutTestController) | ||
layoutTestController.notifyDone(); | ||
} | ||
} | ||
|
||
function startTest() | ||
{ | ||
if (window.layoutTestController) { | ||
layoutTestController.dumpAsText(); | ||
layoutTestController.waitUntilDone(); | ||
} | ||
document.getElementById("search").focus(); | ||
sendKeyEvent(); | ||
} | ||
|
||
</script> | ||
|
||
<body onload="startTest()"> | ||
|
||
<p>This tests the delay between when you type and the search event fires.</p> | ||
|
||
<p>As of this writing we can't use DOM events to type into a search field, so the test uses the event sender and only runs under DumpRenderTree.</p> | ||
|
||
<p><input id="search" type="search" incremental onkeypress="keyEvent(event)" onsearch="searchEvent(event)"></p> | ||
|
||
<div>The two rows below should match.</div> | ||
<div>0.5 0.4 0.3 0.2 0.2 0</p> | ||
<div id="times"></div> | ||
|
||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters