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

Side by Side Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 2433873003: Fix crash when calling ScrollAnchor::clear from PaintLayer's destructor (Closed)
Patch Set: Created 4 years, 2 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ScrollAnchor.h" 5 #include "core/layout/ScrollAnchor.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/UseCounter.h" 8 #include "core/frame/UseCounter.h"
9 #include "core/layout/LayoutBlockFlow.h" 9 #include "core/layout/LayoutBlockFlow.h"
10 #include "core/layout/api/LayoutBoxItem.h" 10 #include "core/layout/api/LayoutBoxItem.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 void ScrollAnchor::clearSelf(bool unconditionally) { 302 void ScrollAnchor::clearSelf(bool unconditionally) {
303 LayoutObject* anchorObject = m_anchorObject; 303 LayoutObject* anchorObject = m_anchorObject;
304 m_anchorObject = nullptr; 304 m_anchorObject = nullptr;
305 305
306 if (anchorObject) 306 if (anchorObject)
307 anchorObject->clearIsScrollAnchorObject(unconditionally); 307 anchorObject->clearIsScrollAnchorObject(unconditionally);
308 } 308 }
309 309
310 void ScrollAnchor::clearSelf() {
311 clearSelf(false);
312 }
313
310 void ScrollAnchor::clear() { 314 void ScrollAnchor::clear() {
311 LayoutObject* layoutObject = 315 LayoutObject* layoutObject =
312 m_anchorObject ? m_anchorObject : scrollerLayoutBox(m_scroller); 316 m_anchorObject ? m_anchorObject : scrollerLayoutBox(m_scroller);
313 PaintLayer* layer = nullptr; 317 PaintLayer* layer = nullptr;
314 if (LayoutObject* parent = layoutObject->parent()) 318 if (LayoutObject* parent = layoutObject->parent())
315 layer = parent->enclosingLayer(); 319 layer = parent->enclosingLayer();
316 320
317 // Walk up the layer tree to clear any scroll anchors. 321 // Walk up the layer tree to clear any scroll anchors.
318 while (layer) { 322 while (layer) {
319 if (PaintLayerScrollableArea* scrollableArea = layer->getScrollableArea()) { 323 if (PaintLayerScrollableArea* scrollableArea = layer->getScrollableArea()) {
(...skipping 14 matching lines...) Expand all
334 bool ScrollAnchor::refersTo(const LayoutObject* layoutObject) const { 338 bool ScrollAnchor::refersTo(const LayoutObject* layoutObject) const {
335 return m_anchorObject == layoutObject; 339 return m_anchorObject == layoutObject;
336 } 340 }
337 341
338 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) { 342 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) {
339 if (m_anchorObject == layoutObject) 343 if (m_anchorObject == layoutObject)
340 clearSelf(); 344 clearSelf();
341 } 345 }
342 346
343 } // namespace blink 347 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollAnchor.h ('k') | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698