Chromium Code Reviews| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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()) |
|
Rick Byers
2015/01/07 17:20:16
The preferred style in blink is generally somethin
majidvp
2015/01/07 19:52:28
I will update to match the convention.
majidvp
2015/01/12 16:28:27
Done.
| |
| 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 Loading... | |
| 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() : nullptr; | |
| 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 Loading... | |
| 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()) |
| 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()) |
| 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()) |
| 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()) |
| 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2081 FontFaceSet::didLayout(*m_frame->document()); | 2077 FontFaceSet::didLayout(*m_frame->document()); |
| 2082 | 2078 |
| 2083 updateWidgetPositions(); | 2079 updateWidgetPositions(); |
| 2084 | 2080 |
| 2085 // Plugins could have torn down the page inside updateWidgetPositions(). | 2081 // Plugins could have torn down the page inside updateWidgetPositions(). |
| 2086 if (!renderView()) | 2082 if (!renderView()) |
| 2087 return; | 2083 return; |
| 2088 | 2084 |
| 2089 scheduleUpdateWidgetsIfNecessary(); | 2085 scheduleUpdateWidgetsIfNecessary(); |
| 2090 | 2086 |
| 2091 if (Page* page = m_frame->page()) { | 2087 if (scrollingCoordinator()) |
| 2092 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) | 2088 scrollingCoordinator()->notifyLayoutUpdated(); |
| 2093 scrollingCoordinator->notifyLayoutUpdated(); | |
| 2094 } | |
| 2095 | 2089 |
| 2096 scrollToAnchor(); | 2090 scrollToAnchor(); |
| 2097 | 2091 |
| 2098 sendResizeEventIfNeeded(); | 2092 sendResizeEventIfNeeded(); |
| 2099 } | 2093 } |
| 2100 | 2094 |
| 2101 bool FrameView::wasViewportResized() | 2095 bool FrameView::wasViewportResized() |
| 2102 { | 2096 { |
| 2103 ASSERT(m_frame); | 2097 ASSERT(m_frame); |
| 2104 RenderView* renderView = this->renderView(); | 2098 RenderView* renderView = this->renderView(); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2556 | 2550 |
| 2557 RenderView* view = renderView(); | 2551 RenderView* view = renderView(); |
| 2558 if (view) { | 2552 if (view) { |
| 2559 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); | 2553 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "data", InspectorUpdateLayerTreeEvent::data(m_frame.get())); |
| 2560 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. | 2554 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. |
| 2561 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); | 2555 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); |
| 2562 | 2556 |
| 2563 view->compositor()->updateIfNeededRecursive(); | 2557 view->compositor()->updateIfNeededRecursive(); |
| 2564 | 2558 |
| 2565 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2559 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
| 2566 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); | 2560 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| 2567 | 2561 |
| 2568 updateCompositedSelectionBoundsIfNeeded(); | 2562 updateCompositedSelectionBoundsIfNeeded(); |
| 2569 | 2563 |
| 2570 InspectorInstrumentation::didUpdateLayerTree(m_frame.get()); | 2564 InspectorInstrumentation::didUpdateLayerTree(m_frame.get()); |
| 2571 | 2565 |
| 2572 scrollContentsIfNeededRecursive(); | 2566 scrollContentsIfNeededRecursive(); |
| 2573 | 2567 |
| 2574 invalidateTreeIfNeededRecursive(); | 2568 invalidateTreeIfNeededRecursive(); |
| 2575 | 2569 |
| 2576 ASSERT(!view->hasPendingSelection()); | 2570 ASSERT(!view->hasPendingSelection()); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2901 if (it != m_resizerAreas->end()) | 2895 if (it != m_resizerAreas->end()) |
| 2902 m_resizerAreas->remove(it); | 2896 m_resizerAreas->remove(it); |
| 2903 } | 2897 } |
| 2904 | 2898 |
| 2905 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) | 2899 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) |
| 2906 { | 2900 { |
| 2907 ASSERT(scrollableArea); | 2901 ASSERT(scrollableArea); |
| 2908 if (!m_scrollableAreas) | 2902 if (!m_scrollableAreas) |
| 2909 m_scrollableAreas = adoptPtr(new ScrollableAreaSet); | 2903 m_scrollableAreas = adoptPtr(new ScrollableAreaSet); |
| 2910 m_scrollableAreas->add(scrollableArea); | 2904 m_scrollableAreas->add(scrollableArea); |
| 2905 | |
| 2906 if (scrollingCoordinator()) | |
| 2907 scrollingCoordinator()->scrollAreaSetDidChange(); | |
| 2911 } | 2908 } |
| 2912 | 2909 |
| 2913 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) | 2910 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) |
| 2914 { | 2911 { |
| 2915 if (!m_scrollableAreas) | 2912 if (!m_scrollableAreas) |
| 2916 return; | 2913 return; |
| 2917 m_scrollableAreas->remove(scrollableArea); | 2914 m_scrollableAreas->remove(scrollableArea); |
| 2915 | |
| 2916 if (scrollingCoordinator()) | |
| 2917 scrollingCoordinator()->scrollAreaSetDidChange(); | |
| 2918 } | 2918 } |
| 2919 | 2919 |
| 2920 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) | 2920 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) |
| 2921 { | 2921 { |
| 2922 ASSERT(scrollableArea); | 2922 ASSERT(scrollableArea); |
| 2923 if (!m_animatingScrollableAreas) | 2923 if (!m_animatingScrollableAreas) |
| 2924 m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet); | 2924 m_animatingScrollableAreas = adoptPtr(new ScrollableAreaSet); |
| 2925 m_animatingScrollableAreas->add(scrollableArea); | 2925 m_animatingScrollableAreas->add(scrollableArea); |
| 2926 } | 2926 } |
| 2927 | 2927 |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3996 return; | 3996 return; |
| 3997 | 3997 |
| 3998 ScrollableArea::setScrollOrigin(origin); | 3998 ScrollableArea::setScrollOrigin(origin); |
| 3999 | 3999 |
| 4000 // Update if the scroll origin changes, since our position will be different if the content size did not change. | 4000 // Update if the scroll origin changes, since our position will be different if the content size did not change. |
| 4001 if (updatePositionAtAll && updatePositionSynchronously) | 4001 if (updatePositionAtAll && updatePositionSynchronously) |
| 4002 updateScrollbars(scrollOffsetDouble()); | 4002 updateScrollbars(scrollOffsetDouble()); |
| 4003 } | 4003 } |
| 4004 | 4004 |
| 4005 } // namespace blink | 4005 } // namespace blink |
| OLD | NEW |