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

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

Issue 1966223002: Helper for interesting things to do when a block becomes a float or out-of-flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup! Helper for interesting things to do when a block becomes a float or out-of-flow. 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 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it != end; ++it) { 2365 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it != end; ++it) {
2366 const FloatingObject& floatingObject = *it->get(); 2366 const FloatingObject& floatingObject = *it->get();
2367 2367
2368 // Don't insert the object again if it's already in the list 2368 // Don't insert the object again if it's already in the list
2369 if (toBlockFlow->containsFloat(floatingObject.layoutObject())) 2369 if (toBlockFlow->containsFloat(floatingObject.layoutObject()))
2370 continue; 2370 continue;
2371 2371
2372 toBlockFlow->m_floatingObjects->add(floatingObject.unsafeClone()); 2372 toBlockFlow->m_floatingObjects->add(floatingObject.unsafeClone());
2373 } 2373 }
2374 } 2374 }
2375 }
2375 2376
2377 void LayoutBlockFlow::childBecameFloatingOrOutOfFlow(LayoutBox* child)
2378 {
2379 makeChildrenInlineIfPossible();
2380
2381 // Reparent the child to an adjacent anonymous block if one is available.
2382 LayoutObject* prev = child->previousSibling();
2383 if (prev && prev->isAnonymousBlock() && prev->isLayoutBlockFlow()) {
2384 LayoutBlockFlow* newContainer = toLayoutBlockFlow(prev);
2385 moveChildTo(newContainer, child, nullptr, false);
2386 // The anonymous block we've moved to may now be adjacent to former sibl ings of ours
2387 // that it can contain also.
2388 newContainer->reparentSubsequentFloatingOrOutOfFlowSiblings();
2389 return;
2390 }
2391 LayoutObject* next = child->nextSibling();
2392 if (next && next->isAnonymousBlock() && next->isLayoutBlockFlow()) {
2393 LayoutBlockFlow* newContainer = toLayoutBlockFlow(next);
2394 moveChildTo(newContainer, child, newContainer->firstChild(), false);
2395 }
2376 } 2396 }
2377 2397
2378 void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts) 2398 void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts)
2379 { 2399 {
2380 // Invalidate paint of any overhanging floats (if we know we're the one to p aint them). 2400 // Invalidate paint of any overhanging floats (if we know we're the one to p aint them).
2381 // Otherwise, bail out. 2401 // Otherwise, bail out.
2382 if (!hasOverhangingFloats()) 2402 if (!hasOverhangingFloats())
2383 return; 2403 return;
2384 2404
2385 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2405 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 if (!rect.isEmpty()) 3473 if (!rect.isEmpty())
3454 rects.append(rect); 3474 rects.append(rect);
3455 } 3475 }
3456 } 3476 }
3457 3477
3458 if (inlineElementContinuation) 3478 if (inlineElementContinuation)
3459 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows); 3479 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows);
3460 } 3480 }
3461 3481
3462 } // namespace blink 3482 } // 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