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

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: address comments 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
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // FIXME: We should remove the one caller that triggers this case and make
533 // can reach this line. Of course, it's undefined behavior to call a member 533 // this function return a reference.
534 // function on a zero pointer, but that doesn't stop 534 ASSERT(!m_parent && !isRenderView());
535 // FrameView::paintContents. :)
536 return 0; 535 return 0;
537 } 536 }
538 537
539 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY) 538 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY)
540 { 539 {
541 RenderBox* enclosingBox = this->enclosingBox(); 540 RenderBox* enclosingBox = this->enclosingBox();
542 if (!enclosingBox) 541 if (!enclosingBox)
543 return false; 542 return false;
544 543
545 enclosingBox->scrollRectToVisible(rect, alignX, alignY); 544 enclosingBox->scrollRectToVisible(rect, alignX, alignY);
(...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after
3347 { 3346 {
3348 if (object1) { 3347 if (object1) {
3349 const WebCore::RenderObject* root = object1; 3348 const WebCore::RenderObject* root = object1;
3350 while (root->parent()) 3349 while (root->parent())
3351 root = root->parent(); 3350 root = root->parent();
3352 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3351 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3353 } 3352 }
3354 } 3353 }
3355 3354
3356 #endif 3355 #endif
OLDNEW
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698