From f2715a3d9737c7b78cdd09f9f4c86432bfb28788 Mon Sep 17 00:00:00 2001 From: "bmlk%gmx.de" Date: Sat, 8 Mar 2008 09:12:30 +0000 Subject: [PATCH] There is no height greater than unconstrained height, bug 402872, r/sr=roc a=beltzner --- gfx/public/nsCoord.h | 23 +++++++++++++++++++++++ layout/generic/nsBlockReflowState.cpp | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gfx/public/nsCoord.h b/gfx/public/nsCoord.h index 71f68f62aa3..d483c8922f6 100644 --- a/gfx/public/nsCoord.h +++ b/gfx/public/nsCoord.h @@ -220,6 +220,29 @@ NSCoordSaturatingSubtract(nscoord a, nscoord b, } #endif } +/** compare against a nscoord "b", which might be unconstrained + * "a" must not be unconstrained. + * Every number is smaller than a unconstrained one + */ +inline PRBool +NSCoordLessThan(nscoord a,nscoord b) +{ + NS_ASSERTION(a != nscoord_MAX, + "This coordinate should be constrained"); + return ((a < b) || (b == nscoord_MAX)); +} + +/** compare against a nscoord "b", which might be unconstrained + * "a" must not be unconstrained + * No number is larger than a unconstrained one. + */ +inline PRBool +NSCoordGreaterThan(nscoord a,nscoord b) +{ + NS_ASSERTION(a != nscoord_MAX, + "This coordinate should be constrained"); + return ((a > b) && (b != nscoord_MAX)); +} /** * Convert an nscoord to a PRInt32. This *does not* do rounding because diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 02b4d64e40b..30a62ccb38b 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -635,7 +635,7 @@ nsBlockReflowState::CanPlaceFloat(const nsSize& aFloatSize, // At this point we know that there is enough horizontal space for // the float (somewhere). Lets see if there is enough vertical // space. - if (mAvailSpaceRect.height < aFloatSize.height) { + if (NSCoordGreaterThan(aFloatSize.height, mAvailSpaceRect.height)) { // The available height is too short. However, its possible that // there is enough open space below which is not impacted by a // float.