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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 215773002: Don't call RenderObject::enclosingLayer on a null pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 return 0; 523 return 0;
524 } 524 }
525 525
526 RenderLayer* RenderObject::enclosingLayer() const 526 RenderLayer* RenderObject::enclosingLayer() const
527 { 527 {
528 for (const RenderObject* current = this; current; current = current->parent( )) { 528 for (const RenderObject* current = this; current; current = current->parent( )) {
529 if (current->hasLayer()) 529 if (current->hasLayer())
530 return toRenderLayerModelObject(current)->layer(); 530 return toRenderLayerModelObject(current)->layer();
531 } 531 }
532 // This line of code should be unreachable. However, if |this| is zero, we 532 // This function can return zero only for RenderObjects that have not yet be en added to the tree.
533 // can reach this line. Of course, it's undefined behavior to call a member 533 ASSERT(!m_parent && !isRenderView());
esprehn 2014/03/27 23:54:28 I'd ASSERT(isRooted()) at the top and ASSERT_NOT_R
534 // function on a zero pointer, but that doesn't stop
535 // FrameView::paintContents. :)
536 return 0; 534 return 0;
537 } 535 }
538 536
539 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY) 537 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY)
540 { 538 {
541 RenderBox* enclosingBox = this->enclosingBox(); 539 RenderBox* enclosingBox = this->enclosingBox();
542 if (!enclosingBox) 540 if (!enclosingBox)
543 return false; 541 return false;
544 542
545 enclosingBox->scrollRectToVisible(rect, alignX, alignY); 543 enclosingBox->scrollRectToVisible(rect, alignX, alignY);
(...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after
3347 { 3345 {
3348 if (object1) { 3346 if (object1) {
3349 const WebCore::RenderObject* root = object1; 3347 const WebCore::RenderObject* root = object1;
3350 while (root->parent()) 3348 while (root->parent())
3351 root = root->parent(); 3349 root = root->parent();
3352 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3350 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3353 } 3351 }
3354 } 3352 }
3355 3353
3356 #endif 3354 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698