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 20 matching lines...) Expand all Loading... |
31 #include "HTMLNames.h" | 31 #include "HTMLNames.h" |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/editing/htmlediting.h" | 33 #include "core/editing/htmlediting.h" |
34 #include "core/html/HTMLElement.h" | 34 #include "core/html/HTMLElement.h" |
35 #include "core/html/HTMLFrameElementBase.h" | 35 #include "core/html/HTMLFrameElementBase.h" |
36 #include "core/html/HTMLFrameOwnerElement.h" | 36 #include "core/html/HTMLFrameOwnerElement.h" |
37 #include "core/html/HTMLHtmlElement.h" | 37 #include "core/html/HTMLHtmlElement.h" |
38 #include "core/html/HTMLTextAreaElement.h" | 38 #include "core/html/HTMLTextAreaElement.h" |
39 #include "core/frame/Frame.h" | 39 #include "core/frame/Frame.h" |
40 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
| 41 #include "core/page/AutoscrollController.h" |
41 #include "core/page/EventHandler.h" | 42 #include "core/page/EventHandler.h" |
42 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
43 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 44 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
44 #include "core/rendering/HitTestResult.h" | 45 #include "core/rendering/HitTestResult.h" |
45 #include "core/rendering/PaintInfo.h" | 46 #include "core/rendering/PaintInfo.h" |
46 #include "core/rendering/RenderBoxRegionInfo.h" | 47 #include "core/rendering/RenderBoxRegionInfo.h" |
47 #include "core/rendering/RenderFlexibleBox.h" | 48 #include "core/rendering/RenderFlexibleBox.h" |
48 #include "core/rendering/RenderFlowThread.h" | 49 #include "core/rendering/RenderFlowThread.h" |
49 #include "core/rendering/RenderGeometryMap.h" | 50 #include "core/rendering/RenderGeometryMap.h" |
50 #include "core/rendering/RenderGrid.h" | 51 #include "core/rendering/RenderGrid.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 514 |
514 // If scrollbars are forbidden, user initiated scrolls should obviously be i
gnored. | 515 // If scrollbars are forbidden, user initiated scrolls should obviously be i
gnored. |
515 if (frameView->wasScrolledByUser()) | 516 if (frameView->wasScrolledByUser()) |
516 return false; | 517 return false; |
517 | 518 |
518 // Forbid autoscrolls when scrollbars are off, but permits other programmati
c scrolls, | 519 // Forbid autoscrolls when scrollbars are off, but permits other programmati
c scrolls, |
519 // like navigation to an anchor. | 520 // like navigation to an anchor. |
520 Page* page = frameView->frame().page(); | 521 Page* page = frameView->frame().page(); |
521 if (!page) | 522 if (!page) |
522 return false; | 523 return false; |
523 return !page->autoscrollInProgress(); | 524 return !page->autoscrollController().autoscrollInProgress(); |
524 } | 525 } |
525 | 526 |
526 void RenderBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
t& alignX, const ScrollAlignment& alignY) | 527 void RenderBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
t& alignX, const ScrollAlignment& alignY) |
527 { | 528 { |
528 RenderBox* parentBox = 0; | 529 RenderBox* parentBox = 0; |
529 LayoutRect newRect = rect; | 530 LayoutRect newRect = rect; |
530 | 531 |
531 bool restrictedByLineClamp = false; | 532 bool restrictedByLineClamp = false; |
532 if (parent()) { | 533 if (parent()) { |
533 parentBox = parent()->enclosingBox(); | 534 parentBox = parent()->enclosingBox(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 571 } |
571 } | 572 } |
572 } else { | 573 } else { |
573 LayoutRect viewRect = frameView->visibleContentRect(); | 574 LayoutRect viewRect = frameView->visibleContentRect(); |
574 LayoutRect r = ScrollAlignment::getRectToExpose(viewRect, rect,
alignX, alignY); | 575 LayoutRect r = ScrollAlignment::getRectToExpose(viewRect, rect,
alignX, alignY); |
575 frameView->setScrollPosition(roundedIntPoint(r.location())); | 576 frameView->setScrollPosition(roundedIntPoint(r.location())); |
576 } | 577 } |
577 } | 578 } |
578 } | 579 } |
579 | 580 |
580 if (frame()->page()->autoscrollInProgress()) | 581 if (frame()->page()->autoscrollController().autoscrollInProgress()) |
581 parentBox = enclosingScrollableBox(); | 582 parentBox = enclosingScrollableBox(); |
582 | 583 |
583 if (parentBox) | 584 if (parentBox) |
584 parentBox->scrollRectToVisible(newRect, alignX, alignY); | 585 parentBox->scrollRectToVisible(newRect, alignX, alignY); |
585 } | 586 } |
586 | 587 |
587 void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumul
atedOffset) const | 588 void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumul
atedOffset) const |
588 { | 589 { |
589 rects.append(pixelSnappedIntRect(accumulatedOffset, size())); | 590 rects.append(pixelSnappedIntRect(accumulatedOffset, size())); |
590 } | 591 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 FrameView* frameView = frame->view(); | 863 FrameView* frameView = frame->view(); |
863 if (!frameView) | 864 if (!frameView) |
864 return; | 865 return; |
865 | 866 |
866 IntPoint currentDocumentPosition = frameView->windowToContents(position); | 867 IntPoint currentDocumentPosition = frameView->windowToContents(position); |
867 scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), S
crollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); | 868 scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), S
crollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); |
868 } | 869 } |
869 | 870 |
870 bool RenderBox::autoscrollInProgress() const | 871 bool RenderBox::autoscrollInProgress() const |
871 { | 872 { |
872 return frame() && frame()->page() && frame()->page()->autoscrollInProgress(t
his); | 873 return frame() && frame()->page() && frame()->page()->autoscrollController()
.autoscrollInProgress(this); |
873 } | 874 } |
874 | 875 |
875 // There are two kinds of renderer that can autoscroll. | 876 // There are two kinds of renderer that can autoscroll. |
876 bool RenderBox::canAutoscroll() const | 877 bool RenderBox::canAutoscroll() const |
877 { | 878 { |
878 if (node() && node()->isDocumentNode()) | 879 if (node() && node()->isDocumentNode()) |
879 return view()->frameView()->isScrollable(); | 880 return view()->frameView()->isScrollable(); |
880 | 881 |
881 // Check for a box that can be scrolled in its own right. | 882 // Check for a box that can be scrolled in its own right. |
882 return canBeScrolledAndHasScrollableArea(); | 883 return canBeScrolledAndHasScrollableArea(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 layer()->scrollableArea()->scrollToOffset(newScrollOffset, clamp); | 984 layer()->scrollableArea()->scrollToOffset(newScrollOffset, clamp); |
984 | 985 |
985 // If this layer can't do the scroll we ask the next layer up that can s
croll to try | 986 // If this layer can't do the scroll we ask the next layer up that can s
croll to try |
986 IntSize remainingScrollOffset = newScrollOffset - layer()->scrollableAre
a()->adjustedScrollOffset(); | 987 IntSize remainingScrollOffset = newScrollOffset - layer()->scrollableAre
a()->adjustedScrollOffset(); |
987 if (!remainingScrollOffset.isZero() && parent()) { | 988 if (!remainingScrollOffset.isZero() && parent()) { |
988 if (RenderBox* scrollableBox = enclosingScrollableBox()) | 989 if (RenderBox* scrollableBox = enclosingScrollableBox()) |
989 scrollableBox->scrollByRecursively(remainingScrollOffset, clamp)
; | 990 scrollableBox->scrollByRecursively(remainingScrollOffset, clamp)
; |
990 | 991 |
991 Frame* frame = this->frame(); | 992 Frame* frame = this->frame(); |
992 if (frame && frame->page()) | 993 if (frame && frame->page()) |
993 frame->page()->updateAutoscrollRenderer(); | 994 frame->page()->autoscrollController().updateAutoscrollRenderer()
; |
994 } | 995 } |
995 } else if (view()->frameView()) { | 996 } else if (view()->frameView()) { |
996 // If we are here, we were called on a renderer that can be programmatic
ally scrolled, but doesn't | 997 // If we are here, we were called on a renderer that can be programmatic
ally scrolled, but doesn't |
997 // have an overflow clip. Which means that it is a document node that ca
n be scrolled. | 998 // have an overflow clip. Which means that it is a document node that ca
n be scrolled. |
998 view()->frameView()->scrollBy(delta); | 999 view()->frameView()->scrollBy(delta); |
999 | 1000 |
1000 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? | 1001 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? |
1001 // https://bugs.webkit.org/show_bug.cgi?id=28237 | 1002 // https://bugs.webkit.org/show_bug.cgi?id=28237 |
1002 } | 1003 } |
1003 } | 1004 } |
(...skipping 3970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4974 return 0; | 4975 return 0; |
4975 | 4976 |
4976 if (!layoutState && !flowThreadContainingBlock()) | 4977 if (!layoutState && !flowThreadContainingBlock()) |
4977 return 0; | 4978 return 0; |
4978 | 4979 |
4979 RenderBlock* containerBlock = containingBlock(); | 4980 RenderBlock* containerBlock = containingBlock(); |
4980 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4981 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4981 } | 4982 } |
4982 | 4983 |
4983 } // namespace WebCore | 4984 } // namespace WebCore |
OLD | NEW |