Bug 39503

Summary: incorrect selection with absolutely positioned div.
Product: WebKit Reporter: Ojan Vafai <ojan>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: cshu, darin, enrica, eric, hyatt, kenneth, mitz, rniwa, simon.fraser, tonikitoo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
test case
none
fixes the bug kenneth: review+

Description Ojan Vafai 2010-05-21 11:22:01 PDT
Created attachment 56732 [details]
test case

See the test case.
Comment 1 Ryosuke Niwa 2011-09-19 14:26:36 PDT
The problem is that RenderBlock::positionForPoint assumes that the lastChildBox is not positioned.

if (lastChildBox() && contentsY > lastChildBox()->y()) { 
    for (RenderBox* childBox = lastChildBox(); childBox; childBox = childBox->previousSiblingBox()) { 
        if (isChildHitTestCandidate(childBox)) 
            return positionForPointRespectingEditingBoundaries(this, childBox, pointInContents); 
    } 
} else { 

+mitz since this code was added in http://trac.webkit.org/changeset/42467.
Comment 2 Ryosuke Niwa 2011-09-19 14:36:18 PDT
Created attachment 107921 [details]
fixes the bug
Comment 3 Ryosuke Niwa 2011-09-19 14:39:28 PDT
Comment on attachment 107921 [details]
fixes the bug

Oops, something's wrong with my patch.
Comment 4 Kenneth Rohde Christiansen 2011-09-19 14:42:36 PDT
> LayoutTests/ChangeLog:9
> +        with a absolutely positioned last child. WebKit should place the caret on the left of the first line

I guess it is "an absolutely"
Comment 5 Ryosuke Niwa 2011-09-19 14:46:20 PDT
Comment on attachment 107921 [details]
fixes the bug

Nope. My patch is fine. I was commenting out some code to verify my test and had forgotten to rebuild before running the test.
Comment 6 Kenneth Rohde Christiansen 2011-09-19 14:47:17 PDT
Comment on attachment 107921 [details]
fixes the bug

Nice test and good catch, r=me
Comment 7 Ryosuke Niwa 2011-09-19 14:47:52 PDT
(In reply to comment #6)
> (From update of attachment 107921 [details])
> Nice test and good catch, r=me

Thanks for the review! WIll fix "a absolutely".
Comment 8 Ryosuke Niwa 2011-09-19 14:50:41 PDT
Committed r95478: <http://trac.webkit.org/changeset/95478>