Incorrect selection with absolutely positioned div
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Sep 2011 21:51:44 +0000 (21:51 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Sep 2011 21:51:44 +0000 (21:51 +0000)
commita0885fe3acae2a42482eba76738866eeea0e5aa8
tree6df1eee4ae0e8961fd3affd76ba10fa855bc2b84
parent3fd00dcadd6d6ce80d12a10f926ff1663106eca8
Incorrect selection with absolutely positioned div
https://bugs.webkit.org/show_bug.cgi?id=39503

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

The bug was caused by a false assumption in RenderBlock::positionForPoint. Because the last child box
can be positioned, floated, invisible, etc..., we can't always trust last child's logicalTop to tell us
whether a given point is inside or below the last child box.

Fixed the bug by using the last hit-test candidate instead.

Test: editing/selection/block-with-positioned-lastchild.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPoint):

LayoutTests:

Added a regression test for placing the caret inside a block with multiple logical lines
with an absolutely positioned last child. WebKit should place the caret on the left of the first line
(instead of after the last line) when the user clicks on the left of the first line.

* editing/selection/block-with-positioned-lastchild-expected.txt: Added.
* editing/selection/block-with-positioned-lastchild.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@95478 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/selection/block-with-positioned-lastchild-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/block-with-positioned-lastchild.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp