Changeset 140202 in webkit


Ignore:
Timestamp:
Jan 18, 2013 1:44:25 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Fix scrollRectToVisible in the presence of transforms
https://bugs.webkit.org/show_bug.cgi?id=105574

Patch by Chris Hopman <cjhopman@google.com> on 2013-01-18
Reviewed by Simon Fraser.

Source/WebCore:

When scrolling to reveal an overflow layer, the required scroll was
being calculated in absolute coordinates. To properly account for
transforms, this calculation should be done in the local coordinates
of the renderBox.

Tests: editing/input/reveal-selection-transformed-overflow-parent.html

editing/input/reveal-selection-transformed-textarea.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollRectToVisible):
When scrolling to reveal an overflow layer, calculate the required
scroll in the local coordinates of the RenderBox.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::absoluteToLocalQuad):
(WebCore):

  • rendering/RenderObject.h:

(RenderObject):
Add function to convert an absolute quad to a local quad.

LayoutTests:

  • editing/input/reveal-caret-of-transformed-input-scrollable-parent.html: Added.
  • editing/input/reveal-caret-of-transformed-input-scrollable-parent-expected.txt: Added.

Test that when scrolling an overflow layer to reveal a rect, the rect
passed to the parent to scroll is calculated properly.

  • editing/input/reveal-caret-of-transformed-multiline-input.html: Added.
  • editing/input/reveal-caret-of-transformed-multiline-input-expected.txt: Added.

