Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 815363003: FrameView now notifies ScrollCoorinator of changes in its scrollable area set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review feedback Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 287 if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
288 scrollAnimator->cancelAnimations(); 288 scrollAnimator->cancelAnimations();
289 cancelProgrammaticScrollAnimation(); 289 cancelProgrammaticScrollAnimation();
290 290
291 detachCustomScrollbars(); 291 detachCustomScrollbars();
292 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache 292 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache
293 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later. 293 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later.
294 removeFromAXObjectCache(); 294 removeFromAXObjectCache();
295 295
296 if (m_frame->page()) { 296 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
297 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) 297 scrollingCoordinator->willDestroyScrollableArea(this);
298 scrollingCoordinator->willDestroyScrollableArea(this);
299 }
300 298
301 #if ENABLE(OILPAN) 299 #if ENABLE(OILPAN)
302 // FIXME: once/if dust settles, do this always (non-Oilpan)? 300 // FIXME: once/if dust settles, do this always (non-Oilpan)?
303 // 301 //
304 // FIXME: Oilpan: is this safe to dispose() if there are FrameView protectio ns on the stack? 302 // FIXME: Oilpan: is this safe to dispose() if there are FrameView protectio ns on the stack?
305 dispose(); 303 dispose();
306 #endif 304 #endif
307 } 305 }
308 306
309 void FrameView::detachCustomScrollbars() 307 void FrameView::detachCustomScrollbars()
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 Page* FrameView::page() const 441 Page* FrameView::page() const
444 { 442 {
445 return frame().page(); 443 return frame().page();
446 } 444 }
447 445
448 RenderView* FrameView::renderView() const 446 RenderView* FrameView::renderView() const
449 { 447 {
450 return frame().contentRenderer(); 448 return frame().contentRenderer();
451 } 449 }
452 450
451 ScrollingCoordinator* FrameView::scrollingCoordinator()
452 {
453 Page* p = page();
454 return p ? p->scrollingCoordinator() : 0;
455 }
456
453 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) 457 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars)
454 { 458 {
455 m_canHaveScrollbars = canHaveScrollbars; 459 m_canHaveScrollbars = canHaveScrollbars;
456 460
457 ScrollbarMode newHorizontalMode; 461 ScrollbarMode newHorizontalMode;
458 ScrollbarMode newVerticalMode; 462 ScrollbarMode newVerticalMode;
459 463
460 scrollbarModes(newHorizontalMode, newVerticalMode); 464 scrollbarModes(newHorizontalMode, newVerticalMode);
461 465
462 if (canHaveScrollbars && newVerticalMode == ScrollbarAlwaysOff) 466 if (canHaveScrollbars && newVerticalMode == ScrollbarAlwaysOff)
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 1217
1214 bool FrameView::contentsInCompositedLayer() const 1218 bool FrameView::contentsInCompositedLayer() const
1215 { 1219 {
1216 RenderView* renderView = this->renderView(); 1220 RenderView* renderView = this->renderView();
1217 return renderView && renderView->compositingState() == PaintsIntoOwnBacking; 1221 return renderView && renderView->compositingState() == PaintsIntoOwnBacking;
1218 } 1222 }
1219 1223
1220 void FrameView::addSlowRepaintObject() 1224 void FrameView::addSlowRepaintObject()
1221 { 1225 {
1222 if (!m_slowRepaintObjectCount++) { 1226 if (!m_slowRepaintObjectCount++) {
1223 if (Page* page = m_frame->page()) { 1227 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
1224 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator()) 1228 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
1225 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(th is);
1226 }
1227 } 1229 }
1228 } 1230 }
1229 1231
1230 void FrameView::removeSlowRepaintObject() 1232 void FrameView::removeSlowRepaintObject()
1231 { 1233 {
1232 ASSERT(m_slowRepaintObjectCount > 0); 1234 ASSERT(m_slowRepaintObjectCount > 0);
1233 m_slowRepaintObjectCount--; 1235 m_slowRepaintObjectCount--;
1234 if (!m_slowRepaintObjectCount) { 1236 if (!m_slowRepaintObjectCount) {
1235 if (Page* page = m_frame->page()) { 1237 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
1236 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator()) 1238 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
1237 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(th is);
1238 }
1239 } 1239 }
1240 } 1240 }
1241 1241
1242 void FrameView::addViewportConstrainedObject(RenderObject* object) 1242 void FrameView::addViewportConstrainedObject(RenderObject* object)
1243 { 1243 {
1244 if (!m_viewportConstrainedObjects) 1244 if (!m_viewportConstrainedObjects)
1245 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet ); 1245 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet );
1246 1246
1247 if (!m_viewportConstrainedObjects->contains(object)) { 1247 if (!m_viewportConstrainedObjects->contains(object)) {
1248 m_viewportConstrainedObjects->add(object); 1248 m_viewportConstrainedObjects->add(object);
1249 1249
1250 if (Page* page = m_frame->page()) { 1250 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
1251 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator()) 1251 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1252 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1253 }
1254 } 1252 }
1255 } 1253 }
1256 1254
1257 void FrameView::removeViewportConstrainedObject(RenderObject* object) 1255 void FrameView::removeViewportConstrainedObject(RenderObject* object)
1258 { 1256 {
1259 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o bject)) { 1257 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o bject)) {
1260 m_viewportConstrainedObjects->remove(object); 1258 m_viewportConstrainedObjects->remove(object);
1261 1259
1262 if (Page* page = m_frame->page()) { 1260 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
1263 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator()) 1261 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1264 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1265 }
1266 } 1262 }
1267 } 1263 }
1268 1264
1269 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const 1265 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
1270 { 1266 {
1271 LayoutRect viewportRect = visibleContentRect(); 1267 LayoutRect viewportRect = visibleContentRect();
1272 // Ignore overhang. No-op when not using rubber banding. 1268 // Ignore overhang. No-op when not using rubber banding.
1273 viewportRect.setLocation(clampScrollPosition(scrollPosition())); 1269 viewportRect.setLocation(clampScrollPosition(scrollPosition()));
1274 return viewportRect; 1270 return viewportRect;
1275 } 1271 }
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 FontFaceSet::didLayout(*m_frame->document()); 2087 FontFaceSet::didLayout(*m_frame->document());
2092 2088
2093 updateWidgetPositions(); 2089 updateWidgetPositions();
2094 2090
2095 // Plugins could have torn down the page inside updateWidgetPositions(). 2091 // Plugins could have torn down the page inside updateWidgetPositions().
2096 if (!renderView()) 2092 if (!renderView())
2097 return; 2093 return;
2098 2094
2099 scheduleUpdateWidgetsIfNecessary(); 2095 scheduleUpdateWidgetsIfNecessary();
2100 2096
2101 if (Page* page = m_frame->page()) { 2097 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
2102 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 2098 scrollingCoordinator->notifyLayoutUpdated();
2103 scrollingCoordinator->notifyLayoutUpdated();
2104 }
2105 2099
2106 scrollToAnchor(); 2100 scrollToAnchor();
2107 2101
2108 sendResizeEventIfNeeded(); 2102 sendResizeEventIfNeeded();
2109 } 2103 }
2110 2104
2111 bool FrameView::wasViewportResized() 2105 bool FrameView::wasViewportResized()
2112 { 2106 {
2113 ASSERT(m_frame); 2107 ASSERT(m_frame);
2114 RenderView* renderView = this->renderView(); 2108 RenderView* renderView = this->renderView();
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 2560
2567 RenderView* view = renderView(); 2561 RenderView* view = renderView();
2568 if (view) { 2562 if (view) {
2569 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); 2563 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get()));
2570 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 2564 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
2571 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); 2565 InspectorInstrumentation::willUpdateLayerTree(m_frame.get());
2572 2566
2573 view->compositor()->updateIfNeededRecursive(); 2567 view->compositor()->updateIfNeededRecursive();
2574 2568
2575 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) 2569 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
2576 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); 2570 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
2577 2571
2578 updateCompositedSelectionBoundsIfNeeded(); 2572 updateCompositedSelectionBoundsIfNeeded();
2579 2573
2580 InspectorInstrumentation::didUpdateLayerTree(m_frame.get()); 2574 InspectorInstrumentation::didUpdateLayerTree(m_frame.get());
2581 2575
2582 scrollContentsIfNeededRecursive(); 2576 scrollContentsIfNeededRecursive();
2583 2577
2584 invalidateTreeIfNeededRecursive(); 2578 invalidateTreeIfNeededRecursive();
2585 2579
2586 ASSERT(!view->hasPendingSelection()); 2580 ASSERT(!view->hasPendingSelection());
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 if (it != m_resizerAreas->end()) 2905 if (it != m_resizerAreas->end())
2912 m_resizerAreas->remove(it); 2906 m_resizerAreas->remove(it);
2913 } 2907 }
2914 2908
2915 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) 2909 void FrameView::addScrollableArea(ScrollableArea* scrollableArea)
2916 { 2910 {
2917 ASSERT(scrollableArea); 2911 ASSERT(scrollableArea);
2918 if (!m_scrollableAreas) 2912 if (!m_scrollableAreas)
2919 m_scrollableAreas = adoptPtr(new ScrollableAreaSet); 2913 m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
2920 m_scrollableAreas->add(scrollableArea); 2914 m_scrollableAreas->add(scrollableArea);
2915
2916 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
2917 scrollingCoordinator->scrollableAreasDidChange();
2921 } 2918 }
2922 2919
2923 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) 2920 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
2924 { 2921 {
2925 if (!m_scrollableAreas) 2922 if (!m_scrollableAreas)
2926 return; 2923 return;
2927 m_scrollableAreas->remove(scrollableArea); 2924 m_scrollableAreas->remove(scrollableArea);
2925
2926 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
2927 scrollingCoordinator->scrollableAreasDidChange();
2928 } 2928 }
2929 2929
2930 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) 2930 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea)
2931 { 2931 {
2932 ASSERT(scrollableArea); 2932 ASSERT(scrollableArea);
2933 if (!m_animatingScrollableAreas) 2933 if (!m_animatingScrollableAreas)
2934 m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet); 2934 m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet);
2935 m_animatingScrollableAreas->add(scrollableArea); 2935 m_animatingScrollableAreas->add(scrollableArea);
2936 } 2936 }
2937 2937
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
4009 return; 4009 return;
4010 4010
4011 ScrollableArea::setScrollOrigin(origin); 4011 ScrollableArea::setScrollOrigin(origin);
4012 4012
4013 // Update if the scroll origin changes, since our position will be different if the content size did not change. 4013 // Update if the scroll origin changes, since our position will be different if the content size did not change.
4014 if (updatePositionAtAll && updatePositionSynchronously) 4014 if (updatePositionAtAll && updatePositionSynchronously)
4015 updateScrollbars(scrollOffsetDouble()); 4015 updateScrollbars(scrollOffsetDouble());
4016 } 4016 }
4017 4017
4018 } // namespace blink 4018 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698