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

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

Issue 1124993002: Cleanup: Only need one bit (not two) to express flow thread state. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 bool LayoutObject::isHR() const 258 bool LayoutObject::isHR() const
259 { 259 {
260 return isHTMLHRElement(node()); 260 return isHTMLHRElement(node());
261 } 261 }
262 262
263 bool LayoutObject::isLegend() const 263 bool LayoutObject::isLegend() const
264 { 264 {
265 return isHTMLLegendElement(node()); 265 return isHTMLLegendElement(node());
266 } 266 }
267 267
268 void LayoutObject::setFlowThreadStateIncludingDescendants(FlowThreadState state) 268 void LayoutObject::setIsInsideFlowThreadIncludingDescendants(bool insideFlowThre ad)
269 { 269 {
270 LayoutObject* next; 270 LayoutObject* next;
271 for (LayoutObject *object = this; object; object = next) { 271 for (LayoutObject *object = this; object; object = next) {
272 // If object is a fragmentation context it already updated the descendan ts flag accordingly. 272 // If object is a fragmentation context it already updated the descendan ts flag accordingly.
273 if (object->isLayoutFlowThread()) { 273 if (object->isLayoutFlowThread()) {
274 next = object->nextInPreOrderAfterChildren(this); 274 next = object->nextInPreOrderAfterChildren(this);
275 continue; 275 continue;
276 } 276 }
277 next = object->nextInPreOrder(this); 277 next = object->nextInPreOrder(this);
278 ASSERT(state != object->flowThreadState()); 278 ASSERT(insideFlowThread != object->isInsideFlowThread());
279 object->setFlowThreadState(state); 279 object->setIsInsideFlowThread(insideFlowThread);
280 } 280 }
281 } 281 }
282 282
283 bool LayoutObject::requiresAnonymousTableWrappers(const LayoutObject* newChild) const 283 bool LayoutObject::requiresAnonymousTableWrappers(const LayoutObject* newChild) const
284 { 284 {
285 // Check should agree with: 285 // Check should agree with:
286 // CSS 2.1 Tables: 17.2.1 Anonymous table objects 286 // CSS 2.1 Tables: 17.2.1 Anonymous table objects
287 // http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes 287 // http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes
288 if (newChild->isLayoutTableCol()) { 288 if (newChild->isLayoutTableCol()) {
289 const LayoutTableCol* newTableColumn = toLayoutTableCol(newChild); 289 const LayoutTableCol* newTableColumn = toLayoutTableCol(newChild);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 LayoutBox* ancestorBox = toLayoutBox(ancestor); 591 LayoutBox* ancestorBox = toLayoutBox(ancestor);
592 if (ancestorBox->canBeScrolledAndHasScrollableArea()) 592 if (ancestorBox->canBeScrolledAndHasScrollableArea())
593 return ancestorBox; 593 return ancestorBox;
594 } 594 }
595 595
596 return 0; 596 return 0;
597 } 597 }
598 598
599 LayoutFlowThread* LayoutObject::locateFlowThreadContainingBlock() const 599 LayoutFlowThread* LayoutObject::locateFlowThreadContainingBlock() const
600 { 600 {
601 ASSERT(flowThreadState() != NotInsideFlowThread); 601 ASSERT(isInsideFlowThread());
602 602
603 // See if we have the thread cached because we're in the middle of layout. 603 // See if we have the thread cached because we're in the middle of layout.
604 if (LayoutState* layoutState = view()->layoutState()) { 604 if (LayoutState* layoutState = view()->layoutState()) {
605 if (LayoutFlowThread* flowThread = layoutState->flowThread()) 605 if (LayoutFlowThread* flowThread = layoutState->flowThread())
606 return flowThread; 606 return flowThread;
607 } 607 }
608 608
609 // Not in the middle of layout so have to find the thread the slow way. 609 // Not in the middle of layout so have to find the thread the slow way.
610 LayoutObject* curr = const_cast<LayoutObject*>(this); 610 LayoutObject* curr = const_cast<LayoutObject*>(this);
611 while (curr) { 611 while (curr) {
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 2508
2509 removeFromLayoutFlowThread(); 2509 removeFromLayoutFlowThread();
2510 2510
2511 // Update cached boundaries in SVG layoutObjects if a child is removed. 2511 // Update cached boundaries in SVG layoutObjects if a child is removed.
2512 if (parent()->isSVG()) 2512 if (parent()->isSVG())
2513 parent()->setNeedsBoundariesUpdate(); 2513 parent()->setNeedsBoundariesUpdate();
2514 } 2514 }
2515 2515
2516 void LayoutObject::removeFromLayoutFlowThread() 2516 void LayoutObject::removeFromLayoutFlowThread()
2517 { 2517 {
2518 if (flowThreadState() == NotInsideFlowThread) 2518 if (!isInsideFlowThread())
2519 return; 2519 return;
2520 2520
2521 // Sometimes we remove the element from the flow, but it's not destroyed at that time. 2521 // Sometimes we remove the element from the flow, but it's not destroyed at that time.
2522 // It's only until later when we actually destroy it and remove all the chil dren from it. 2522 // It's only until later when we actually destroy it and remove all the chil dren from it.
2523 // Currently, that happens for firstLetter elements and list markers. 2523 // Currently, that happens for firstLetter elements and list markers.
2524 // Pass in the flow thread so that we don't have to look it up for all the c hildren. 2524 // Pass in the flow thread so that we don't have to look it up for all the c hildren.
2525 // If we're a column spanner, we need to use our parent to find the flow thr ead, since a spanner 2525 // If we're a column spanner, we need to use our parent to find the flow thr ead, since a spanner
2526 // doesn't have the flow thread in its containing block chain. We still need to notify the flow 2526 // doesn't have the flow thread in its containing block chain. We still need to notify the flow
2527 // thread when the layoutObject removed happens to be a spanner, so that we get rid of the spanner 2527 // thread when the layoutObject removed happens to be a spanner, so that we get rid of the spanner
2528 // placeholder, and column sets around the placeholder get merged. 2528 // placeholder, and column sets around the placeholder get merged.
2529 LayoutFlowThread* flowThread = isColumnSpanAll() ? parent()->flowThreadConta iningBlock() : flowThreadContainingBlock(); 2529 LayoutFlowThread* flowThread = isColumnSpanAll() ? parent()->flowThreadConta iningBlock() : flowThreadContainingBlock();
2530 removeFromLayoutFlowThreadRecursive(flowThread); 2530 removeFromLayoutFlowThreadRecursive(flowThread);
2531 } 2531 }
2532 2532
2533 void LayoutObject::removeFromLayoutFlowThreadRecursive(LayoutFlowThread* layoutF lowThread) 2533 void LayoutObject::removeFromLayoutFlowThreadRecursive(LayoutFlowThread* layoutF lowThread)
2534 { 2534 {
2535 if (const LayoutObjectChildList* children = virtualChildren()) { 2535 if (const LayoutObjectChildList* children = virtualChildren()) {
2536 for (LayoutObject* child = children->firstChild(); child; child = child- >nextSibling()) { 2536 for (LayoutObject* child = children->firstChild(); child; child = child- >nextSibling()) {
2537 if (child->isLayoutFlowThread()) 2537 if (child->isLayoutFlowThread())
2538 continue; // Don't descend into inner fragmentation contexts. 2538 continue; // Don't descend into inner fragmentation contexts.
2539 child->removeFromLayoutFlowThreadRecursive(child->isLayoutFlowThread () ? toLayoutFlowThread(child) : layoutFlowThread); 2539 child->removeFromLayoutFlowThreadRecursive(child->isLayoutFlowThread () ? toLayoutFlowThread(child) : layoutFlowThread);
2540 } 2540 }
2541 } 2541 }
2542 2542
2543 if (layoutFlowThread && layoutFlowThread != this) 2543 if (layoutFlowThread && layoutFlowThread != this)
2544 layoutFlowThread->flowThreadDescendantWillBeRemoved(this); 2544 layoutFlowThread->flowThreadDescendantWillBeRemoved(this);
2545 setFlowThreadState(NotInsideFlowThread); 2545 setIsInsideFlowThread(false);
2546 RELEASE_ASSERT(!spannerPlaceholder()); 2546 RELEASE_ASSERT(!spannerPlaceholder());
2547 } 2547 }
2548 2548
2549 void LayoutObject::destroyAndCleanupAnonymousWrappers() 2549 void LayoutObject::destroyAndCleanupAnonymousWrappers()
2550 { 2550 {
2551 // If the tree is destroyed, there is no need for a clean-up phase. 2551 // If the tree is destroyed, there is no need for a clean-up phase.
2552 if (documentBeingDestroyed()) { 2552 if (documentBeingDestroyed()) {
2553 destroy(); 2553 destroy();
2554 return; 2554 return;
2555 } 2555 }
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
3320 { 3320 {
3321 if (object1) { 3321 if (object1) {
3322 const blink::LayoutObject* root = object1; 3322 const blink::LayoutObject* root = object1;
3323 while (root->parent()) 3323 while (root->parent())
3324 root = root->parent(); 3324 root = root->parent();
3325 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3325 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3326 } 3326 }
3327 } 3327 }
3328 3328
3329 #endif 3329 #endif
OLDNEW
« Source/core/layout/LayoutObject.h ('K') | « Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698