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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 ASSERT_NOT_REACHED(); 2187 ASSERT_NOT_REACHED();
2188 } 2188 }
2189 return result; 2189 return result;
2190 } 2190 }
2191 2191
2192 void LayoutBlockFlow::createFloatingObjects() 2192 void LayoutBlockFlow::createFloatingObjects()
2193 { 2193 {
2194 m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMo de())); 2194 m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMo de()));
2195 } 2195 }
2196 2196
2197 void LayoutBlockFlow::willBeDestroyed()
2198 {
2199 // Mark as being destroyed to avoid trouble with merges in removeChild().
2200 m_beingDestroyed = true;
2201
2202 // Make sure to destroy anonymous children first while they are still connec ted to the rest of the tree, so that they will
2203 // properly dirty line boxes that they are removed from. Effects that do :be fore/:after only on hover could crash otherwise.
2204 children()->destroyLeftoverChildren();
2205
2206 // Destroy our continuation before anything other than anonymous children.
2207 // The reason we don't destroy it before anonymous children is that they may
2208 // have continuations of their own that are anonymous children of our contin uation.
2209 LayoutBoxModelObject* continuation = this->continuation();
2210 if (continuation) {
2211 continuation->destroy();
2212 setContinuation(nullptr);
2213 }
2214
2215 if (!documentBeingDestroyed()) {
2216 // TODO(mstensho): figure out if we need this. We have no test coverage for it. It looks
2217 // like all line boxes have been removed at this point.
2218 if (firstLineBox()) {
2219 // We can't wait for LayoutBox::destroy to clear the selection,
2220 // because by then we will have nuked the line boxes.
2221 // FIXME: The FrameSelection should be responsible for this when it
2222 // is notified of DOM mutations.
2223 if (isSelectionBorder())
2224 view()->clearSelection();
2225
2226 // If we are an anonymous block, then our line boxes might have chil dren
2227 // that will outlast this block. In the non-anonymous block case tho se
2228 // children will be destroyed by the time we return from this functi on.
2229 if (isAnonymousBlock()) {
2230 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi neBox()) {
2231 while (InlineBox* childBox = box->firstChild())
2232 childBox->remove();
2233 }
2234 }
2235 }
2236 }
2237
2238 m_lineBoxes.deleteLineBoxes();
2239
2240 LayoutBlock::willBeDestroyed();
2241 }
2242
2197 void LayoutBlockFlow::styleWillChange(StyleDifference diff, const ComputedStyle& newStyle) 2243 void LayoutBlockFlow::styleWillChange(StyleDifference diff, const ComputedStyle& newStyle)
2198 { 2244 {
2199 const ComputedStyle* oldStyle = style(); 2245 const ComputedStyle* oldStyle = style();
2200 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned () && !avoidsFloats() : false; 2246 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned () && !avoidsFloats() : false;
2201 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() ! = newStyle.position() 2247 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() ! = newStyle.position()
2202 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS tyle.hasOutOfFlowPosition()) 2248 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS tyle.hasOutOfFlowPosition())
2203 markAllDescendantsWithFloatsForLayout(); 2249 markAllDescendantsWithFloatsForLayout();
2204 2250
2205 LayoutBlock::styleWillChange(diff, newStyle); 2251 LayoutBlock::styleWillChange(diff, newStyle);
2206 } 2252 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 if (child->isFloating()) 2626 if (child->isFloating())
2581 continue; 2627 continue;
2582 if (child->isOutOfFlowPositioned()) 2628 if (child->isOutOfFlowPositioned())
2583 continue; 2629 continue;
2584 2630
2585 // There are still block children in the container, so any anonymous wra ppers are still needed. 2631 // There are still block children in the container, so any anonymous wra ppers are still needed.
2586 if (!child->isAnonymousBlock() || !child->isLayoutBlockFlow()) 2632 if (!child->isAnonymousBlock() || !child->isLayoutBlockFlow())
2587 return; 2633 return;
2588 // If one of the children is being destroyed then it is unsafe to clean up anonymous wrappers as the 2634 // If one of the children is being destroyed then it is unsafe to clean up anonymous wrappers as the
2589 // entire branch may be being destroyed. 2635 // entire branch may be being destroyed.
2590 if (toLayoutBlock(child)->beingDestroyed()) 2636 if (toLayoutBlockFlow(child)->beingDestroyed())
2591 return; 2637 return;
2592 // We can't remove anonymous wrappers if they contain continuations as t his means there are block children present. 2638 // We can't remove anonymous wrappers if they contain continuations as t his means there are block children present.
2593 if (toLayoutBlock(child)->continuation()) 2639 if (toLayoutBlockFlow(child)->continuation())
2594 return; 2640 return;
2595 // We are only interested in removing anonymous wrappers if there are in line siblings underneath them. 2641 // We are only interested in removing anonymous wrappers if there are in line siblings underneath them.
2596 if (!child->childrenInline()) 2642 if (!child->childrenInline())
2597 return; 2643 return;
2598 // Ruby elements use anonymous wrappers for ruby runs and ruby bases by design, so we don't remove them. 2644 // Ruby elements use anonymous wrappers for ruby runs and ruby bases by design, so we don't remove them.
2599 if (child->isRubyRun() || child->isRubyBase()) 2645 if (child->isRubyRun() || child->isRubyBase())
2600 return; 2646 return;
2601 2647
2602 blocksToRemove.append(toLayoutBlockFlow(child)); 2648 blocksToRemove.append(toLayoutBlockFlow(child));
2603 } 2649 }
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3781 if (!rect.isEmpty()) 3827 if (!rect.isEmpty())
3782 rects.append(rect); 3828 rects.append(rect);
3783 } 3829 }
3784 } 3830 }
3785 3831
3786 if (inlineElementContinuation) 3832 if (inlineElementContinuation)
3787 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows); 3833 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows);
3788 } 3834 }
3789 3835
3790 } // namespace blink 3836 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698