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

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

Issue 1969203003: Move makeChildrenInlineIfPossible to 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('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) 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 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 return; 2541 return;
2542 LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent()); 2542 LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent());
2543 LayoutObject* child = previousSibling(); 2543 LayoutObject* child = previousSibling();
2544 while (child && child->isFloatingOrOutOfFlowPositioned()) { 2544 while (child && child->isFloatingOrOutOfFlowPositioned()) {
2545 LayoutObject* sibling = child->previousSibling(); 2545 LayoutObject* sibling = child->previousSibling();
2546 parentBlockFlow->moveChildTo(this, child, firstChild(), false); 2546 parentBlockFlow->moveChildTo(this, child, firstChild(), false);
2547 child = sibling; 2547 child = sibling;
2548 } 2548 }
2549 } 2549 }
2550 2550
2551 void LayoutBlockFlow::makeChildrenInlineIfPossible()
2552 {
2553 // Collapsing away anonymous wrappers isn't relevant for the children of ano nymous blocks, unless they are ruby bases.
2554 if (isAnonymousBlock() && !isRubyBase())
2555 return;
2556
2557 Vector<LayoutBlock*, 3> blocksToRemove;
2558 for (LayoutObject* child = firstChild(); child; child = child->nextSibling() ) {
2559 if (child->isFloating())
2560 continue;
2561 if (child->isOutOfFlowPositioned())
2562 continue;
2563
2564 // There are still block children in the container, so any anonymous wra ppers are still needed.
2565 if (!child->isAnonymousBlock())
2566 return;
2567 // If one of the children is being destroyed then it is unsafe to clean up anonymous wrappers as the
2568 // entire branch may be being destroyed.
2569 if (toLayoutBlock(child)->beingDestroyed())
2570 return;
2571 // We can't remove anonymous wrappers if they contain continuations as t his means there are block children present.
2572 if (toLayoutBlock(child)->continuation())
2573 return;
2574 // We are only interested in removing anonymous wrappers if there are in line siblings underneath them.
2575 if (!child->childrenInline())
2576 return;
2577 // Ruby elements use anonymous wrappers for ruby runs and ruby bases by design, so we don't remove them.
2578 if (child->isRubyRun() || child->isRubyBase())
2579 return;
2580
2581 blocksToRemove.append(toLayoutBlock(child));
2582 }
2583
2584 // If we make an object's children inline we are going to frustrate any futu re attempts to remove
2585 // floats from its children's float-lists before the next layout happens so clear down all the floatlists
2586 // now - they will be rebuilt at layout.
2587 removeFloatingObjectsFromDescendants();
2588
2589 for (size_t i = 0; i < blocksToRemove.size(); i++)
2590 collapseAnonymousBlockChild(this, blocksToRemove[i]);
2591 setChildrenInline(true);
2592 }
2593
2551 void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts) 2594 void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts)
2552 { 2595 {
2553 // Invalidate paint of any overhanging floats (if we know we're the one to p aint them). 2596 // Invalidate paint of any overhanging floats (if we know we're the one to p aint them).
2554 // Otherwise, bail out. 2597 // Otherwise, bail out.
2555 if (!hasOverhangingFloats()) 2598 if (!hasOverhangingFloats())
2556 return; 2599 return;
2557 2600
2558 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2601 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2559 FloatingObjectSetIterator end = floatingObjectSet.end(); 2602 FloatingObjectSetIterator end = floatingObjectSet.end();
2560 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) { 2603 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 if (!rect.isEmpty()) 3669 if (!rect.isEmpty())
3627 rects.append(rect); 3670 rects.append(rect);
3628 } 3671 }
3629 } 3672 }
3630 3673
3631 if (inlineElementContinuation) 3674 if (inlineElementContinuation)
3632 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows); 3675 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows);
3633 } 3676 }
3634 3677
3635 } // namespace blink 3678 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698