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

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

Issue 880113002: Fix crash when establishing an inline continuation inside a block continuation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 /* 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 443 }
444 444
445 if (!beforeChild && !last->firstChild()) 445 if (!beforeChild && !last->firstChild())
446 return nextToLast; 446 return nextToLast;
447 return last; 447 return last;
448 } 448 }
449 449
450 void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* b eforeChild) 450 void RenderBlock::addChildToContinuation(RenderObject* newChild, RenderObject* b eforeChild)
451 { 451 {
452 RenderBlock* flow = continuationBefore(beforeChild); 452 RenderBlock* flow = continuationBefore(beforeChild);
453 ASSERT(!beforeChild || beforeChild->parent()->isAnonymousColumnSpanBlock() | | beforeChild->parent()->isRenderBlock());
mstensho (USE GERRIT) 2015/01/28 10:43:16 This was probably here because someone knew that i
454 RenderBoxModelObject* beforeChildParent = 0; 453 RenderBoxModelObject* beforeChildParent = 0;
455 if (beforeChild) 454 if (beforeChild) {
456 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); 455 beforeChildParent = toRenderBoxModelObject(beforeChild->parent());
457 else { 456 // Don't attempt to insert into something that isn't a RenderBlockFlow ( block
mstensho (USE GERRIT) 2015/01/28 10:43:16 This is an attempt at a proper fix for the bug, an
457 // container). While the DOM nodes of |beforeChild| and |newChild| are s iblings, there may
458 // be anonymous table wrapper objects around |beforeChild| on the layout side. Therefore,
459 // find the nearest RenderBlockFlow. If it turns out that the new render er doesn't belong
460 // inside the anonymous table, this will make sure that it's really put on the outside. If
461 // it turns out that it does belong inside it, the normal child insertio n machinery will
462 // make sure it ends up there, and at the right place too. We cannot jus t guess that it's
463 // going to be right under the parent of |beforeChild|.
464 while (beforeChildParent && !beforeChildParent->isRenderBlockFlow())
Julien - ping for review 2015/01/28 17:29:53 This code can go past |this| while walking up the
mstensho (USE GERRIT) 2015/01/28 17:51:26 Yeah, I added an assert against that in the second
465 beforeChildParent = toRenderBoxModelObject(beforeChildParent->parent ());
mstensho (USE GERRIT) 2015/01/28 10:43:16 Could add some assertions here, but I'll wait and
466 ASSERT(beforeChildParent);
Julien - ping for review 2015/01/28 17:29:53 I don't know how: beforeChildParent->addChildIgno
mstensho (USE GERRIT) 2015/01/28 17:51:26 One of the first things RenderBlock::addChildIgnor
Julien - ping for review 2015/01/29 10:28:31 Acknowledged.
467 } else {
458 RenderBoxModelObject* cont = flow->continuation(); 468 RenderBoxModelObject* cont = flow->continuation();
459 if (cont) 469 if (cont)
460 beforeChildParent = cont; 470 beforeChildParent = cont;
461 else 471 else
462 beforeChildParent = flow; 472 beforeChildParent = flow;
463 } 473 }
464 474
465 if (newChild->isFloatingOrOutOfFlowPositioned()) { 475 if (newChild->isFloatingOrOutOfFlowPositioned()) {
466 beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); 476 beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild);
467 return; 477 return;
(...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after
3947 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 3957 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
3948 { 3958 {
3949 showRenderObject(); 3959 showRenderObject();
3950 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3960 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3951 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3961 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3952 } 3962 }
3953 3963
3954 #endif 3964 #endif
3955 3965
3956 } // namespace blink 3966 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698