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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp

Issue 1215973002: Oilpan: improve ScrollableArea handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: clear out animators on DeprecatedPaintLayerScrollableArea dispose Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 : m_layer(layer) 83 : m_layer(layer)
84 , m_inResizeMode(false) 84 , m_inResizeMode(false)
85 , m_scrollsOverflow(false) 85 , m_scrollsOverflow(false)
86 , m_scrollDimensionsDirty(true) 86 , m_scrollDimensionsDirty(true)
87 , m_inOverflowRelayout(false) 87 , m_inOverflowRelayout(false)
88 , m_nextTopmostScrollChild(0) 88 , m_nextTopmostScrollChild(0)
89 , m_topmostScrollChild(0) 89 , m_topmostScrollChild(0)
90 , m_needsCompositedScrolling(false) 90 , m_needsCompositedScrolling(false)
91 , m_scrollCorner(nullptr) 91 , m_scrollCorner(nullptr)
92 , m_resizer(nullptr) 92 , m_resizer(nullptr)
93 #if ENABLE(ASSERT)
94 , m_hasBeenDisposed(false)
95 #endif
93 { 96 {
94 Node* node = box().node(); 97 Node* node = box().node();
95 if (node && node->isElementNode()) { 98 if (node && node->isElementNode()) {
96 // We save and restore only the scrollOffset as the other scroll values are recalculated. 99 // We save and restore only the scrollOffset as the other scroll values are recalculated.
97 Element* element = toElement(node); 100 Element* element = toElement(node);
98 m_scrollOffset = element->savedLayerScrollOffset(); 101 m_scrollOffset = element->savedLayerScrollOffset();
99 if (!m_scrollOffset.isZero()) 102 if (!m_scrollOffset.isZero())
100 scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width (), m_scrollOffset.height())); 103 scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width (), m_scrollOffset.height()));
101 element->setSavedLayerScrollOffset(IntSize()); 104 element->setSavedLayerScrollOffset(IntSize());
102 } 105 }
103 106
104 updateResizerAreaSet(); 107 updateResizerAreaSet();
105 } 108 }
106 109
107 DeprecatedPaintLayerScrollableArea::~DeprecatedPaintLayerScrollableArea() 110 DeprecatedPaintLayerScrollableArea::~DeprecatedPaintLayerScrollableArea()
108 { 111 {
112 ASSERT(m_hasBeenDisposed);
113 }
114
115 void DeprecatedPaintLayerScrollableArea::dispose()
116 {
109 if (inResizeMode() && !box().documentBeingDestroyed()) { 117 if (inResizeMode() && !box().documentBeingDestroyed()) {
110 if (LocalFrame* frame = box().frame()) 118 if (LocalFrame* frame = box().frame())
111 frame->eventHandler().resizeScrollableAreaDestroyed(); 119 frame->eventHandler().resizeScrollableAreaDestroyed();
112 } 120 }
113 121
114 if (LocalFrame* frame = box().frame()) { 122 if (LocalFrame* frame = box().frame()) {
115 if (FrameView* frameView = frame->view()) { 123 if (FrameView* frameView = frame->view()) {
116 frameView->removeScrollableArea(this); 124 frameView->removeScrollableArea(this);
117 frameView->removeAnimatingScrollableArea(this); 125 frameView->removeAnimatingScrollableArea(this);
118 } 126 }
(...skipping 16 matching lines...) Expand all
135 frameView->removeResizerArea(box()); 143 frameView->removeResizerArea(box());
136 } 144 }
137 145
138 destroyScrollbar(HorizontalScrollbar); 146 destroyScrollbar(HorizontalScrollbar);
139 destroyScrollbar(VerticalScrollbar); 147 destroyScrollbar(VerticalScrollbar);
140 148
141 if (m_scrollCorner) 149 if (m_scrollCorner)
142 m_scrollCorner->destroy(); 150 m_scrollCorner->destroy();
143 if (m_resizer) 151 if (m_resizer)
144 m_resizer->destroy(); 152 m_resizer->destroy();
153
154 clearScrollAnimators();
haraken 2015/06/30 10:30:35 Do we need to call clearScrollAnimators() in dispo
sof 2015/06/30 11:34:09 This is what https://code.google.com/p/chromium/is
haraken 2015/06/30 14:14:24 My question is whether we need to call clearScroll
sof 2015/06/30 14:28:03 It is a problem to delay its clearing until it is
haraken 2015/06/30 14:30:24 Makes sense. Why doesn't it become a problem for S
sof 2015/06/30 14:35:48 It takes care of its owned objects via eager final
haraken 2015/06/30 14:37:21 ah, understood; thanks!
155
156 #if ENABLE(ASSERT)
157 m_hasBeenDisposed = true;
158 #endif
159 }
160
161 DEFINE_TRACE(DeprecatedPaintLayerScrollableArea)
162 {
163 visitor->trace(m_hBar);
164 visitor->trace(m_vBar);
165 ScrollableArea::trace(visitor);
145 } 166 }
146 167
147 HostWindow* DeprecatedPaintLayerScrollableArea::hostWindow() const 168 HostWindow* DeprecatedPaintLayerScrollableArea::hostWindow() const
148 { 169 {
149 if (Page* page = box().frame()->page()) 170 if (Page* page = box().frame()->page())
150 return &page->chromeClient(); 171 return &page->chromeClient();
151 return nullptr; 172 return nullptr;
152 } 173 }
153 174
154 GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForScrolling() const 175 GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForScrolling() const
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 didAddScrollbar(widget.get(), HorizontalScrollbar); 949 didAddScrollbar(widget.get(), HorizontalScrollbar);
929 else 950 else
930 didAddScrollbar(widget.get(), VerticalScrollbar); 951 didAddScrollbar(widget.get(), VerticalScrollbar);
931 } 952 }
932 box().document().view()->addChild(widget.get()); 953 box().document().view()->addChild(widget.get());
933 return widget.release(); 954 return widget.release();
934 } 955 }
935 956
936 void DeprecatedPaintLayerScrollableArea::destroyScrollbar(ScrollbarOrientation o rientation) 957 void DeprecatedPaintLayerScrollableArea::destroyScrollbar(ScrollbarOrientation o rientation)
937 { 958 {
938 RefPtrWillBePersistent<Scrollbar>& scrollbar = orientation == HorizontalScro llbar ? m_hBar : m_vBar; 959 RefPtrWillBeMember<Scrollbar>& scrollbar = orientation == HorizontalScrollba r ? m_hBar : m_vBar;
939 if (!scrollbar) 960 if (!scrollbar)
940 return; 961 return;
941 962
942 if (!scrollbar->isCustomScrollbar()) 963 if (!scrollbar->isCustomScrollbar())
943 willRemoveScrollbar(scrollbar.get(), orientation); 964 willRemoveScrollbar(scrollbar.get(), orientation);
944 965
945 toFrameView(scrollbar->parent())->removeChild(scrollbar.get()); 966 toFrameView(scrollbar->parent())->removeChild(scrollbar.get());
946 scrollbar->disconnectFromScrollableArea(); 967 scrollbar->disconnectFromScrollableArea();
haraken 2015/06/30 10:30:35 I'd add #if !ENABLE(OILPAN).
947 scrollbar = nullptr; 968 scrollbar = nullptr;
948 } 969 }
949 970
950 void DeprecatedPaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrol lbar) 971 void DeprecatedPaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrol lbar)
951 { 972 {
952 if (hasScrollbar == hasHorizontalScrollbar()) 973 if (hasScrollbar == hasHorizontalScrollbar())
953 return; 974 return;
954 975
955 if (hasScrollbar) { 976 if (hasScrollbar) {
956 // This doesn't hit in any tests, but since the equivalent code in setHa sVerticalScrollbar 977 // This doesn't hit in any tests, but since the equivalent code in setHa sVerticalScrollbar
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa yer* scrollChild) 1414 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa yer* scrollChild)
1394 { 1415 {
1395 // We only want to track the topmost scroll child for scrollable areas with 1416 // We only want to track the topmost scroll child for scrollable areas with
1396 // overlay scrollbars. 1417 // overlay scrollbars.
1397 if (!hasOverlayScrollbars()) 1418 if (!hasOverlayScrollbars())
1398 return; 1419 return;
1399 m_nextTopmostScrollChild = scrollChild; 1420 m_nextTopmostScrollChild = scrollChild;
1400 } 1421 }
1401 1422
1402 } // namespace blink 1423 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698