RESOLVED FIXED 5856
Selection based in an editable block can extend outside
https://bugs.webkit.org/show_bug.cgi?id=5856
Summary Selection based in an editable block can extend outside
Justin Garcia
Reported 2005-11-28 15:34:35 PST
Load the attached test case and double click after the end of the word 'reproducible'. The word 'reproducible' should be selected. Insead, a selection is created that reaches outside the editable div.
Attachments
testcase (627 bytes, text/html)
2005-11-28 15:35 PST, Justin Garcia
no flags
Similar reduced case, but double-click on last word over-selects (339 bytes, text/html)
2005-11-29 12:05 PST, Dan Wood
no flags
patch (8.11 KB, patch)
2005-12-03 02:22 PST, Justin Garcia
darin: review+
Justin Garcia
Comment 1 2005-11-28 15:35:20 PST
Created attachment 4839 [details] testcase
Justin Garcia
Comment 2 2005-11-28 15:42:49 PST
This bug comes from the fact that SelectionController::validate does changes to the selection that aren't validated (changes when the granularity passed to validate does not equal CHARACTER). It doesn't seem right that such changes are part of "validation" at all.
Dan Wood
Comment 3 2005-11-29 12:05:27 PST
Created attachment 4853 [details] Similar reduced case, but double-click on last word over-selects This attachment is similar, but I found that if you double-click on the last word -- not just the space past the last word -- you get over-selection as well. This is probably the same root problem....
Justin Garcia
Comment 4 2005-12-03 02:22:20 PST
Created attachment 4915 [details] patch validate() used to do expansion of the selection. The expansion itself wasn't validated, so it was allowed to expand and extend outside an editable area. Also m_base and m_extent weren't updated with the results of the expansion. The patch moves expansion of the selection from validate() to expandUsingGranularity(). Removes the granularity parameter to validate() since it's no longer used.
Justin Garcia
Comment 5 2005-12-03 02:24:24 PST
testing details: added a few new layout tests, all current tests pass.
Darin Adler
Comment 6 2005-12-03 08:59:27 PST
Comment on attachment 4915 [details] patch Wow, looks really good! r=me
Justin Garcia
Comment 7 2005-12-03 18:27:01 PST
Landed the patch.
Note You need to log in before you can comment on or make changes to this bug.