Test that scrolling to reveal a rect works properly on a transformed
overflow layer.

  • platform/chromium/TestExpectations:
  • platform/mac/TestExpectations:
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140198 r140202  
     12013-01-18  Chris Hopman  <cjhopman@google.com>
     2
     3        Fix scrollRectToVisible in the presence of transforms
     4        https://bugs.webkit.org/show_bug.cgi?id=105574
     5
     6        Reviewed by Simon Fraser.
     7
     8        * editing/input/reveal-caret-of-transformed-input-scrollable-parent.html: Added.
     9        * editing/input/reveal-caret-of-transformed-input-scrollable-parent-expected.txt: Added.
     10        Test that when scrolling an overflow layer to reveal a rect, the rect
     11        passed to the parent to scroll is calculated properly.
     12        * editing/input/reveal-caret-of-transformed-multiline-input.html: Added.
     13        * editing/input/reveal-caret-of-transformed-multiline-input-expected.txt: Added.
     14        Test that scrolling to reveal a rect works properly on a transformed
     15        overflow layer.
     16
     17        * platform/chromium/TestExpectations:
     18        * platform/mac/TestExpectations:
     19
    1202013-01-18  Julien Chaffraix  <jchaffraix@webkit.org>
    221
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r140196 r140202  
    43124312webkit.org/b/107033 [ Debug ] fast/css/stylesheet-enable-first-alternate-link.html [ Crash ]
    43134313
     4314# Needs rebaseline.
     4315webkit.org/b/105574 editing/input/caret-at-the-edge-of-contenteditable.html [ Failure ]
     4316webkit.org/b/105574 editing/input/reveal-caret-of-multiline-contenteditable.html [ Failure ]
     4317webkit.org/b/105574 editing/input/reveal-caret-of-multiline-input.html [ Failure ]
     4318webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
     4319webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
     4320webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
     4321
    43144322# This is won't fix, as the debug and release versions differ.
    43154323webkit.org/b/99138 [ Debug SnowLeopard ] svg/custom/foreign-object-skew.svg [ ImageOnlyFailure ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r140192 r140202  
    12811281webkit.org/b/103955 fast/repaint/caret-with-transformation.html [ Missing ]
    12821282
     1283# Needs rebaseline.
     1284webkit.org/b/105574 editing/input/caret-at-the-edge-of-contenteditable.html [ Failure ]
     1285webkit.org/b/105574 editing/input/reveal-caret-of-multiline-contenteditable.html [ Failure ]
     1286webkit.org/b/105574 editing/input/reveal-caret-of-multiline-input.html [ Failure ]
     1287webkit.org/b/105574 fast/spatial-navigation/snav-div-overflow-scrol-hidden.html [ Failure ]
     1288
    12831289# Rebaseline required after https://webkit.org/b/107208
    12841290webkit.org/b/107208 fast/regions/overflow-moving-below-floats-in-variable-width-regions.html [ Pass Failure ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r140198 r140202  
     12013-01-18  Chris Hopman  <cjhopman@google.com>
     2
     3        Fix scrollRectToVisible in the presence of transforms
     4        https://bugs.webkit.org/show_bug.cgi?id=105574
     5
     6        Reviewed by Simon Fraser.
     7
     8        When scrolling to reveal an overflow layer, the required scroll was
     9        being calculated in absolute coordinates. To properly account for
     10        transforms, this calculation should be done in the local coordinates
     11        of the renderBox.
     12
     13        Tests: editing/input/reveal-selection-transformed-overflow-parent.html
     14               editing/input/reveal-selection-transformed-textarea.html
     15
     16        * rendering/RenderLayer.cpp:
     17        (WebCore::RenderLayer::scrollRectToVisible):
     18        When scrolling to reveal an overflow layer, calculate the required
     19        scroll in the local coordinates of the RenderBox.
     20        * rendering/RenderObject.cpp:
     21        (WebCore::RenderObject::absoluteToLocalQuad):
     22        (WebCore):
     23        * rendering/RenderObject.h:
     24        (RenderObject):
     25        Add function to convert an absolute quad to a local quad.
     26
    1272013-01-18  Julien Chaffraix  <jchaffraix@webkit.org>
    228
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r140192 r140202  
    21432143        RenderBox* box = renderBox();
    21442144        ASSERT(box);
    2145         FloatPoint absPos = box->localToAbsolute();
    2146         absPos.move(box->borderLeft(), box->borderTop());
    2147 
    2148         LayoutRect layerBounds = LayoutRect(absPos.x() + scrollXOffset(), absPos.y() + scrollYOffset(), box->clientWidth(), box->clientHeight());
    2149         LayoutRect exposeRect = LayoutRect(rect.x() + scrollXOffset(), rect.y() + scrollYOffset(), rect.width(), rect.height());
    2150         LayoutRect r = getRectToExpose(layerBounds, exposeRect, alignX, alignY);
    2151        
    2152         int roundedAdjustedX = roundToInt(r.x() - absPos.x());
    2153         int roundedAdjustedY = roundToInt(r.y() - absPos.y());
    2154         IntSize clampedScrollOffset = clampScrollOffset(IntSize(roundedAdjustedX, roundedAdjustedY));
     2145        LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms).boundingBox());
     2146        LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight());
     2147        LayoutRect r = getRectToExpose(layerBounds, localExposeRect, alignX, alignY);
     2148
     2149        IntSize clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(r).location()));
    21552150        if (clampedScrollOffset != scrollOffset()) {
    21562151            IntSize oldScrollOffset = scrollOffset();
    21572152            scrollToOffset(clampedScrollOffset);
    21582153            IntSize scrollOffsetDifference = scrollOffset() - oldScrollOffset;
    2159             newRect.move(-scrollOffsetDifference);
     2154            localExposeRect.move(-scrollOffsetDifference);
     2155            newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox());
    21602156        }
    21612157    } else if (!parentLayer && renderer()->isBox() && renderBox()->canBeProgramaticallyScrolled()) {
     
    21842180                    if (frameView->safeToPropagateScrollToParent()) {
    21852181                        parentLayer = ownerElement->renderer()->enclosingLayer();
     2182                        // FIXME: This doesn't correctly convert the rect to
     2183                        // absolute coordinates in the parent.
    21862184                        newRect.setX(rect.x() - frameView->scrollX() + frameView->x());
    21872185                        newRect.setY(rect.y() - frameView->scrollY() + frameView->y());
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r140097 r140202  
    20512051}
    20522052
     2053FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, MapCoordinatesFlags mode) const
     2054{
     2055    TransformState transformState(TransformState::UnapplyInverseTransformDirection, quad.boundingBox().center(), quad);
     2056    mapAbsoluteToLocalPoint(mode, transformState);
     2057    transformState.flatten();
     2058    return transformState.lastPlanarQuad();
     2059}
     2060
    20532061void RenderObject::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const
    20542062{
  • trunk/Source/WebCore/rendering/RenderObject.h

    r140068 r140202  
    735735        return localToContainerQuad(quad, 0, mode, wasFixed);
    736736    }
     737    // Convert an absolute quad to local coordinates.
     738    FloatQuad absoluteToLocalQuad(const FloatQuad&, MapCoordinatesFlags mode = 0) const;
    737739
    738740    // Convert a local quad into the coordinate system of container, taking transforms into account.
Note: See TracChangeset for help on using the changeset viewer.