Changeset 90800 in webkit


Ignore:
Timestamp:
Jul 11, 2011 6:10:32 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

positionForPoint is broken when a block is positioned relatively inside the parent
https://bugs.webkit.org/show_bug.cgi?id=64298

Reviewed by Simon Fraser.

Source/WebCore:

The bug was caused by positionForPointRespectingEditingBoundaries's not taking relativePositionOffset
into account when computing the point in child coordinates. Fixed the bug by adding the offset to
childLocation as needed.

Test: fast/block/positioning/hittest-on-relative-positioned-children.html

  • rendering/RenderBlock.cpp:

(WebCore::positionForPointRespectingEditingBoundaries): Fixed the bug; also replaced all instances of
IntPoint by LayoutPoint.

LayoutTests:

Added a test for hit testing on relatively positioned children.

  • fast/block/positioning/hittest-on-relative-positioned-children-expected.txt: Added.
  • fast/block/positioning/hittest-on-relative-positioned-children.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90798 r90800  
     12011-07-11  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        positionForPoint is broken when a block is positioned relatively inside the parent
     4        https://bugs.webkit.org/show_bug.cgi?id=64298
     5
     6        Reviewed by Simon Fraser.
     7
     8        Added a test for hit testing on relatively positioned children.
     9
     10        * fast/block/positioning/hittest-on-relative-positioned-children-expected.txt: Added.
     11        * fast/block/positioning/hittest-on-relative-positioned-children.html: Added.
     12
    1132011-07-11  Dan Bernstein  <mitz@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r90798 r90800  
     12011-07-11  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        positionForPoint is broken when a block is positioned relatively inside the parent
     4        https://bugs.webkit.org/show_bug.cgi?id=64298
     5
     6        Reviewed by Simon Fraser.
     7
     8        The bug was caused by positionForPointRespectingEditingBoundaries's not taking relativePositionOffset
     9        into account when computing the point in child coordinates. Fixed the bug by adding the offset to
     10        childLocation as needed.
     11
     12        Test: fast/block/positioning/hittest-on-relative-positioned-children.html
     13
     14        * rendering/RenderBlock.cpp:
     15        (WebCore::positionForPointRespectingEditingBoundaries): Fixed the bug; also replaced all instances of
     16        IntPoint by LayoutPoint.
     17
    1182011-07-11  Dan Bernstein  <mitz@apple.com>
    219
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r90773 r90800  
    41184118// all cases in which positionForPoint recurs could call this instead to
    41194119// prevent crossing editable boundaries. This would require many tests.
    4120 static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBlock* parent, RenderBox* child, const IntPoint& pointInParentCoordinates)
    4121 {
     4120static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBlock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates)
     4121{
     4122    LayoutPoint childLocation = child->location();
     4123    if (child->isRelPositioned())
     4124        childLocation += child->relativePositionOffset();
    41224125    // FIXME: This is wrong if the child's writing-mode is different from the parent's.
    4123     IntPoint pointInChildCoordinates(pointInParentCoordinates - child->location());
     4126    LayoutPoint pointInChildCoordinates(pointInParentCoordinates - childLocation);
    41244127
    41254128    // If this is an anonymous renderer, we just recur normally
     
    41394142
    41404143    // Otherwise return before or after the child, depending on if the click was to the logical left or logical right of the child
    4141     int childMiddle = parent->logicalWidthForChild(child) / 2;
    4142     int logicalLeft = parent->isHorizontalWritingMode() ? pointInChildCoordinates.x() : pointInChildCoordinates.y();
     4144    LayoutUnit childMiddle = parent->logicalWidthForChild(child) / 2;
     4145    LayoutUnit logicalLeft = parent->isHorizontalWritingMode() ? pointInChildCoordinates.x() : pointInChildCoordinates.y();
    41434146    if (logicalLeft < childMiddle)
    41444147        return ancestor->createVisiblePosition(childNode->nodeIndex(), DOWNSTREAM);
Note: See TracChangeset for help on using the changeset viewer.