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

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

Issue 1879553003: parent->addChild() can delete parent and any of its siblings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@396717-2
Patch Set: Updated Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/create-list-with-hr-expected.txt ('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 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // are the only item in that anonymous box (since no line box parent was 306 // are the only item in that anonymous box (since no line box parent was
307 // found). It's ok to just leave the marker where it is in this case. 307 // found). It's ok to just leave the marker where it is in this case.
308 if (markerParent && markerParent->isAnonymousBlock()) 308 if (markerParent && markerParent->isAnonymousBlock())
309 lineBoxParent = markerParent; 309 lineBoxParent = markerParent;
310 else 310 else
311 lineBoxParent = this; 311 lineBoxParent = this;
312 } 312 }
313 313
314 if (markerParent != lineBoxParent) { 314 if (markerParent != lineBoxParent) {
315 m_marker->remove(); 315 m_marker->remove();
316 // If markerParent is now an anonymous block with no children, this is t he time to attempt to remove it
317 // as it might have gone away after addChild().
318 if (markerParent && markerParent->isAnonymousBlock() && !toLayoutBlock(m arkerParent)->firstChild() && !toLayoutBlock(markerParent)->continuation())
319 markerParent->destroy();
320 lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent)); 316 lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent));
317 // TODO(rhogan): lineBoxParent and markerParent may be deleted by addChi ld, so they are not safe to reference here.
318 // Once we have a safe way of referencing them delete markerParent if it is an empty anonymous block.
321 m_marker->updateMarginsAndContent(); 319 m_marker->updateMarginsAndContent();
322 return true; 320 return true;
323 } 321 }
324 322
325 return false; 323 return false;
326 } 324 }
327 325
328 void LayoutListItem::addOverflowFromChildren() 326 void LayoutListItem::addOverflowFromChildren()
329 { 327 {
330 LayoutBlockFlow::addOverflowFromChildren(); 328 LayoutBlockFlow::addOverflowFromChildren();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // assume that all the following ones have too. 509 // assume that all the following ones have too.
512 // This gives us the opportunity to stop here and avoid 510 // This gives us the opportunity to stop here and avoid
513 // marking the same nodes again. 511 // marking the same nodes again.
514 break; 512 break;
515 } 513 }
516 item->updateValue(); 514 item->updateValue();
517 } 515 }
518 } 516 }
519 517
520 } // namespace blink 518 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/create-list-with-hr-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698