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

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

Issue 2653123002: Changed EClear to an enum class and renamed its members (Closed)
Patch Set: Rebase Created 3 years, 10 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 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 grandchildBox->style()->hasMarginBeforeQuirk()); 2048 grandchildBox->style()->hasMarginBeforeQuirk());
2049 grandchildBlock->setHasMarginAfterQuirk( 2049 grandchildBlock->setHasMarginAfterQuirk(
2050 grandchildBox->style()->hasMarginAfterQuirk()); 2050 grandchildBox->style()->hasMarginAfterQuirk());
2051 } 2051 }
2052 } 2052 }
2053 2053
2054 // If we have a 'clear' value but also have a margin we may not actually 2054 // If we have a 'clear' value but also have a margin we may not actually
2055 // require clearance to move past any floats. If that's the case we want to be 2055 // require clearance to move past any floats. If that's the case we want to be
2056 // sure we estimate the correct position including margins after any floats 2056 // sure we estimate the correct position including margins after any floats
2057 // rather than use 'clearance' later which could give us the wrong position. 2057 // rather than use 'clearance' later which could give us the wrong position.
2058 if (grandchildBox->style()->clear() != ClearNone && 2058 if (grandchildBox->style()->clear() != EClear::kNone &&
2059 childBlockFlow->marginBeforeForChild(*grandchildBox) == 0) 2059 childBlockFlow->marginBeforeForChild(*grandchildBox) == 0)
2060 return; 2060 return;
2061 2061
2062 // Collapse the margin of the grandchild box with our own to produce an 2062 // Collapse the margin of the grandchild box with our own to produce an
2063 // estimate. 2063 // estimate.
2064 childBlockFlow->marginBeforeEstimateForChild( 2064 childBlockFlow->marginBeforeEstimateForChild(
2065 *grandchildBox, positiveMarginBefore, negativeMarginBefore, 2065 *grandchildBox, positiveMarginBefore, negativeMarginBefore,
2066 discardMarginBefore); 2066 discardMarginBefore);
2067 } 2067 }
2068 2068
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 if (!containsFloats()) 2694 if (!containsFloats())
2695 return LayoutUnit(); 2695 return LayoutUnit();
2696 2696
2697 // At least one float is present. We need to perform the clearance 2697 // At least one float is present. We need to perform the clearance
2698 // computation. 2698 // computation.
2699 EClear clear = child->style()->clear(); 2699 EClear clear = child->style()->clear();
2700 LayoutUnit logicalBottom = lowestFloatLogicalBottom(clear); 2700 LayoutUnit logicalBottom = lowestFloatLogicalBottom(clear);
2701 2701
2702 // We also clear floats if we are too big to sit on the same line as a float 2702 // We also clear floats if we are too big to sit on the same line as a float
2703 // (and wish to avoid floats by default). 2703 // (and wish to avoid floats by default).
2704 LayoutUnit result = clear != ClearNone 2704 LayoutUnit result = clear != EClear::kNone
2705 ? (logicalBottom - logicalTop).clampNegativeToZero() 2705 ? (logicalBottom - logicalTop).clampNegativeToZero()
2706 : LayoutUnit(); 2706 : LayoutUnit();
2707 if (!result && child->avoidsFloats()) { 2707 if (!result && child->avoidsFloats()) {
2708 LayoutUnit newLogicalTop = logicalTop; 2708 LayoutUnit newLogicalTop = logicalTop;
2709 LayoutRect borderBox = child->borderBoxRect(); 2709 LayoutRect borderBox = child->borderBoxRect();
2710 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = 2710 LayoutUnit childLogicalWidthAtOldLogicalTopOffset =
2711 isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); 2711 isHorizontalWritingMode() ? borderBox.width() : borderBox.height();
2712 while (true) { 2712 while (true) {
2713 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = 2713 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset =
2714 availableLogicalWidthForLine(newLogicalTop, DoNotIndentText, 2714 availableLogicalWidthForLine(newLogicalTop, DoNotIndentText,
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3906 if (floatingObject.isDescendant()) 3906 if (floatingObject.isDescendant())
3907 child->addOverflowFromChild( 3907 child->addOverflowFromChild(
3908 floatingObject.layoutObject(), 3908 floatingObject.layoutObject(),
3909 LayoutSize(xPositionForFloatIncludingMargin(floatingObject), 3909 LayoutSize(xPositionForFloatIncludingMargin(floatingObject),
3910 yPositionForFloatIncludingMargin(floatingObject))); 3910 yPositionForFloatIncludingMargin(floatingObject)));
3911 } 3911 }
3912 } 3912 }
3913 } 3913 }
3914 3914
3915 LayoutUnit LayoutBlockFlow::lowestFloatLogicalBottom(EClear clear) const { 3915 LayoutUnit LayoutBlockFlow::lowestFloatLogicalBottom(EClear clear) const {
3916 if (clear == ClearNone || !m_floatingObjects) 3916 if (clear == EClear::kNone || !m_floatingObjects)
3917 return LayoutUnit(); 3917 return LayoutUnit();
3918 3918
3919 FloatingObject::Type floatType = 3919 FloatingObject::Type floatType = clear == EClear::kLeft
3920 clear == ClearLeft ? FloatingObject::FloatLeft 3920 ? FloatingObject::FloatLeft
3921 : clear == ClearRight ? FloatingObject::FloatRight 3921 : clear == EClear::kRight
3922 : FloatingObject::FloatLeftRight; 3922 ? FloatingObject::FloatRight
3923 : FloatingObject::FloatLeftRight;
3923 return m_floatingObjects->lowestFloatLogicalBottom(floatType); 3924 return m_floatingObjects->lowestFloatLogicalBottom(floatType);
3924 } 3925 }
3925 3926
3926 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow( 3927 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow(
3927 LayoutUnit logicalHeight) const { 3928 LayoutUnit logicalHeight) const {
3928 if (!m_floatingObjects) 3929 if (!m_floatingObjects)
3929 return logicalHeight; 3930 return logicalHeight;
3930 return m_floatingObjects->findNextFloatLogicalBottomBelow(logicalHeight); 3931 return m_floatingObjects->findNextFloatLogicalBottomBelow(logicalHeight);
3931 } 3932 }
3932 3933
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4601 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4601 } 4602 }
4602 4603
4603 void LayoutBlockFlow::invalidateDisplayItemClients( 4604 void LayoutBlockFlow::invalidateDisplayItemClients(
4604 PaintInvalidationReason invalidationReason) const { 4605 PaintInvalidationReason invalidationReason) const {
4605 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4606 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4606 invalidationReason); 4607 invalidationReason);
4607 } 4608 }
4608 4609
4609 } // namespace blink 4610 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698