OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 , m_scrollbarsSuppressed(false) | 138 , m_scrollbarsSuppressed(false) |
139 , m_inUpdateScrollbars(false) | 139 , m_inUpdateScrollbars(false) |
140 , m_shouldDrawPanScrollIcon(false) | 140 , m_shouldDrawPanScrollIcon(false) |
141 , m_clipsRepaints(true) | 141 , m_clipsRepaints(true) |
142 { | 142 { |
143 ASSERT(m_frame); | 143 ASSERT(m_frame); |
144 init(); | 144 init(); |
145 | 145 |
146 if (!m_frame->isMainFrame()) | 146 if (!m_frame->isMainFrame()) |
147 return; | 147 return; |
148 | |
149 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); | |
150 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); | |
151 } | 148 } |
152 | 149 |
153 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) | 150 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) |
154 { | 151 { |
155 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); | 152 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); |
156 view->show(); | 153 view->show(); |
157 return view.release(); | 154 return view.release(); |
158 } | 155 } |
159 | 156 |
160 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int
Size& initialSize) | 157 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int
Size& initialSize) |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 m_viewportConstrainedObjects->remove(object); | 1294 m_viewportConstrainedObjects->remove(object); |
1298 | 1295 |
1299 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1296 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1300 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1297 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1301 } | 1298 } |
1302 } | 1299 } |
1303 | 1300 |
1304 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const | 1301 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const |
1305 { | 1302 { |
1306 LayoutRect viewportRect = LayoutRect(visibleContentRect()); | 1303 LayoutRect viewportRect = LayoutRect(visibleContentRect()); |
1307 // Ignore overhang. No-op when not using rubber banding. | |
1308 viewportRect.setLocation(clampScrollPosition(scrollPosition())); | 1304 viewportRect.setLocation(clampScrollPosition(scrollPosition())); |
1309 return viewportRect; | 1305 return viewportRect; |
1310 } | 1306 } |
1311 | 1307 |
1312 void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged,
bool heightChanged) | 1308 void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged,
bool heightChanged) |
1313 { | 1309 { |
1314 if (!hasViewportConstrainedObjects()) | 1310 if (!hasViewportConstrainedObjects()) |
1315 return; | 1311 return; |
1316 | 1312 |
1317 // If viewport is not enabled, frameRect change will cause layout size chang
e and then layout. | 1313 // If viewport is not enabled, frameRect change will cause layout size chang
e and then layout. |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 CompositedSelectionBound start, end; | 1735 CompositedSelectionBound start, end; |
1740 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); | 1736 LocalFrame* frame = toLocalFrame(page->focusController().focusedOrMainFrame(
)); |
1741 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { | 1737 if (!frame || !computeCompositedSelectionBounds(*frame, start, end)) { |
1742 page->chrome().client().clearCompositedSelectionBounds(); | 1738 page->chrome().client().clearCompositedSelectionBounds(); |
1743 return; | 1739 return; |
1744 } | 1740 } |
1745 | 1741 |
1746 page->chrome().client().updateCompositedSelectionBounds(start, end); | 1742 page->chrome().client().updateCompositedSelectionBounds(start, end); |
1747 } | 1743 } |
1748 | 1744 |
1749 bool FrameView::isRubberBandInProgress() const | |
1750 { | |
1751 if (scrollbarsSuppressed()) | |
1752 return false; | |
1753 | |
1754 // If the main thread updates the scroll position for this FrameView, we sho
uld return | |
1755 // ScrollAnimator::isRubberBandInProgress(). | |
1756 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | |
1757 return scrollAnimator->isRubberBandInProgress(); | |
1758 | |
1759 return false; | |
1760 } | |
1761 | |
1762 bool FrameView::rubberBandingOnCompositorThread() const | |
1763 { | |
1764 return m_frame->settings()->rubberBandingOnCompositorThread(); | |
1765 } | |
1766 | |
1767 HostWindow* FrameView::hostWindow() const | 1745 HostWindow* FrameView::hostWindow() const |
1768 { | 1746 { |
1769 Page* page = frame().page(); | 1747 Page* page = frame().page(); |
1770 if (!page) | 1748 if (!page) |
1771 return nullptr; | 1749 return nullptr; |
1772 return &page->chrome(); | 1750 return &page->chrome(); |
1773 } | 1751 } |
1774 | 1752 |
1775 void FrameView::contentRectangleForPaintInvalidation(const IntRect& rectInConten
t) | 1753 void FrameView::contentRectangleForPaintInvalidation(const IntRect& rectInConten
t) |
1776 { | 1754 { |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 | 2966 |
2989 if (child->isFrameView()) | 2967 if (child->isFrameView()) |
2990 removeScrollableArea(toFrameView(child)); | 2968 removeScrollableArea(toFrameView(child)); |
2991 | 2969 |
2992 child->setParent(0); | 2970 child->setParent(0); |
2993 m_children.remove(child); | 2971 m_children.remove(child); |
2994 } | 2972 } |
2995 | 2973 |
2996 ScrollResult FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) | 2974 ScrollResult FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) |
2997 { | 2975 { |
2998 // Note that to allow for rubber-band over-scroll behavior, even non-scrolla
ble views | |
2999 // should handle wheel events. | |
3000 #if !USE(RUBBER_BANDING) | |
3001 if (!isScrollable()) | 2976 if (!isScrollable()) |
3002 return ScrollResult(false); | 2977 return ScrollResult(false); |
3003 #endif | |
3004 | 2978 |
3005 if (m_frame->settings()->rootLayerScrolls()) | 2979 if (m_frame->settings()->rootLayerScrolls()) |
3006 return ScrollResult(false); | 2980 return ScrollResult(false); |
3007 | 2981 |
3008 return ScrollableArea::handleWheelEvent(wheelEvent); | 2982 return ScrollableArea::handleWheelEvent(wheelEvent); |
3009 } | 2983 } |
3010 | 2984 |
3011 bool FrameView::isVerticalDocument() const | 2985 bool FrameView::isVerticalDocument() const |
3012 { | 2986 { |
3013 LayoutView* layoutView = this->layoutView(); | 2987 LayoutView* layoutView = this->layoutView(); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3574 if (newVisibleSize.height() > oldVisibleSize.height()) | 3548 if (newVisibleSize.height() > oldVisibleSize.height()) |
3575 invalidateRect(IntRect(0, oldVisibleSize.height(), newVisibleSize.width(
), newVisibleSize.height() - oldVisibleSize.height())); | 3549 invalidateRect(IntRect(0, oldVisibleSize.height(), newVisibleSize.width(
), newVisibleSize.height() - oldVisibleSize.height())); |
3576 | 3550 |
3577 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3551 setScrollOffsetFromUpdateScrollbars(desiredOffset); |
3578 } | 3552 } |
3579 | 3553 |
3580 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) | 3554 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) |
3581 { | 3555 { |
3582 DoublePoint adjustedScrollPosition = DoublePoint(offset); | 3556 DoublePoint adjustedScrollPosition = DoublePoint(offset); |
3583 | 3557 |
3584 if (!isRubberBandInProgress()) | 3558 adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosit
ion); |
3585 adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollP
osition); | |
3586 | 3559 |
3587 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { | 3560 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { |
3588 ScrollableArea::scrollToOffsetWithoutAnimation(toFloatPoint(adjustedScro
llPosition)); | 3561 ScrollableArea::scrollToOffsetWithoutAnimation(toFloatPoint(adjustedScro
llPosition)); |
3589 resetScrollOriginChanged(); | 3562 resetScrollOriginChanged(); |
3590 } | 3563 } |
3591 } | 3564 } |
3592 | 3565 |
3593 const int panIconSizeLength = 16; | 3566 const int panIconSizeLength = 16; |
3594 | 3567 |
3595 IntRect FrameView::rectToCopyOnScroll() const | 3568 IntRect FrameView::rectToCopyOnScroll() const |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 { | 4072 { |
4100 Settings* settings = frame().settings(); | 4073 Settings* settings = frame().settings(); |
4101 if (!settings || !settings->rootLayerScrolls()) | 4074 if (!settings || !settings->rootLayerScrolls()) |
4102 return this; | 4075 return this; |
4103 | 4076 |
4104 LayoutView* layoutView = this->layoutView(); | 4077 LayoutView* layoutView = this->layoutView(); |
4105 return layoutView ? layoutView->scrollableArea() : nullptr; | 4078 return layoutView ? layoutView->scrollableArea() : nullptr; |
4106 } | 4079 } |
4107 | 4080 |
4108 } // namespace blink | 4081 } // namespace blink |
OLD | NEW |