OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 // scrolling. | 762 // scrolling. |
763 IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con
st | 763 IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con
st |
764 { | 764 { |
765 if (!frame()) | 765 if (!frame()) |
766 return IntSize(); | 766 return IntSize(); |
767 | 767 |
768 FrameView* frameView = frame()->view(); | 768 FrameView* frameView = frame()->view(); |
769 if (!frameView) | 769 if (!frameView) |
770 return IntSize(); | 770 return IntSize(); |
771 | 771 |
772 IntSize offset; | |
773 IntPoint point = frameView->windowToContents(windowPoint); | |
774 IntRect box(absoluteBoundingBoxRect()); | 772 IntRect box(absoluteBoundingBoxRect()); |
775 if (isRenderView()) | 773 box.move(view()->frameView()->scrollOffset()); |
776 box.moveBy(frameView->windowToContents(IntPoint())); | 774 IntRect windowBox = view()->frameView()->contentsToWindow(box); |
777 | 775 |
778 if (point.x() < box.x() + autoscrollBeltSize) | 776 IntPoint windowAutoscrollPoint = windowPoint; |
779 point.move(-autoscrollBeltSize, 0); | |
780 else if (point.x() > box.maxX() - autoscrollBeltSize) | |
781 point.move(autoscrollBeltSize, 0); | |
782 | 777 |
783 if (point.y() < box.y() + autoscrollBeltSize) | 778 if (windowAutoscrollPoint.x() < windowBox.x() + autoscrollBeltSize) |
784 point.move(0, -autoscrollBeltSize); | 779 windowAutoscrollPoint.move(-autoscrollBeltSize, 0); |
785 else if (point.y() > box.maxY() - autoscrollBeltSize) | 780 else if (windowAutoscrollPoint.x() > windowBox.maxX() - autoscrollBeltSize) |
786 point.move(0, autoscrollBeltSize); | 781 windowAutoscrollPoint.move(autoscrollBeltSize, 0); |
787 return frameView->contentsToWindow(point) - windowPoint; | 782 |
| 783 if (windowAutoscrollPoint.y() < windowBox.y() + autoscrollBeltSize) |
| 784 windowAutoscrollPoint.move(0, -autoscrollBeltSize); |
| 785 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) |
| 786 windowAutoscrollPoint.move(0, autoscrollBeltSize); |
| 787 |
| 788 return windowAutoscrollPoint - windowPoint; |
788 } | 789 } |
789 | 790 |
790 RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer) | 791 RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer) |
791 { | 792 { |
792 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscro
ll())) { | 793 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscro
ll())) { |
793 if (!renderer->parent() && renderer->node() == &renderer->document() &&
renderer->document().ownerElement()) | 794 if (!renderer->parent() && renderer->node() == &renderer->document() &&
renderer->document().ownerElement()) |
794 renderer = renderer->document().ownerElement()->renderer(); | 795 renderer = renderer->document().ownerElement()->renderer(); |
795 else | 796 else |
796 renderer = renderer->parent(); | 797 renderer = renderer->parent(); |
797 } | 798 } |
(...skipping 3912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4710 return 0; | 4711 return 0; |
4711 | 4712 |
4712 if (!layoutState && !flowThreadContainingBlock()) | 4713 if (!layoutState && !flowThreadContainingBlock()) |
4713 return 0; | 4714 return 0; |
4714 | 4715 |
4715 RenderBlock* containerBlock = containingBlock(); | 4716 RenderBlock* containerBlock = containingBlock(); |
4716 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4717 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4717 } | 4718 } |
4718 | 4719 |
4719 } // namespace WebCore | 4720 } // namespace WebCore |
OLD | NEW |