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

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

Issue 19290002: Move runin to original position when sibling element is destroyed. Additionally, if If moveRunInUnd… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 7 years, 4 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 | « LayoutTests/fast/runin/runin-sibling-inline-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 * (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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 RenderBlock* renderer = new (document->renderArena()) RenderBlock(0); 272 RenderBlock* renderer = new (document->renderArena()) RenderBlock(0);
273 renderer->setDocumentForAnonymous(document); 273 renderer->setDocumentForAnonymous(document);
274 return renderer; 274 return renderer;
275 } 275 }
276 276
277 void RenderBlock::willBeDestroyed() 277 void RenderBlock::willBeDestroyed()
278 { 278 {
279 // Mark as being destroyed to avoid trouble with merges in removeChild(). 279 // Mark as being destroyed to avoid trouble with merges in removeChild().
280 m_beingDestroyed = true; 280 m_beingDestroyed = true;
281 281
282 if (!documentBeingDestroyed()) {
283 if (firstChild() && firstChild()->isRunIn()) {
284 // If we are moving inline children(run-in) from |this| to |parent|, then we need
285 // to clear our line box tree.
286 if (childrenInline())
287 deleteLineBoxTree();
288 moveRunInToOriginalPosition(firstChild());
289 }
290 }
291
282 // Make sure to destroy anonymous children first while they are still connec ted to the rest of the tree, so that they will 292 // Make sure to destroy anonymous children first while they are still connec ted to the rest of the tree, so that they will
283 // properly dirty line boxes that they are removed from. Effects that do :be fore/:after only on hover could crash otherwise. 293 // properly dirty line boxes that they are removed from. Effects that do :be fore/:after only on hover could crash otherwise.
284 children()->destroyLeftoverChildren(); 294 children()->destroyLeftoverChildren();
285 295
286 // Destroy our continuation before anything other than anonymous children. 296 // Destroy our continuation before anything other than anonymous children.
287 // The reason we don't destroy it before anonymous children is that they may 297 // The reason we don't destroy it before anonymous children is that they may
288 // have continuations of their own that are anonymous children of our contin uation. 298 // have continuations of their own that are anonymous children of our contin uation.
289 RenderBoxModelObject* continuation = this->continuation(); 299 RenderBoxModelObject* continuation = this->continuation();
290 if (continuation) { 300 if (continuation) {
291 continuation->destroy(); 301 continuation->destroy();
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 1984
1975 // Check if this node is allowed to run-in. E.g. <select> expects its render er to 1985 // Check if this node is allowed to run-in. E.g. <select> expects its render er to
1976 // be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline run-in. 1986 // be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline run-in.
1977 if (!runIn->canBeReplacedWithInlineRunIn()) 1987 if (!runIn->canBeReplacedWithInlineRunIn())
1978 return; 1988 return;
1979 1989
1980 RenderObject* curr = runIn->nextSibling(); 1990 RenderObject* curr = runIn->nextSibling();
1981 if (!curr || !curr->isRenderBlock() || !curr->childrenInline()) 1991 if (!curr || !curr->isRenderBlock() || !curr->childrenInline())
1982 return; 1992 return;
1983 1993
1994 if (toRenderBlock(curr)->beingDestroyed())
1995 return;
1996
1984 // Per CSS3, "A run-in cannot run in to a block that already starts with a 1997 // Per CSS3, "A run-in cannot run in to a block that already starts with a
1985 // run-in or that itself is a run-in". 1998 // run-in or that itself is a run-in".
1986 if (curr->isRunIn() || (curr->firstChild() && curr->firstChild()->isRunIn()) ) 1999 if (curr->isRunIn() || (curr->firstChild() && curr->firstChild()->isRunIn()) )
1987 return; 2000 return;
1988 2001
1989 if (curr->isAnonymous() || curr->isFloatingOrOutOfFlowPositioned()) 2002 if (curr->isAnonymous() || curr->isFloatingOrOutOfFlowPositioned())
1990 return; 2003 return;
1991 2004
1992 // FIXME: We don't support run-ins with or as part of a continuation 2005 // FIXME: We don't support run-ins with or as part of a continuation
1993 // as it makes the back-and-forth placing complex. 2006 // as it makes the back-and-forth placing complex.
(...skipping 6265 matching lines...) Expand 10 before | Expand all | Expand 10 after
8259 } 8272 }
8260 8273
8261 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 8274 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
8262 { 8275 {
8263 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 8276 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
8264 } 8277 }
8265 8278
8266 #endif 8279 #endif
8267 8280
8268 } // namespace WebCore 8281 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/runin/runin-sibling-inline-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698