Changeset 140855 in webkit


Ignore:
Timestamp:
Jan 25, 2013, 11:54:27 AM (12 years ago)
Author:
leviw@chromium.org
Message:

Merge 140370

Event target rects on the top level document shouldn't be clipped.
https://bugs.webkit.org/show_bug.cgi?id=107339

Reviewed by James Robinson.

Source/WebCore:

clippedOverflowRectForRepaint clips the top-level RenderView to the viewport, which
is wrong for generating event target rects, as the result will not extend to the bounds
of the document on pages that scroll. Changing the top-level view to use documentRect
instead.

Tests updated to cover bug: platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html

platform/chromium/fast/events/touch/compositor-touch-hit-rects.html

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::accumulateRendererTouchEventTargetRects): Use converToRootView instead of
a loop around convertToContaining view. This is not a change in behavior.
(WebCore::accumulateDocumentEventTargetRects): Switch to use documentRect instead of
clippedOverflowRectForRepaint for the top-level Document, and use converToRootView
to put rects in the coordinates of the top-level document.

LayoutTests:

Updating existing tests to cover this issue.

  • platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt:
  • platform/chromium/fast/events/touch/compositor-touch-hit-rects.html:
  • platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt:
  • platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html:
  • platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html: Added.
  • platform/chromium/TestExpectations:

TBR=leviw@chromium.org

Location:
branches/chromium/1364
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/chromium/1364/LayoutTests/platform/chromium/TestExpectations

    r140771 r140855  
    39233923webkit.org/b/98275 media/event-queue-crash.html [ Skip ]
    39243924
     3925# Needs rebaselining on after webkit.org/b/107339
     3926webkit.org/b/107339 [ Mac Android Win ] platform/chromium/fast/events/touch/compositor-touch-hit-rects.html [ Pass Failure ]
     3927
    39253928# Requires rebaselining after https://bugs.webkit.org/show_bug.cgi?id=11645
    39263929webkit.org/b/11645 [ Mac Android ] fast/table/025.html [ Failure ]
  • branches/chromium/1364/LayoutTests/platform/chromium/fast/events/touch/compositor-touch-hit-rects.html

    r138739 r140855  
    2323#tests {
    2424        font: 10px Ahem;
     25}
     26body {
     27        height: 1000px;
    2528}
    2629</style>
     
    7780}
    7881
    79 function logRects(id) {
     82function testElementWithId(id)
     83{
    8084        element = document.getElementById(id);
    8185        element.addEventListener('touchstart', listener, false);
     86        logRects(id);
     87        element.removeEventListener('touchstart', listener, false);
     88}
     89
     90function logRects(testName) {
     91
    8292        rects = window.internals.touchEventTargetClientRects(document);
    8393        var sortedRects = new Array();
     
    8696        sortedRects.sort(sortRects);
    8797        for (var i = 0; i < rects.length; ++i)
    88                 log(id + "[" + i + "]: (" + sortedRects[i].left + ", " + sortedRects[i].top + ", " + sortedRects[i].width + ", " + sortedRects[i].height + ")");
    89         element.removeEventListener('touchstart', listener, false);
     98                log(testName + "[" + i + "]: (" + sortedRects[i].left + ", " + sortedRects[i].top + ", " + sortedRects[i].width + ", " + sortedRects[i].height + ")");
    9099}
    91100
     
    95104
    96105        window.testRunner.dumpAsText();
    97         logRects("normalFlow");
    98         logRects("absoluteChildContainer");
    99         logRects("relativeChildContainer");
    100         logRects("overhangingContainer");
    101         logRects("transformedChildContainer");
    102         logRects("continuation");
    103         logRects("inlineAbsoluteChildContainer");
     106        testElementWithId("normalFlow");
     107        testElementWithId("absoluteChildContainer");
     108        testElementWithId("relativeChildContainer");
     109        testElementWithId("overhangingContainer");
     110        testElementWithId("transformedChildContainer");
     111        testElementWithId("continuation");
     112        testElementWithId("inlineAbsoluteChildContainer");
     113
     114        document.addEventListener('touchstart', listener, false);
     115        logRects("document");
    104116
    105117        var testContainer = document.getElementById("tests");
  • branches/chromium/1364/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt

    r139462 r140855  
    11This test validates that touch hit tests rects are created in the coordinates of the outermost view, not their containing view. This test only works in DumpRenderTree.
    2 [0]: (60, 110, 50, 50)
    3 [1]: (420, 170, 50, 50)
     2[0]: (10, 50, 285, 135)
     3[1]: (60, 110, 50, 50)
     4[2]: (420, 170, 50, 50)
    45
  • branches/chromium/1364/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html

    r139462 r140855  
    2424<iframe id="iframe1" src="resources/frame-with-touch-handler.html"></iframe>
    2525<iframe id="iframe2"></iframe>
     26<iframe id="iframe3" src="resources/frame-with-document-touch-handler.html"></iframe>
    2627<script>
    2728
  • branches/chromium/1364/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r139984 r140855  
    189189            // Convert to the top-level view's coordinates.
    190190            ASSERT(renderer->document()->view());
    191             for (ScrollView* view = renderer->document()->view(); view && view->parent(); view = view->parent())
    192                 r = view->convertToContainingView(r);
     191            r = renderer->document()->view()->convertToRootView(r);
    193192
    194193            if (!parentRect.contains(r)) {
     
    217216        if (touchTarget == document) {
    218217            if (RenderView* view = document->renderView()) {
    219                 IntRect r = enclosingIntRect(view->clippedOverflowRectForRepaint(0));
    220                 if (!r.isEmpty())
     218                IntRect r;
     219                if (touchTarget == document->topDocument())
     220                    r = view->documentRect();
     221                else
     222                    r = enclosingIntRect(view->clippedOverflowRectForRepaint(0));
     223
     224                if (!r.isEmpty()) {
     225                    ASSERT(view->document()->view());
     226                    r = view->document()->view()->convertToRootView(r);
    221227                    rects.append(r);
     228                }
    222229            }
    223230            return;
Note: See TracChangeset for help on using the changeset viewer.