| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 return true; | 768 return true; |
| 769 | 769 |
| 770 return node && node->hasEditableStyle(); | 770 return node && node->hasEditableStyle(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 bool LayoutBox::usesCompositedScrolling() const | 773 bool LayoutBox::usesCompositedScrolling() const |
| 774 { | 774 { |
| 775 return hasOverflowClip() && hasLayer() && layer()->scrollableArea()->usesCom
positedScrolling(); | 775 return hasOverflowClip() && hasLayer() && layer()->scrollableArea()->usesCom
positedScrolling(); |
| 776 } | 776 } |
| 777 | 777 |
| 778 void LayoutBox::autoscroll(const IntPoint& position) | 778 void LayoutBox::autoscroll(const IntPoint& positionInRootFrame) |
| 779 { | 779 { |
| 780 LocalFrame* frame = this->frame(); | 780 LocalFrame* frame = this->frame(); |
| 781 if (!frame) | 781 if (!frame) |
| 782 return; | 782 return; |
| 783 | 783 |
| 784 FrameView* frameView = frame->view(); | 784 FrameView* frameView = frame->view(); |
| 785 if (!frameView) | 785 if (!frameView) |
| 786 return; | 786 return; |
| 787 | 787 |
| 788 IntPoint currentDocumentPosition = frameView->windowToContents(position); | 788 IntPoint positionInContent = frameView->rootFrameToContents(positionInRootFr
ame); |
| 789 scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), S
crollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); | 789 scrollRectToVisible(LayoutRect(positionInContent, LayoutSize(1, 1)), ScrollA
lignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); |
| 790 } | 790 } |
| 791 | 791 |
| 792 // There are two kinds of renderer that can autoscroll. | 792 // There are two kinds of renderer that can autoscroll. |
| 793 bool LayoutBox::canAutoscroll() const | 793 bool LayoutBox::canAutoscroll() const |
| 794 { | 794 { |
| 795 if (node() && node()->isDocumentNode()) | 795 if (node() && node()->isDocumentNode()) |
| 796 return view()->frameView()->isScrollable(); | 796 return view()->frameView()->isScrollable(); |
| 797 | 797 |
| 798 // Check for a box that can be scrolled in its own right. | 798 // Check for a box that can be scrolled in its own right. |
| 799 return canBeScrolledAndHasScrollableArea(); | 799 return canBeScrolledAndHasScrollableArea(); |
| 800 } | 800 } |
| 801 | 801 |
| 802 // If specified point is in border belt, returned offset denotes direction of | 802 // If specified point is in border belt, returned offset denotes direction of |
| 803 // scrolling. | 803 // scrolling. |
| 804 IntSize LayoutBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con
st | 804 IntSize LayoutBox::calculateAutoscrollDirection(const IntPoint& pointInRootFrame
) const |
| 805 { | 805 { |
| 806 if (!frame()) | 806 if (!frame()) |
| 807 return IntSize(); | 807 return IntSize(); |
| 808 | 808 |
| 809 FrameView* frameView = frame()->view(); | 809 FrameView* frameView = frame()->view(); |
| 810 if (!frameView) | 810 if (!frameView) |
| 811 return IntSize(); | 811 return IntSize(); |
| 812 | 812 |
| 813 IntRect box(absoluteBoundingBoxRect()); | 813 IntRect box(absoluteBoundingBoxRect()); |
| 814 box.move(view()->frameView()->scrollOffset()); | 814 box.move(view()->frameView()->scrollOffset()); |
| 815 IntRect windowBox = view()->frameView()->contentsToWindow(box); | 815 IntRect windowBox = view()->frameView()->contentsToRootFrame(box); |
| 816 | 816 |
| 817 IntPoint windowAutoscrollPoint = windowPoint; | 817 IntPoint windowAutoscrollPoint = pointInRootFrame; |
| 818 | 818 |
| 819 if (windowAutoscrollPoint.x() < windowBox.x() + autoscrollBeltSize) | 819 if (windowAutoscrollPoint.x() < windowBox.x() + autoscrollBeltSize) |
| 820 windowAutoscrollPoint.move(-autoscrollBeltSize, 0); | 820 windowAutoscrollPoint.move(-autoscrollBeltSize, 0); |
| 821 else if (windowAutoscrollPoint.x() > windowBox.maxX() - autoscrollBeltSize) | 821 else if (windowAutoscrollPoint.x() > windowBox.maxX() - autoscrollBeltSize) |
| 822 windowAutoscrollPoint.move(autoscrollBeltSize, 0); | 822 windowAutoscrollPoint.move(autoscrollBeltSize, 0); |
| 823 | 823 |
| 824 if (windowAutoscrollPoint.y() < windowBox.y() + autoscrollBeltSize) | 824 if (windowAutoscrollPoint.y() < windowBox.y() + autoscrollBeltSize) |
| 825 windowAutoscrollPoint.move(0, -autoscrollBeltSize); | 825 windowAutoscrollPoint.move(0, -autoscrollBeltSize); |
| 826 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) | 826 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) |
| 827 windowAutoscrollPoint.move(0, autoscrollBeltSize); | 827 windowAutoscrollPoint.move(0, autoscrollBeltSize); |
| 828 | 828 |
| 829 return windowAutoscrollPoint - windowPoint; | 829 return windowAutoscrollPoint - pointInRootFrame; |
| 830 } | 830 } |
| 831 | 831 |
| 832 LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* renderer) | 832 LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* renderer) |
| 833 { | 833 { |
| 834 while (renderer && !(renderer->isBox() && toLayoutBox(renderer)->canAutoscro
ll())) { | 834 while (renderer && !(renderer->isBox() && toLayoutBox(renderer)->canAutoscro
ll())) { |
| 835 if (!renderer->parent() && renderer->node() == renderer->document() && r
enderer->document().ownerElement()) | 835 if (!renderer->parent() && renderer->node() == renderer->document() && r
enderer->document().ownerElement()) |
| 836 renderer = renderer->document().ownerElement()->layoutObject(); | 836 renderer = renderer->document().ownerElement()->layoutObject(); |
| 837 else | 837 else |
| 838 renderer = renderer->parent(); | 838 renderer = renderer->parent(); |
| 839 } | 839 } |
| (...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4645 computedValues.m_margins.m_end = marginEnd(); | 4645 computedValues.m_margins.m_end = marginEnd(); |
| 4646 | 4646 |
| 4647 setLogicalTop(oldLogicalTop); | 4647 setLogicalTop(oldLogicalTop); |
| 4648 setLogicalWidth(oldLogicalWidth); | 4648 setLogicalWidth(oldLogicalWidth); |
| 4649 setLogicalLeft(oldLogicalLeft); | 4649 setLogicalLeft(oldLogicalLeft); |
| 4650 setMarginLeft(oldMarginLeft); | 4650 setMarginLeft(oldMarginLeft); |
| 4651 setMarginRight(oldMarginRight); | 4651 setMarginRight(oldMarginRight); |
| 4652 } | 4652 } |
| 4653 | 4653 |
| 4654 } // namespace blink | 4654 } // namespace blink |
| OLD | NEW |