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

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

Issue 2511283003: Set the inline position of floats a bit later. (Closed)
Patch Set: Rebase master. No conflicts here. Created 4 years 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 | « no previous file | 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 3644 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 } 3655 }
3656 3656
3657 LayoutUnit LayoutBlockFlow::positionAndLayoutFloat( 3657 LayoutUnit LayoutBlockFlow::positionAndLayoutFloat(
3658 FloatingObject& floatingObject, 3658 FloatingObject& floatingObject,
3659 LayoutUnit logicalTopMarginEdge) { 3659 LayoutUnit logicalTopMarginEdge) {
3660 LayoutBox& child = *floatingObject.layoutObject(); 3660 LayoutBox& child = *floatingObject.layoutObject();
3661 3661
3662 // FIXME Investigate if this can be removed. crbug.com/370006 3662 // FIXME Investigate if this can be removed. crbug.com/370006
3663 child.setMayNeedPaintInvalidation(); 3663 child.setMayNeedPaintInvalidation();
3664 3664
3665 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection()
3666 ? marginStartForChild(child)
3667 : marginEndForChild(child);
3668 logicalTopMarginEdge = std::max( 3665 logicalTopMarginEdge = std::max(
3669 logicalTopMarginEdge, lowestFloatLogicalBottom(child.style()->clear())); 3666 logicalTopMarginEdge, lowestFloatLogicalBottom(child.style()->clear()));
3670 3667
3671 bool isPaginated = view()->layoutState()->isPaginated(); 3668 bool isPaginated = view()->layoutState()->isPaginated();
3672 if (isPaginated && !childrenInline()) { 3669 if (isPaginated && !childrenInline()) {
3673 // Forced breaks are inserted at class A break points. Floats may be 3670 // Forced breaks are inserted at class A break points. Floats may be
3674 // affected by a break-after value on the previous in-flow sibling. 3671 // affected by a break-after value on the previous in-flow sibling.
3675 if (LayoutBox* previousInFlowBox = child.previousInFlowSiblingBox()) { 3672 if (LayoutBox* previousInFlowBox = child.previousInFlowSiblingBox()) {
3676 logicalTopMarginEdge = applyForcedBreak(logicalTopMarginEdge, 3673 logicalTopMarginEdge = applyForcedBreak(logicalTopMarginEdge,
3677 previousInFlowBox->breakAfter()); 3674 previousInFlowBox->breakAfter());
3678 } 3675 }
3679 } 3676 }
3680 3677
3678 LayoutUnit marginBefore = marginBeforeForChild(child);
3679 LayoutUnit marginAfter = marginAfterForChild(child);
3681 LayoutPoint floatLogicalLocation = 3680 LayoutPoint floatLogicalLocation =
3682 computeLogicalLocationForFloat(floatingObject, logicalTopMarginEdge); 3681 computeLogicalLocationForFloat(floatingObject, logicalTopMarginEdge);
3683 logicalTopMarginEdge = floatLogicalLocation.y(); 3682 logicalTopMarginEdge = floatLogicalLocation.y();
3684 3683
3685 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 3684 setLogicalTopForChild(child, logicalTopMarginEdge + marginBefore);
3686
3687 setLogicalLeftForChild(child,
3688 floatLogicalLocation.x() + childLogicalLeftMargin);
3689 setLogicalTopForChild(child,
3690 logicalTopMarginEdge + marginBeforeForChild(child));
3691 3685
3692 SubtreeLayoutScope layoutScope(child); 3686 SubtreeLayoutScope layoutScope(child);
3693 if (!child.needsLayout()) 3687 if (!child.needsLayout())
3694 markChildForPaginationRelayoutIfNeeded(child, layoutScope); 3688 markChildForPaginationRelayoutIfNeeded(child, layoutScope);
3695 3689
3696 child.layoutIfNeeded(); 3690 child.layoutIfNeeded();
3697 3691
3698 if (isPaginated) { 3692 if (isPaginated) {
3699 LayoutUnit newLogicalTopMarginEdge = 3693 LayoutUnit newLogicalTopMarginEdge =
3700 adjustFloatLogicalTopForPagination(child, logicalTopMarginEdge); 3694 adjustFloatLogicalTopForPagination(child, logicalTopMarginEdge);
3701 if (logicalTopMarginEdge != newLogicalTopMarginEdge) { 3695 if (logicalTopMarginEdge != newLogicalTopMarginEdge) {
3702 floatLogicalLocation = computeLogicalLocationForFloat( 3696 floatLogicalLocation = computeLogicalLocationForFloat(
3703 floatingObject, newLogicalTopMarginEdge); 3697 floatingObject, newLogicalTopMarginEdge);
3704 logicalTopMarginEdge = floatLogicalLocation.y(); 3698 logicalTopMarginEdge = floatLogicalLocation.y();
3705 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 3699 setLogicalTopForChild(child, logicalTopMarginEdge + marginBefore);
3706
3707 setLogicalLeftForChild(child,
3708 floatLogicalLocation.x() + childLogicalLeftMargin);
3709 setLogicalTopForChild(child,
3710 logicalTopMarginEdge + marginBeforeForChild(child));
3711 3700
3712 if (child.isLayoutBlock()) 3701 if (child.isLayoutBlock())
3713 child.setChildNeedsLayout(MarkOnlyThis); 3702 child.setChildNeedsLayout(MarkOnlyThis);
3714 child.layoutIfNeeded(); 3703 child.layoutIfNeeded();
3715 } 3704 }
3716 } 3705 }
3717 3706
3707 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection()
3708 ? marginStartForChild(child)
3709 : marginEndForChild(child);
3710 setLogicalLeftForChild(child,
3711 floatLogicalLocation.x() + childLogicalLeftMargin);
3712 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x());
3718 setLogicalTopForFloat(floatingObject, logicalTopMarginEdge); 3713 setLogicalTopForFloat(floatingObject, logicalTopMarginEdge);
3719
3720 setLogicalHeightForFloat(floatingObject, logicalHeightForChild(child) + 3714 setLogicalHeightForFloat(floatingObject, logicalHeightForChild(child) +
3721 marginBeforeForChild(child) + 3715 marginBefore + marginAfter);
3722 marginAfterForChild(child));
3723 3716
3724 if (ShapeOutsideInfo* shapeOutside = child.shapeOutsideInfo()) 3717 if (ShapeOutsideInfo* shapeOutside = child.shapeOutsideInfo())
3725 shapeOutside->setReferenceBoxLogicalSize(logicalSizeForChild(child)); 3718 shapeOutside->setReferenceBoxLogicalSize(logicalSizeForChild(child));
3726 3719
3727 return logicalTopMarginEdge; 3720 return logicalTopMarginEdge;
3728 } 3721 }
3729 3722
3730 bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox) { 3723 bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox) {
3731 if (!m_floatingObjects || !parent()) 3724 if (!m_floatingObjects || !parent())
3732 return false; 3725 return false;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4545 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4538 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4546 } 4539 }
4547 4540
4548 void LayoutBlockFlow::invalidateDisplayItemClients( 4541 void LayoutBlockFlow::invalidateDisplayItemClients(
4549 PaintInvalidationReason invalidationReason) const { 4542 PaintInvalidationReason invalidationReason) const {
4550 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4543 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4551 invalidationReason); 4544 invalidationReason);
4552 } 4545 }
4553 4546
4554 } // namespace blink 4547 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698