Changeset 156297 in webkit


Ignore:
Timestamp:
Sep 23, 2013 2:50:16 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

iframe and scrollbar with "overflow:auto" should support autoscroll with mousedrag
https://bugs.webkit.org/show_bug.cgi?id=40981

Patch by Antonio Gomes <a1.gomes@sisa.samsung.com> on 2013-09-23
Reviewed by Darin Adler.

Source/WebCore:

RenderBox::calculateAutoscrollDirection does not properly translate
inner frames' coordinates in order to determine its auto-scrollability.
By coincidence, if the inner frame box it placed near to page's 0, 0 position
(upper left corner), it might work.

Patch fixes it by changing ::calculateAutoscrollDirection algorithm to operate
with window coordinates, taking inner frames offset and scroll position into account.
The behavior of auto-scrollable non-frame overflow boxes, including divs, still works
as it is used to.

Test: fast/events/drag-and-drop-autoscroll-inner-frame.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::calculateAutoscrollDirection):

LayoutTests:

Test ensures that dragging an element close to the boundary of
scrollable Frames, scroll its content in that direction.

  • fast/events/drag-and-drop-autoscroll-inner-frame-expected.txt: Added.
  • fast/events/drag-and-drop-autoscroll-inner-frame.html: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r156293 r156297  
     12013-09-23  Antonio Gomes  <a1.gomes@sisa.samsung.com>
     2
     3        iframe and scrollbar with "overflow:auto" should support autoscroll with mousedrag
     4        https://bugs.webkit.org/show_bug.cgi?id=40981
     5
     6        Reviewed by Darin Adler.
     7
     8        Test ensures that dragging an element close to the boundary of
     9        scrollable Frames, scroll its content in that direction.
     10
     11        * fast/events/drag-and-drop-autoscroll-inner-frame-expected.txt: Added.
     12        * fast/events/drag-and-drop-autoscroll-inner-frame.html: Added.
     13
    1142013-09-23  Alexey Proskuryakov  <ap@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r156296 r156297  
     12013-09-23  Antonio Gomes  <a1.gomes@sisa.samsung.com>
     2
     3        iframe and scrollbar with "overflow:auto" should support autoscroll with mousedrag
     4        https://bugs.webkit.org/show_bug.cgi?id=40981
     5
     6        Reviewed by Darin Adler.
     7
     8        RenderBox::calculateAutoscrollDirection does not properly translate
     9        inner frames' coordinates in order to determine its auto-scrollability.
     10        By coincidence, if the inner frame box it placed near to page's 0, 0 position
     11        (upper left corner), it might work.
     12
     13        Patch fixes it by changing ::calculateAutoscrollDirection algorithm to operate
     14        with window coordinates, taking inner frames offset and scroll position into account.
     15        The behavior of auto-scrollable non-frame overflow boxes, including divs, still works
     16        as it is used to.
     17
     18        Test: fast/events/drag-and-drop-autoscroll-inner-frame.html
     19
     20        * rendering/RenderBox.cpp:
     21        (WebCore::RenderBox::calculateAutoscrollDirection):
     22
    1232013-09-23  Brady Eidson  <beidson@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r156285 r156297  
    843843IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) const
    844844{
    845     IntSize offset;
    846     IntPoint point = view().frameView().windowToContents(windowPoint);
    847845    IntRect box(absoluteBoundingBoxRect());
    848 
    849     if (point.x() < box.x() + autoscrollBeltSize)
    850         point.move(-autoscrollBeltSize, 0);
    851     else if (point.x() > box.maxX() - autoscrollBeltSize)
    852         point.move(autoscrollBeltSize, 0);
    853 
    854     if (point.y() < box.y() + autoscrollBeltSize)
    855         point.move(0, -autoscrollBeltSize);
    856     else if (point.y() > box.maxY() - autoscrollBeltSize)
    857         point.move(0, autoscrollBeltSize);
    858     return view().frameView().contentsToWindow(point) - windowPoint;
     846    box.move(view().frameView().scrollOffset());
     847    IntRect windowBox = view().frameView().contentsToWindow(box);
     848
     849    IntPoint windowAutoscrollPoint = windowPoint;
     850
     851    if (windowAutoscrollPoint.x() < windowBox.x() + autoscrollBeltSize)
     852        windowAutoscrollPoint.move(-autoscrollBeltSize, 0);
     853    else if (windowAutoscrollPoint.x() > windowBox.maxX() - autoscrollBeltSize)
     854        windowAutoscrollPoint.move(autoscrollBeltSize, 0);
     855
     856    if (windowAutoscrollPoint.y() < windowBox.y() + autoscrollBeltSize)
     857        windowAutoscrollPoint.move(0, -autoscrollBeltSize);
     858    else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize)
     859        windowAutoscrollPoint.move(0, autoscrollBeltSize);
     860
     861    return windowAutoscrollPoint - windowPoint;
    859862}
    860863
Note: See TracChangeset for help on using the changeset viewer.