Changeset 149168 in webkit


Ignore:
Timestamp:
Apr 25, 2013 11:23:53 PM (11 years ago)
Author:
mihnea@adobe.com
Message:

[CSS Regions] Hit testing is broken for absolutely positioned regions that have overflow: hidden
https://bugs.webkit.org/show_bug.cgi?id=113874

Reviewed by David Hyatt.

Source/WebCore:

Test: fast/regions/hit-test-abspos-overflow-region.html

When a region is an out-of-flow positioned object with an overflow clip, we need
to make sure that hit testing works also for cases other than foreground (content)
hit testing. This patch moves the previous hit testing code, that delegated foreground
hit testing to the region's flow thread hit testing, into the hitTestContent method,
now that RenderRegion is RenderBlock based.

  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::hitTestContents):

  • rendering/RenderRegion.h:

(RenderRegion):

LayoutTests:

Add test for hit-testing of border of an out-of-flow region with overflow: hidden.

  • fast/regions/hit-test-abspos-overflow-region-expected.txt: Added.
  • fast/regions/hit-test-abspos-overflow-region.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r149167 r149168  
     12013-04-25  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Hit testing is broken for absolutely positioned regions that have overflow: hidden
     4        https://bugs.webkit.org/show_bug.cgi?id=113874
     5
     6        Reviewed by David Hyatt.
     7
     8        Add test for hit-testing of border of an out-of-flow region with overflow: hidden.
     9
     10        * fast/regions/hit-test-abspos-overflow-region-expected.txt: Added.
     11        * fast/regions/hit-test-abspos-overflow-region.html: Added.
     12
    1132013-04-25  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r149167 r149168  
     12013-04-25  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Hit testing is broken for absolutely positioned regions that have overflow: hidden
     4        https://bugs.webkit.org/show_bug.cgi?id=113874
     5
     6        Reviewed by David Hyatt.
     7
     8        Test: fast/regions/hit-test-abspos-overflow-region.html
     9
     10        When a region is an out-of-flow positioned object with an overflow clip, we need
     11        to make sure that hit testing works also for cases other than foreground (content)
     12        hit testing. This patch moves the previous hit testing code, that delegated foreground
     13        hit testing to the region's flow thread hit testing, into the hitTestContent method,
     14        now that RenderRegion is RenderBlock based.
     15
     16        * rendering/RenderRegion.cpp:
     17        (WebCore::RenderRegion::hitTestContents):
     18        * rendering/RenderRegion.h:
     19        (RenderRegion):
     20
    1212013-04-25  Ryosuke Niwa  <rniwa@webkit.org>
    222
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r148943 r149168  
    172172
    173173// Hit Testing
    174 bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
    175 {
    176     if (!isValid())
     174bool RenderRegion::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
     175{
     176    if (!isValid() || action != HitTestForeground)
    177177        return false;
    178178
    179     LayoutPoint adjustedLocation = accumulatedOffset + location();
    180 
    181     // Check our bounds next. For this purpose always assume that we can only be hit in the
    182     // foreground phase (which is true for replaced elements like images).
    183     // FIXME: Once we support overflow, we need to intersect with that and not with the bounds rect.
    184179    LayoutRect boundsRect = borderBoxRectInRegion(locationInContainer.region());
    185     boundsRect.moveBy(adjustedLocation);
    186     if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
    187         // Check the contents of the RenderFlowThread.
    188         if (m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result, locationInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop())))
    189             return true;
    190         updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
    191         if (!result.addNodeToRectBasedTestResult(generatingNode(), request, locationInContainer, boundsRect))
     180    boundsRect.moveBy(accumulatedOffset);
     181    if (visibleToHitTesting() && locationInContainer.intersects(boundsRect)) {
     182        if (m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result,
     183            locationInContainer, LayoutPoint(accumulatedOffset.x() + borderLeft() + paddingLeft(), accumulatedOffset.y() + borderTop() + paddingTop())))
    192184            return true;
    193185    }
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r148943 r149168  
    4949    virtual bool isRenderRegion() const { return true; }
    5050
    51     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
     51    virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
    5252
    5353    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
Note: See TracChangeset for help on using the changeset viewer.