Bug 39503 - incorrect selection with absolutely positioned div.
Summary: incorrect selection with absolutely positioned div.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-21 11:22 PDT by Ojan Vafai
Modified: 2011-09-19 14:50 PDT (History)
10 users (show)

See Also:


Attachments
test case (281 bytes, text/html)
2010-05-21 11:22 PDT, Ojan Vafai
no flags Details
fixes the bug (5.13 KB, patch)
2011-09-19 14:36 PDT, Ryosuke Niwa
kenneth: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>