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

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

Issue 1393533002: Clear floats that are nested in previous siblings and don't overhang. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 years, 2 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 updateLogicalHeight(); 422 updateLogicalHeight();
423 LayoutUnit newHeight = logicalHeight(); 423 LayoutUnit newHeight = logicalHeight();
424 if (!childrenInline()) { 424 if (!childrenInline()) {
425 LayoutBlockFlow* lowestBlock = nullptr; 425 LayoutBlockFlow* lowestBlock = nullptr;
426 bool addedOverhangingFloats = false; 426 bool addedOverhangingFloats = false;
427 // One of our children's floats may have become an overhanging float for us. 427 // One of our children's floats may have become an overhanging float for us.
428 for (LayoutObject* child = lastChild(); child; child = child->previousSi bling()) { 428 for (LayoutObject* child = lastChild(); child; child = child->previousSi bling()) {
429 // TODO(robhogan): We should exclude blocks that create formatting c ontexts, not just out of flow or floating blocks. 429 // TODO(robhogan): We should exclude blocks that create formatting c ontexts, not just out of flow or floating blocks.
430 if (child->isLayoutBlockFlow() && !child->isFloatingOrOutOfFlowPosit ioned()) { 430 if (child->isLayoutBlockFlow() && !child->isFloatingOrOutOfFlowPosit ioned()) {
431 LayoutBlockFlow* block = toLayoutBlockFlow(child); 431 LayoutBlockFlow* block = toLayoutBlockFlow(child);
432 if (!block->containsFloats())
433 continue;
432 lowestBlock = block; 434 lowestBlock = block;
433 if (oldHeight <= newHeight || block->lowestFloatLogicalBottom() + block->logicalTop() <= newHeight) 435 if (oldHeight <= newHeight || block->lowestFloatLogicalBottom() + block->logicalTop() <= newHeight)
434 break; 436 break;
435 addOverhangingFloats(block, false); 437 addOverhangingFloats(block, false);
436 addedOverhangingFloats = true; 438 addedOverhangingFloats = true;
437 } 439 }
438 } 440 }
441 // If we have no overhanging floats we still pass a record of the lowest non-overhanging float up the tree so we can enclose it if
442 // we are a formatting context and allow siblings to avoid it if they ha ve negative margin and find themselves in its vicinity.
439 if (!addedOverhangingFloats) 443 if (!addedOverhangingFloats)
440 addLowestFloatFromChildren(lowestBlock); 444 addLowestFloatFromChildren(lowestBlock);
441 } 445 }
442 446
443 bool heightChanged = (previousHeight != newHeight); 447 bool heightChanged = (previousHeight != newHeight);
444 if (heightChanged) 448 if (heightChanged)
445 relayoutChildren = true; 449 relayoutChildren = true;
446 450
447 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); 451 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout);
448 452
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 FrameView* frameView = document().view(); 3090 FrameView* frameView = document().view();
3087 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3091 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3088 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3092 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3089 if (size().height() < visibleHeight) 3093 if (size().height() < visibleHeight)
3090 top += (visibleHeight - size().height()) / 2; 3094 top += (visibleHeight - size().height()) / 2;
3091 setY(top); 3095 setY(top);
3092 dialog->setCentered(top); 3096 dialog->setCentered(top);
3093 } 3097 }
3094 3098
3095 } // namespace blink 3099 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698