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

Side by Side Diff: Source/core/layout/LayoutInline.cpp

Issue 1025213002: Begin tracking why layout is invalidated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutImage.cpp ('k') | Source/core/layout/LayoutListItem.cpp » ('j') | 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, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // If any descendant blocks exist then they will be in the next anonymou s block and its siblings. 208 // If any descendant blocks exist then they will be in the next anonymou s block and its siblings.
209 LayoutObject* block = containingBlock()->nextSibling(); 209 LayoutObject* block = containingBlock()->nextSibling();
210 if (block && block->isAnonymousBlock()) 210 if (block && block->isAnonymousBlock())
211 updateStyleOfAnonymousBlockContinuations(block, newStyle, *oldStyle) ; 211 updateStyleOfAnonymousBlockContinuations(block, newStyle, *oldStyle) ;
212 } 212 }
213 213
214 if (!alwaysCreateLineBoxes()) { 214 if (!alwaysCreateLineBoxes()) {
215 bool alwaysCreateLineBoxesNew = hasSelfPaintingLayer() || hasBoxDecorati onBackground() || newStyle.hasPadding() || newStyle.hasMargin() || newStyle.hasO utline(); 215 bool alwaysCreateLineBoxesNew = hasSelfPaintingLayer() || hasBoxDecorati onBackground() || newStyle.hasPadding() || newStyle.hasMargin() || newStyle.hasO utline();
216 if (oldStyle && alwaysCreateLineBoxesNew) { 216 if (oldStyle && alwaysCreateLineBoxesNew) {
217 dirtyLineBoxes(false); 217 dirtyLineBoxes(false);
218 setNeedsLayoutAndFullPaintInvalidation(); 218 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Sty leChange);
219 } 219 }
220 setAlwaysCreateLineBoxes(alwaysCreateLineBoxesNew); 220 setAlwaysCreateLineBoxes(alwaysCreateLineBoxesNew);
221 } 221 }
222 } 222 }
223 223
224 void LayoutInline::updateAlwaysCreateLineBoxes(bool fullLayout) 224 void LayoutInline::updateAlwaysCreateLineBoxes(bool fullLayout)
225 { 225 {
226 // Once we have been tainted once, just assume it will happen again. This wa y effects like hover highlighting that change the 226 // Once we have been tainted once, just assume it will happen again. This wa y effects like hover highlighting that change the
227 // background color will only cause a layout on the first rollover. 227 // background color will only cause a layout on the first rollover.
228 if (alwaysCreateLineBoxes()) 228 if (alwaysCreateLineBoxes())
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 newBox->setStyle(newStyle.release()); 346 newBox->setStyle(newStyle.release());
347 LayoutBoxModelObject* oldContinuation = continuation(); 347 LayoutBoxModelObject* oldContinuation = continuation();
348 setContinuation(newBox); 348 setContinuation(newBox);
349 349
350 splitFlow(beforeChild, newBox, newChild, oldContinuation); 350 splitFlow(beforeChild, newBox, newChild, oldContinuation);
351 return; 351 return;
352 } 352 }
353 353
354 LayoutBoxModelObject::addChild(newChild, beforeChild); 354 LayoutBoxModelObject::addChild(newChild, beforeChild);
355 355
356 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 356 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutIn validationReason::ChildChanged);
357 } 357 }
358 358
359 LayoutInline* LayoutInline::clone() const 359 LayoutInline* LayoutInline::clone() const
360 { 360 {
361 LayoutInline* cloneInline = new LayoutInline(node()); 361 LayoutInline* cloneInline = new LayoutInline(node());
362 cloneInline->setStyle(style()); 362 cloneInline->setStyle(style());
363 cloneInline->setFlowThreadState(flowThreadState()); 363 cloneInline->setFlowThreadState(flowThreadState());
364 return cloneInline; 364 return cloneInline;
365 } 365 }
366 366
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 block->children()->insertChildNode(block, newBlockBox, boxFirst); 486 block->children()->insertChildNode(block, newBlockBox, boxFirst);
487 block->children()->insertChildNode(block, post, boxFirst); 487 block->children()->insertChildNode(block, post, boxFirst);
488 block->setChildrenInline(false); 488 block->setChildrenInline(false);
489 489
490 if (madeNewBeforeBlock) { 490 if (madeNewBeforeBlock) {
491 LayoutObject* o = boxFirst; 491 LayoutObject* o = boxFirst;
492 while (o) { 492 while (o) {
493 LayoutObject* no = o; 493 LayoutObject* no = o;
494 o = no->nextSibling(); 494 o = no->nextSibling();
495 pre->children()->appendChildNode(pre, block->children()->removeChild Node(block, no)); 495 pre->children()->appendChildNode(pre, block->children()->removeChild Node(block, no));
496 no->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 496 no->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(Layout InvalidationReason::AnonymousBlockChange);
497 } 497 }
498 } 498 }
499 499
500 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); 500 splitInlines(pre, post, newBlockBox, beforeChild, oldCont);
501 501
502 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting 502 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting
503 // time in makeChildrenNonInline by just setting this explicitly up front. 503 // time in makeChildrenNonInline by just setting this explicitly up front.
504 newBlockBox->setChildrenInline(false); 504 newBlockBox->setChildrenInline(false);
505 505
506 newBlockBox->addChild(newChild); 506 newBlockBox->addChild(newChild);
507 507
508 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images) 508 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images)
509 // get deleted properly. Because objects moves from the pre block into the post block, we want to 509 // get deleted properly. Because objects moves from the pre block into the post block, we want to
510 // make new line boxes instead of leaving the old line boxes around. 510 // make new line boxes instead of leaving the old line boxes around.
511 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 511 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalid ationReason::AnonymousBlockChange);
512 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 512 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInval idationReason::AnonymousBlockChange);
513 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 513 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvali dationReason::AnonymousBlockChange);
514 } 514 }
515 515
516 void LayoutInline::addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChild) 516 void LayoutInline::addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChild)
517 { 517 {
518 LayoutBoxModelObject* flow = continuationBefore(beforeChild); 518 LayoutBoxModelObject* flow = continuationBefore(beforeChild);
519 ASSERT(!beforeChild || beforeChild->parent()->isLayoutBlock() || beforeChild ->parent()->isLayoutInline()); 519 ASSERT(!beforeChild || beforeChild->parent()->isLayoutBlock() || beforeChild ->parent()->isLayoutInline());
520 LayoutBoxModelObject* beforeChildParent = 0; 520 LayoutBoxModelObject* beforeChildParent = 0;
521 if (beforeChild) { 521 if (beforeChild) {
522 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent()); 522 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent());
523 } else { 523 } else {
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } 1455 }
1456 1456
1457 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const 1457 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const
1458 { 1458 {
1459 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r); 1459 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r);
1460 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1460 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1461 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1461 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1462 } 1462 }
1463 1463
1464 } // namespace blink 1464 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutImage.cpp ('k') | Source/core/layout/LayoutListItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698