RESOLVED FIXED Bug 126322
REGRESSION (r158617): Find on Page can get stuck in a loop when the search string occurs in an <input> in a <fieldset>
https://bugs.webkit.org/show_bug.cgi?id=126322
Summary REGRESSION (r158617): Find on Page can get stuck in a loop when the search st...
mitz
Reported 2013-12-30 21:05:12 PST
To reproduce: navigate to the URL in Safari, choose Edit > Find > Find, and in the Find bar, type “rule” (without the quotes). Notice how Safari reports more than 1,000 matches. This was caused by <http://trac.webkit.org/r158617>, the fix for bug 123697.
Attachments
Patch (6.28 KB, patch)
2014-04-13 11:22 PDT, Darin Adler
no flags
Patch (12.78 KB, patch)
2014-04-13 21:23 PDT, Darin Adler
no flags
mitz
Comment 1 2013-12-30 21:54:22 PST
Darin Adler
Comment 2 2014-04-13 01:11:04 PDT
The problem with http://trac.webkit.org/r158617 is that it changes the behavior of the low-level function Range::firstNode. I’m going to roll that part of the patch out and then see what happens to the accessibility behavior.
Darin Adler
Comment 3 2014-04-13 01:17:04 PDT
I just tested Safari 7.0.3 and it also shows the "more then 1,000 matches" behavior. Does that make sense given that http://trac.webkit.org/r158617 should not be there in the WebKit used by Safari 7.0.3?
chris fleizach
Comment 4 2014-04-13 01:24:08 PDT
(In reply to comment #3) > I just tested Safari 7.0.3 and it also shows the "more then 1,000 matches" behavior. Does that make sense given that http://trac.webkit.org/r158617 should not be there in the WebKit used by Safari 7.0.3? I think this change went into the 7.0.3 update
Darin Adler
Comment 5 2014-04-13 10:08:05 PDT
Yes, removing the incorrect change to Range::firstNode does indeed fix the find problem right away. But it reintroduces the problem from bug 123697. The core of the problem is trying to make elements with rendered children work the way that <img> elements work with our editing code. Unfortunately, for <img> elements, we are still stuck with the old model where we represent “before the image” as (<img>, 0) in a lot of code; parent node <img>, offset 0. Which in actual Range semantics means “inside the image”, not “before the image“. We have a long term plan to get rid of this, but since it’s still around it causes us major headaches. Here, the problem is that for the <div role="image">, (<div>, 0) can mean either “before the image” or “inside the image”. The hacks that make this almost work are getting out of hand at this point. Instead of modifying firstNode, we need to modify Position::parentAnchoredEquivalent to handle this case.
Darin Adler
Comment 6 2014-04-13 11:22:12 PDT
Darin Adler
Comment 7 2014-04-13 11:23:02 PDT
The patch is ready to go and passes all the existing tests. But before landing it we should really add a new test for the actual problem with find. That’s the only thing preventing me from putting this up for review and landing it.
Darin Adler
Comment 8 2014-04-13 21:23:30 PDT
Ryosuke Niwa
Comment 9 2014-04-13 21:54:14 PDT
Comment on attachment 229259 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=229259&action=review > Source/WebCore/dom/Element.cpp:2944 > + return !equalIgnoringCase(fastGetAttribute(roleAttr), "img"); Should other element subclasses that override this method check this condition as well?
Darin Adler
Comment 10 2014-04-13 21:58:58 PDT
(In reply to comment #9) > Should other element subclasses that override this method check this condition as well? The only element classes that override this for any reason other than to unconditionally return false are HTMLObjectElement and HTMLHRElement. I’m not sure that either of them really needs to support role="image", but I could change them to call through to the base class.
Darin Adler
Comment 11 2014-04-13 23:55:40 PDT
Alexey Proskuryakov
Comment 12 2014-04-14 12:53:57 PDT
This change broke a test, editing/editability/ignored-content.html either fails or asserts: http://webkit-test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=editing%2Feditability%2Fignored-content.html
Darin Adler
Comment 13 2014-04-14 20:06:46 PDT
Darin Adler
Comment 14 2014-04-14 20:07:23 PDT
The followup fixes the problem seen on the bots/flakiness dashboard.
Alexey Proskuryakov
Comment 15 2014-04-14 23:26:54 PDT
Confirmed, thank you!
Note You need to log in before you can comment on or make changes to this bug.