Bug 32622 - Right clicking in a table cell creates a selection that extends into the next cell
Summary: Right clicking in a table cell creates a selection that extends into the next...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Normal
Assignee: Enrica Casucci
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2009-12-16 11:35 PST by Enrica Casucci
Modified: 2009-12-16 14:03 PST (History)
1 user (show)

See Also:


Attachments
Repro case (2.34 MB, application/zip)
2009-12-16 11:35 PST, Enrica Casucci
no flags Details
Patch (8.40 KB, patch)
2009-12-16 11:44 PST, Enrica Casucci
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enrica Casucci 2009-12-16 11:35:08 PST
Created attachment 44998 [details]
Repro case

Repro Steps --
1. Create an application with a WebView.

2. Create and open an HTML file with the following element:
<table border="1" cellspacing="0"><tr><td width="50" height="25pt"></td><td width="50" height="25pt"></td><td width="50" height="25pt"></td></tr></table>

3. Make sure there is nothing selected (other than a typing cursor).

4. Right-click inside the first table cell.

5. Call [WebView selectedDOMRange] and look at the result.

Expected: A DOMRange with the table cell we clicked on as the start/end containers.

Instead: The table cell is only the start container, and the end container is the next table cell over.
---

Description --
***
When there is a table with empty table cells and you right-click inside of an empty table cell, [WebView selectedDOMRange] returns a DOMRange that has the table cell as the start container, but the end container is the next table cell. If the table cell you right-click on is the last cell in the table row, then the end container is the first table cell on the next table row.

This means that there is no way to distinguish between:
1. Right clicking on a single table cell (in which case the entire cell is selected automatically)
2. Selecting a table cell plus the cell next to it, then right clicking.
***
Currently, selecting two adjacent cells gives a DOMRange that is identical to the selection that results from right-clicking on the first of the two cells.
Comment 1 Enrica Casucci 2009-12-16 11:44:44 PST
Created attachment 44999 [details]
Patch
Comment 2 WebKit Review Bot 2009-12-16 11:46:38 PST
style-queue ran check-webkit-style on attachment 44999 [details] without any errors.
Comment 3 Eric Seidel (no email) 2009-12-16 13:08:24 PST
Comment on attachment 44999 [details]
Patch

It seems this should probably be a dumpAsText() test given that all we care about is verifying that the final selection is correct.

Otherwise this looks fine.
Comment 4 Enrica Casucci 2009-12-16 13:57:24 PST
(In reply to comment #3)
> (From update of attachment 44999 [details])
> It seems this should probably be a dumpAsText() test given that all we care
> about is verifying that the final selection is correct.
> 
> Otherwise this looks fine.

I tried the dumpAsText, but the output is empty. I'll stick to dumpEditingCallbacks. Thanks!
Comment 5 Enrica Casucci 2009-12-16 14:03:30 PST
Committed revision 52220.