Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed by Darin Adler. - fix <rdar://problem/3099526> Find command doesn't search form input controls (textareas and text fields) http://bugs.webkit.org/show_bug.cgi?id=7023 Test: editing/selection/find-in-text-control.html * WebCore.base.exp: Updated the TextIterator constructor signature. * editing/TextIterator.cpp: (WebCore::TextIterator::TextIterator): Added an enterTextControls boolean parameter that determines whether the iterator should visit text inside text areas and text fields. Added code to initialize the m_inShadowContent member variable based on whether the range is in shadow content. (WebCore::TextIterator::advance): Added code to step out of shadow content. (WebCore::TextIterator::handleReplacedElement): Added code to enter text controls if desired. (WebCore::CharacterIterator::CharacterIterator): Added an enterTextControls boolean parameter that determines whether the iterator should visit text inside text areas and text fields. This is passed to the TextIterator constructor. (WebCore::findPlainText): Changed to use a CharacterIterator that visits text controls. * editing/TextIterator.h: Added member variables to track whether the current node is in a shadow tree and whether the iterator should visit text controls. * page/Frame.cpp: (WebCore::Frame::findString): Changed to find inside text controls. (WebCore::Frame::markAllMatchesForText): Ditto. * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::innerTextElement): Added. * rendering/RenderTextControl.h: Added innerTextElement(), a private accessor method that is accessible to TextIterator through class friendship. LayoutTests: Reviewed by Darin Adler. - test for <rdar://problem/3099526> Find command doesn't search form input controls (textareas and text fields) http://bugs.webkit.org/show_bug.cgi?id=7023 * editing/selection/find-in-text-control-expected.txt: Added. * editing/selection/find-in-text-control.html: Added. Canonical link: https://commits.webkit.org/27270@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Dan Bernstein
committed
Jun 27, 2008
1 parent
2b4d7ce
commit 136a132
Showing
10 changed files
with
245 additions
and
30 deletions.
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
19 changes: 19 additions & 0 deletions
19
LayoutTests/editing/selection/find-in-text-control-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Test for https://bugs.webkit.org/show_bug.cgi?id=7023 Searching in text areas. | ||
|
||
Lorem ipt amet | ||
Target m matched at: | ||
outer text before, at offset 9 | ||
text control, at offset 2 | ||
outer text after, at offset 3 | ||
Target s matched at: | ||
text control, at offset 0 | ||
text control, at offset 10 | ||
Target si matched at: | ||
text control, at offset 10 | ||
Target rem matched at: | ||
outer text before, at offset 7 | ||
Target ipsum not matched | ||
Target sit not matched | ||
Target amet matched at: | ||
outer text after, at offset 2 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<p id="description" style="display: none;"> | ||
Test for <i><a href="https://bugs.webkit.org/show_bug.cgi?id=7023">https://bugs.webkit.org/show_bug.cgi?id=7023</a> Searching in text areas</i>. | ||
</p> | ||
<div id="div"> | ||
Lorem ip<textarea id="textarea">sum dolor si</textarea>t amet | ||
</div> | ||
<script> | ||
if (window.layoutTestController) | ||
layoutTestController.dumpAsText(); | ||
|
||
var result = ""; | ||
|
||
function findAll(target) | ||
{ | ||
document.body.offsetTop; | ||
var sel = getSelection(); | ||
sel.empty(); | ||
var ranges = []; | ||
document.execCommand("FindString", false, target); | ||
if (!sel.rangeCount) { | ||
result += "Target " + target + " not matched\n"; | ||
return; | ||
} | ||
var range = sel.getRangeAt(0); | ||
while (!ranges[0] || range.startContainer != ranges[0].startContainer || range.startOffset != ranges[0].startOffset) { | ||
ranges.push(range); | ||
document.execCommand("FindString", false, target); | ||
range = sel.getRangeAt(0); | ||
} | ||
var div = document.getElementById("div"); | ||
result += "Target " + target + " matched at:\n"; | ||
while (range = ranges.shift()) { | ||
result += " "; | ||
result += range.startContainer.parentNode != div ? "text control" : range.startContainer.nextSibling ? "outer text before" : "outer text after"; | ||
result += ", at offset " + range.startOffset + "\n"; | ||
} | ||
} | ||
|
||
findAll("m"); | ||
findAll("s"); | ||
findAll("si"); | ||
findAll("rem"); | ||
findAll("ipsum"); | ||
findAll("sit"); | ||
findAll("amet"); | ||
|
||
document.body.appendChild(document.createElement("pre")).appendChild(document.createTextNode(result)); | ||
document.getElementById("description").style.display = ""; | ||
</script> |
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
Oops, something went wrong.