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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 , m_horizontalScrollbarLock(false) | 146 , m_horizontalScrollbarLock(false) |
147 , m_verticalScrollbarLock(false) | 147 , m_verticalScrollbarLock(false) |
148 , m_scrollbarsAvoidingResizer(0) | 148 , m_scrollbarsAvoidingResizer(0) |
149 , m_scrollbarsSuppressed(false) | 149 , m_scrollbarsSuppressed(false) |
150 , m_inUpdateScrollbars(false) | 150 , m_inUpdateScrollbars(false) |
151 , m_frameTimingRequestsDirty(true) | 151 , m_frameTimingRequestsDirty(true) |
152 , m_viewportIntersectionValid(false) | 152 , m_viewportIntersectionValid(false) |
153 , m_hiddenForThrottling(false) | 153 , m_hiddenForThrottling(false) |
154 , m_crossOriginForThrottling(false) | 154 , m_crossOriginForThrottling(false) |
155 , m_isUpdatingAllLifecyclePhases(false) | 155 , m_isUpdatingAllLifecyclePhases(false) |
| 156 , m_scrollAnchor(this) |
156 { | 157 { |
157 ASSERT(m_frame); | 158 ASSERT(m_frame); |
158 init(); | 159 init(); |
159 } | 160 } |
160 | 161 |
161 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) | 162 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) |
162 { | 163 { |
163 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); | 164 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); |
164 view->show(); | 165 view->show(); |
165 return view.release(); | 166 return view.release(); |
(...skipping 24 matching lines...) Expand all Loading... |
190 #if ENABLE(OILPAN) | 191 #if ENABLE(OILPAN) |
191 visitor->trace(m_frame); | 192 visitor->trace(m_frame); |
192 visitor->trace(m_fragmentAnchor); | 193 visitor->trace(m_fragmentAnchor); |
193 visitor->trace(m_scrollableAreas); | 194 visitor->trace(m_scrollableAreas); |
194 visitor->trace(m_animatingScrollableAreas); | 195 visitor->trace(m_animatingScrollableAreas); |
195 visitor->trace(m_autoSizeInfo); | 196 visitor->trace(m_autoSizeInfo); |
196 visitor->trace(m_horizontalScrollbar); | 197 visitor->trace(m_horizontalScrollbar); |
197 visitor->trace(m_verticalScrollbar); | 198 visitor->trace(m_verticalScrollbar); |
198 visitor->trace(m_children); | 199 visitor->trace(m_children); |
199 visitor->trace(m_viewportScrollableArea); | 200 visitor->trace(m_viewportScrollableArea); |
| 201 visitor->trace(m_scrollAnchor); |
200 #endif | 202 #endif |
201 Widget::trace(visitor); | 203 Widget::trace(visitor); |
202 ScrollableArea::trace(visitor); | 204 ScrollableArea::trace(visitor); |
203 } | 205 } |
204 | 206 |
205 void FrameView::reset() | 207 void FrameView::reset() |
206 { | 208 { |
207 m_hasPendingLayout = false; | 209 m_hasPendingLayout = false; |
208 m_doFullPaintInvalidation = false; | 210 m_doFullPaintInvalidation = false; |
209 m_layoutSchedulingEnabled = true; | 211 m_layoutSchedulingEnabled = true; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 265 } |
264 | 266 |
265 void FrameView::dispose() | 267 void FrameView::dispose() |
266 { | 268 { |
267 RELEASE_ASSERT(!isInPerformLayout()); | 269 RELEASE_ASSERT(!isInPerformLayout()); |
268 | 270 |
269 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | 271 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) |
270 scrollAnimator->cancelAnimation(); | 272 scrollAnimator->cancelAnimation(); |
271 cancelProgrammaticScrollAnimation(); | 273 cancelProgrammaticScrollAnimation(); |
272 | 274 |
| 275 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) |
| 276 m_scrollAnchor.clear(); |
| 277 |
273 detachScrollbars(); | 278 detachScrollbars(); |
274 | 279 |
275 // When the view is no longer associated with a frame, it needs to be remove
d from the ax object cache | 280 // When the view is no longer associated with a frame, it needs to be remove
d from the ax object cache |
276 // right now, otherwise it won't be able to reach the topDocument()'s axObje
ct cache later. | 281 // right now, otherwise it won't be able to reach the topDocument()'s axObje
ct cache later. |
277 removeFromAXObjectCache(); | 282 removeFromAXObjectCache(); |
278 | 283 |
279 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 284 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
280 scrollingCoordinator->willDestroyScrollableArea(this); | 285 scrollingCoordinator->willDestroyScrollableArea(this); |
281 | 286 |
282 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing | 287 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 793 |
789 document->updateLayoutTreeIfNeeded(); | 794 document->updateLayoutTreeIfNeeded(); |
790 lifecycle().advanceTo(DocumentLifecycle::StyleClean); | 795 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
791 | 796 |
792 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { | 797 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { |
793 ScrollableArea& visualViewport = m_frame->host()->visualViewport(); | 798 ScrollableArea& visualViewport = m_frame->host()->visualViewport(); |
794 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); | 799 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); |
795 ASSERT(layoutViewport); | 800 ASSERT(layoutViewport); |
796 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la
youtViewport); | 801 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la
youtViewport); |
797 } | 802 } |
| 803 |
| 804 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) |
| 805 m_scrollAnchor.save(); |
798 } | 806 } |
799 | 807 |
800 static inline void layoutFromRootObject(LayoutObject& root) | 808 static inline void layoutFromRootObject(LayoutObject& root) |
801 { | 809 { |
802 LayoutState layoutState(root); | 810 LayoutState layoutState(root); |
803 root.layout(); | 811 root.layout(); |
804 } | 812 } |
805 | 813 |
806 void FrameView::prepareLayoutAnalyzer() | 814 void FrameView::prepareLayoutAnalyzer() |
807 { | 815 { |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr
ollType, ScrollBehavior scrollBehavior) | 1535 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr
ollType, ScrollBehavior scrollBehavior) |
1528 { | 1536 { |
1529 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); | 1537 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); |
1530 if (newScrollPosition == scrollPositionDouble()) | 1538 if (newScrollPosition == scrollPositionDouble()) |
1531 return; | 1539 return; |
1532 | 1540 |
1533 if (scrollBehavior == ScrollBehaviorAuto) | 1541 if (scrollBehavior == ScrollBehaviorAuto) |
1534 scrollBehavior = scrollBehaviorStyle(); | 1542 scrollBehavior = scrollBehaviorStyle(); |
1535 | 1543 |
1536 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav
ior); | 1544 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav
ior); |
| 1545 |
| 1546 if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && scrollType != Anchor
ingScroll) |
| 1547 m_scrollAnchor.clear(); |
1537 } | 1548 } |
1538 | 1549 |
1539 void FrameView::didUpdateElasticOverscroll() | 1550 void FrameView::didUpdateElasticOverscroll() |
1540 { | 1551 { |
1541 Page* page = frame().page(); | 1552 Page* page = frame().page(); |
1542 if (!page) | 1553 if (!page) |
1543 return; | 1554 return; |
1544 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); | 1555 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); |
1545 if (m_horizontalScrollbar) { | 1556 if (m_horizontalScrollbar) { |
1546 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); | 1557 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 // Plugins could have torn down the page inside updateWidgetGeometries(). | 2049 // Plugins could have torn down the page inside updateWidgetGeometries(). |
2039 if (!layoutView()) | 2050 if (!layoutView()) |
2040 return; | 2051 return; |
2041 | 2052 |
2042 scheduleUpdateWidgetsIfNecessary(); | 2053 scheduleUpdateWidgetsIfNecessary(); |
2043 | 2054 |
2044 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 2055 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
2045 scrollingCoordinator->notifyGeometryChanged(); | 2056 scrollingCoordinator->notifyGeometryChanged(); |
2046 | 2057 |
2047 scrollToFragmentAnchor(); | 2058 scrollToFragmentAnchor(); |
| 2059 // TODO(skobes): Figure out interactions between scroll anchor, fragment anc
hor, and history restoration. |
| 2060 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) |
| 2061 m_scrollAnchor.restore(); |
2048 | 2062 |
2049 sendResizeEventIfNeeded(); | 2063 sendResizeEventIfNeeded(); |
2050 } | 2064 } |
2051 | 2065 |
2052 bool FrameView::wasViewportResized() | 2066 bool FrameView::wasViewportResized() |
2053 { | 2067 { |
2054 ASSERT(m_frame); | 2068 ASSERT(m_frame); |
2055 LayoutView* layoutView = this->layoutView(); | 2069 LayoutView* layoutView = this->layoutView(); |
2056 if (!layoutView) | 2070 if (!layoutView) |
2057 return false; | 2071 return false; |
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4086 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4100 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4087 } | 4101 } |
4088 | 4102 |
4089 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4103 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4090 { | 4104 { |
4091 ASSERT(layoutView()); | 4105 ASSERT(layoutView()); |
4092 return *layoutView(); | 4106 return *layoutView(); |
4093 } | 4107 } |
4094 | 4108 |
4095 } // namespace blink | 4109 } // namespace blink |
OLD | NEW |