From 46d0e5ab367332ff4b31647e455807c2beab41a2 Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Sat, 27 Feb 1999 07:11:57 +0000 Subject: [PATCH] added == operator to style sides --- layout/base/src/nsStyleCoord.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/layout/base/src/nsStyleCoord.cpp b/layout/base/src/nsStyleCoord.cpp index 8b88a280084e..97aa5bec2871 100644 --- a/layout/base/src/nsStyleCoord.cpp +++ b/layout/base/src/nsStyleCoord.cpp @@ -218,6 +218,31 @@ nsStyleSides::nsStyleSides(void) nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); } +#define COMPARE_SIDE(side) \ + if ((eStyleUnit_Percent <= m##side##Unit) && (m##side##Unit < eStyleUnit_Coord)) { \ + if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \ + return PR_FALSE; \ + } \ + else { \ + if (m##side##Value.mInt != aOther.m##side##Value.mInt) \ + return PR_FALSE; \ + } + +PRBool nsStyleSides::operator==(const nsStyleSides& aOther) const +{ + if ((mLeftUnit == aOther.mLeftUnit) && + (mTopUnit == aOther.mTopUnit) && + (mRightUnit == aOther.mRightUnit) && + (mBottomUnit == aOther.mBottomUnit)) { + COMPARE_SIDE(Left); + COMPARE_SIDE(Top); + COMPARE_SIDE(Right); + COMPARE_SIDE(Bottom); + return PR_TRUE; + } + return PR_FALSE; +} + void nsStyleSides::Reset(void) { nsCRT::memset(this, 0x00, sizeof(nsStyleSides));