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