Commit e2948901 authored by darin@apple.com's avatar darin@apple.com

WebCore:

2009-06-20  Darin Adler  <darin@apple.com>

        Reviewed by Dan Bernstein.

        Bug 26528: REGRESSION (r44674): Assertion in TextIterator::pushFullyClippedState while counting matches for "a" on apple.com
        https://bugs.webkit.org/show_bug.cgi?id=26528
        rdar://problem/6985329

        * editing/TextIterator.cpp:
        (WebCore::TextIterator::handleReplacedElement): When entering a text control,
        start at the top of the shadow tree (by calling shadowTreeRootNode). Also
        remove assumption that innerTextElement will never be 0 since RenderTextControl
        doesn't really guarantee this.

LayoutTests:

2009-06-20  Darin Adler  <darin@apple.com>

        Reviewed by Dan Bernstein.

        Bug 26528: REGRESSION (r44674): Assertion in TextIterator::pushFullyClippedState while counting matches for "a" on apple.com
        https://bugs.webkit.org/show_bug.cgi?id=26528
        rdar://problem/6985329

        * editing/selection/find-in-text-control-expected.txt: Updated to expect
        finding text in <input type="text"> and <input type="search">, but not
        in <input type="password">.

        * editing/selection/find-in-text-control.html: Added tests for <input>
        elements as well as <textarea> elements. Also tweaked result output
        format to accomodate multiple text nodes.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 930d4a61
2009-06-20 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
Bug 26528: REGRESSION (r44674): Assertion in TextIterator::pushFullyClippedState while counting matches for "a" on apple.com
https://bugs.webkit.org/show_bug.cgi?id=26528
rdar://problem/6985329
* editing/selection/find-in-text-control-expected.txt: Updated to expect
finding text in <input type="text"> and <input type="search">, but not
in <input type="password">.
* editing/selection/find-in-text-control.html: Added tests for <input>
elements as well as <textarea> elements. Also tweaked result output
format to accomodate multiple text nodes.
2009-06-20 Xan Lopez <xlopez@igalia.com>
Skip new accessibility test, we still lack and accessibilityController.
......
Test for https://bugs.webkit.org/show_bug.cgi?id=7023 Searching in text areas.
Lorem ipt amet
Lorem ipt amet Lorem ipt amet Lorem ipt amet Lorem ipt amet
Target m matched at:
outer text before, at offset 9
outer text node 1, at offset 9
text control, at offset 2
outer text after, at offset 3
outer text node 2, at offset 3
outer text node 2, at offset 15
text control, at offset 2
outer text node 3, at offset 3
outer text node 3, at offset 15
text control, at offset 2
outer text node 4, at offset 3
outer text node 4, at offset 15
outer text node 5, at offset 3
Target s matched at:
text control, at offset 0
text control, at offset 10
text control, at offset 0
text control, at offset 10
text control, at offset 0
text control, at offset 10
Target si matched at:
text control, at offset 10
text control, at offset 10
text control, at offset 10
Target rem matched at:
outer text before, at offset 7
outer text node 1, at offset 7
outer text node 2, at offset 13
outer text node 3, at offset 13
outer text node 4, at offset 13
Target ipsum not matched
Target sit not matched
Target amet matched at:
outer text after, at offset 2
outer text node 2, at offset 2
outer text node 3, at offset 2
outer text node 4, at offset 2
outer text node 5, at offset 2
......@@ -3,6 +3,9 @@
</p>
<div id="div">
Lorem ip<textarea id="textarea">sum dolor si</textarea>t amet
Lorem ip<input type="text" value="sum dolor si">t amet
Lorem ip<input type="search" value="sum dolor si">t amet
Lorem ip<input type="password" value="sum dolor si">t amet
</div>
<script>
if (window.layoutTestController)
......@@ -10,12 +13,32 @@
var result = "";
function elementIndex(node)
{
var index = 1;
while (node = node.previousSibling) {
if (node.nodeType == Node.ELEMENT_NODE)
++index;
}
return index;
}
function textNodeIndex(node)
{
var index = 1;
while (node = node.previousSibling) {
if (node.nodeType == Node.TEXT_NODE)
++index;
}
return index;
}
function findAll(target)
{
document.body.offsetTop;
var ranges = [];
var sel = getSelection();
sel.empty();
var ranges = [];
document.execCommand("FindString", false, target);
if (!sel.rangeCount) {
result += "Target " + target + " not matched\n";
......@@ -27,11 +50,13 @@
document.execCommand("FindString", false, target);
range = sel.getRangeAt(0);
}
sel.empty();
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 += range.startContainer.parentNode != div ? "text control" : "outer text node " + textNodeIndex(range.startContainer);
result += ", at offset " + range.startOffset + "\n";
}
}
......
2009-06-20 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
Bug 26528: REGRESSION (r44674): Assertion in TextIterator::pushFullyClippedState while counting matches for "a" on apple.com
https://bugs.webkit.org/show_bug.cgi?id=26528
rdar://problem/6985329
* editing/TextIterator.cpp:
(WebCore::TextIterator::handleReplacedElement): When entering a text control,
start at the top of the shadow tree (by calling shadowTreeRootNode). Also
remove assumption that innerTextElement will never be 0 since RenderTextControl
doesn't really guarantee this.
2009-06-20 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed by NOBODY.
......
......@@ -528,10 +528,12 @@ bool TextIterator::handleReplacedElement()
}
if (m_enterTextControls && renderer->isTextControl()) {
m_node = toRenderTextControl(renderer)->innerTextElement();
pushFullyClippedState(m_fullyClippedStack, m_node);
m_offset = 0;
return false;
if (HTMLElement* innerTextElement = toRenderTextControl(renderer)->innerTextElement()) {
m_node = innerTextElement->shadowTreeRootNode();
pushFullyClippedState(m_fullyClippedStack, m_node);
m_offset = 0;
return false;
}
}
m_haveEmitted = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment