Summary: | Range.getClientRects() should not include rects for partially selected elements | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | JuanCar Gallego <jcgallego74> | ||||
Component: | DOM | Assignee: | Andy Estes <aestes> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | aestes, agustin.moreton+webkit, commit-queue, esprehn+autocc, futurama, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
JuanCar Gallego
2012-01-23 10:29:43 PST
Subscribe this. I'm afraid we're also suffering it with Chrome and Safari.- More information. It seems like two close problems: 1. Range.getClientRects return rects for the partially selected text nodes in the startContaniner and endContainer. Correct. But for the not border elements it returns both rects for the whole elements, and rects for any text "fragment" inside them. It's redundant and confusing, and I think uncompliant with http://www.w3.org/TR/cssom-view/#extensions-to-the-range-interface 2. Correcting my first description of the problem: When endContainer is partially selected, and endContainer doesn't match startContainer, Range.getClientRects returns rect for the topmost ancestor of the endContainer whose parent contains the whole range (the child of range.commonAncestorContainer containing or being endContainer). This is clearly an error, because part of that rect (remember endContainer is partially selected) is outside the range. (In reply to comment #3) > <rdar://problem/13387823> Hi, Andy. I'm not sure to understand why you changed the subject of the bug. IMHO not returning any rects for partially selected elements is worst than returning partial and total rects. With actual behaviour, at least I'm able to detect and discard wrong rects. Created attachment 199012 [details]
Patch
(In reply to comment #4) > (In reply to comment #3) > > <rdar://problem/13387823> > > Hi, Andy. > I'm not sure to understand why you changed the subject of the bug. > IMHO not returning any rects for partially selected elements is worst than returning partial and total rects. With actual behaviour, at least I'm able to detect and discard wrong rects. You will still get rects for the selected children of the partially selected element. (In reply to comment #6) > (In reply to comment #4) > > (In reply to comment #3) > > > <rdar://problem/13387823> > > > > Hi, Andy. > > I'm not sure to understand why you changed the subject of the bug. > > IMHO not returning any rects for partially selected elements is worst than returning partial and total rects. With actual behaviour, at least I'm able to detect and discard wrong rects. > > You will still get rects for the selected children of the partially selected element. If it includes portions of partially selected text elements, as it does now, that's fine. Thank you. Committed r148898: <http://trac.webkit.org/changeset/148898> |