Bug 5856 - Selection based in an editable block can extend outside
Summary: Selection based in an editable block can extend outside
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Major
Assignee: Justin Garcia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-28 15:34 PST by Justin Garcia
Modified: 2005-12-03 18:27 PST (History)
3 users (show)

See Also:


Attachments
testcase (627 bytes, text/html)
2005-11-28 15:35 PST, Justin Garcia
no flags Details
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 Details
patch (8.11 KB, patch)
2005-12-03 02:22 PST, Justin Garcia
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Garcia 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.
Comment 1 Justin Garcia 2005-11-28 15:35:20 PST
Created attachment 4839 [details]
testcase
Comment 2 Justin Garcia 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.
Comment 3 Dan Wood 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....
Comment 4 Justin Garcia 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.
Comment 5 Justin Garcia 2005-12-03 02:24:24 PST
testing details: added a few new layout tests, all current tests pass.
Comment 6 Darin Adler 2005-12-03 08:59:27 PST
Comment on attachment 4915 [details]
patch

Wow, looks really good! r=me
Comment 7 Justin Garcia 2005-12-03 18:27:01 PST
Landed the patch.