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

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

Issue 1977083002: Move line/continuation specific parts of willBeDestroyed() into LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 } 145 }
146 146
147 LayoutBlock::~LayoutBlock() 147 LayoutBlock::~LayoutBlock()
148 { 148 {
149 removeFromGlobalMaps(); 149 removeFromGlobalMaps();
150 } 150 }
151 151
152 void LayoutBlock::willBeDestroyed() 152 void LayoutBlock::willBeDestroyed()
153 { 153 {
154 // Mark as being destroyed to avoid trouble with merges in removeChild(). 154 if (!documentBeingDestroyed() && parent())
155 m_beingDestroyed = true; 155 parent()->dirtyLinesFromChangedChild(this);
156
157 // Make sure to destroy anonymous children first while they are still connec ted to the rest of the tree, so that they will
158 // properly dirty line boxes that they are removed from. Effects that do :be fore/:after only on hover could crash otherwise.
159 children()->destroyLeftoverChildren();
160
161 // Destroy our continuation before anything other than anonymous children.
162 // The reason we don't destroy it before anonymous children is that they may
163 // have continuations of their own that are anonymous children of our contin uation.
164 LayoutBoxModelObject* continuation = this->continuation();
165 if (continuation) {
166 continuation->destroy();
167 setContinuation(nullptr);
168 }
169
170 if (!documentBeingDestroyed()) {
171 if (firstLineBox()) {
172 // We can't wait for LayoutBox::destroy to clear the selection,
173 // because by then we will have nuked the line boxes.
174 // FIXME: The FrameSelection should be responsible for this when it
175 // is notified of DOM mutations.
176 if (isSelectionBorder())
177 view()->clearSelection();
178
179 // If we are an anonymous block, then our line boxes might have chil dren
180 // that will outlast this block. In the non-anonymous block case tho se
181 // children will be destroyed by the time we return from this functi on.
182 if (isAnonymousBlock()) {
183 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi neBox()) {
184 while (InlineBox* childBox = box->firstChild())
185 childBox->remove();
186 }
187 }
188 } else if (parent()) {
189 parent()->dirtyLinesFromChangedChild(this);
190 }
191 }
192
193 m_lineBoxes.deleteLineBoxes();
194 156
195 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) 157 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
196 gDelayedUpdateScrollInfoSet->remove(this); 158 gDelayedUpdateScrollInfoSet->remove(this);
197 159
198 if (TextAutosizer* textAutosizer = document().textAutosizer()) 160 if (TextAutosizer* textAutosizer = document().textAutosizer())
199 textAutosizer->destroy(this); 161 textAutosizer->destroy(this);
200 162
201 LayoutBox::willBeDestroyed(); 163 LayoutBox::willBeDestroyed();
202 } 164 }
203 165
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 1927 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
1966 LayoutBox* currBox = *it; 1928 LayoutBox* currBox = *it;
1967 ASSERT(!currBox->needsLayout()); 1929 ASSERT(!currBox->needsLayout());
1968 } 1930 }
1969 } 1931 }
1970 } 1932 }
1971 1933
1972 #endif 1934 #endif
1973 1935
1974 } // namespace blink 1936 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698