commit ab46441
Author: Graeme McCutcheon <graememcc_firefox@graeme-online.co.uk>
Date:   Thu Jan 10 14:37:30 2013 +0000

    Bug 827521 - Work around spurious operator ambiguity errors in buggy versions of Clang. r=longsonr
---
 .../svg/content/src/SVGAnimatedPreserveAspectRatio.cpp  | 17 ++++++++---------
 .../svg/content/src/SVGAnimatedPreserveAspectRatio.h    |  7 +++----
 content/svg/content/src/SVGPreserveAspectRatio.h        | 17 +++++++++++++----
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git content/svg/content/src/SVGAnimatedPreserveAspectRatio.cpp content/svg/content/src/SVGAnimatedPreserveAspectRatio.cpp
index 6593461..56956b2 100644
--- content/svg/content/src/SVGAnimatedPreserveAspectRatio.cpp
+++ content/svg/content/src/SVGAnimatedPreserveAspectRatio.cpp
@@ -54,7 +54,7 @@ GetAlignForString(const nsAString &aAlignString)
 {
   for (uint32_t i = 0 ; i < ArrayLength(sAlignStrings) ; i++) {
     if (aAlignString.EqualsASCII(sAlignStrings[i])) {
-      return (i + SVG_PRESERVEASPECTRATIO_NONE);
+      return (i + SVG_ALIGN_MIN_VALID);
     }
   }
 
@@ -65,12 +65,11 @@ static void
 GetAlignString(nsAString& aAlignString, uint16_t aAlign)
 {
   NS_ASSERTION(
-    aAlign >= SVG_PRESERVEASPECTRATIO_NONE &&
-    aAlign <= SVG_PRESERVEASPECTRATIO_XMAXYMAX,
+    aAlign >= SVG_ALIGN_MIN_VALID && aAlign <= SVG_ALIGN_MAX_VALID,
     "Unknown align");
 
   aAlignString.AssignASCII(
-    sAlignStrings[aAlign - SVG_PRESERVEASPECTRATIO_NONE]);
+    sAlignStrings[aAlign - SVG_ALIGN_MIN_VALID]);
 }
 
 static uint16_t
@@ -78,7 +77,7 @@ GetMeetOrSliceForString(const nsAString &aMeetOrSlice)
 {
   for (uint32_t i = 0 ; i < ArrayLength(sMeetOrSliceStrings) ; i++) {
     if (aMeetOrSlice.EqualsASCII(sMeetOrSliceStrings[i])) {
-      return (i + SVG_MEETORSLICE_MEET);
+      return (i + SVG_MEETORSLICE_MIN_VALID);
     }
   }
 
@@ -89,12 +88,12 @@ static void
 GetMeetOrSliceString(nsAString& aMeetOrSliceString, uint16_t aMeetOrSlice)
 {
   NS_ASSERTION(
-    aMeetOrSlice >= SVG_MEETORSLICE_MEET &&
-    aMeetOrSlice <= SVG_MEETORSLICE_SLICE,
+    aMeetOrSlice >= SVG_MEETORSLICE_MIN_VALID &&
+    aMeetOrSlice <= SVG_MEETORSLICE_MAX_VALID,
     "Unknown meetOrSlice");
 
   aMeetOrSliceString.AssignASCII(
-    sMeetOrSliceStrings[aMeetOrSlice - SVG_MEETORSLICE_MEET]);
+    sMeetOrSliceStrings[aMeetOrSlice - SVG_MEETORSLICE_MIN_VALID]);
 }
 
 already_AddRefed<DOMSVGPreserveAspectRatio>
@@ -226,7 +225,7 @@ SVGAnimatedPreserveAspectRatio::GetBaseValueString(
   GetAlignString(tmpString, mBaseVal.mAlign);
   aValueAsString.Append(tmpString);
 
-  if (mBaseVal.mAlign != SVG_PRESERVEASPECTRATIO_NONE) {
+  if (mBaseVal.mAlign != uint8_t(SVG_PRESERVEASPECTRATIO_NONE)) {
 
     aValueAsString.AppendLiteral(" ");
     GetMeetOrSliceString(tmpString, mBaseVal.mMeetOrSlice);
diff --git content/svg/content/src/SVGAnimatedPreserveAspectRatio.h content/svg/content/src/SVGAnimatedPreserveAspectRatio.h
index 61cfba7..b08fb60 100644
--- content/svg/content/src/SVGAnimatedPreserveAspectRatio.h
+++ content/svg/content/src/SVGAnimatedPreserveAspectRatio.h
@@ -42,8 +42,7 @@ public:
   void SetBaseValue(const SVGPreserveAspectRatio &aValue,
                     nsSVGElement *aSVGElement);
   nsresult SetBaseAlign(uint16_t aAlign, nsSVGElement *aSVGElement) {
-    if (aAlign < SVG_PRESERVEASPECTRATIO_NONE ||
-        aAlign > SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
+    if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID) {
       return NS_ERROR_FAILURE;
     }
     SetBaseValue(SVGPreserveAspectRatio(
@@ -53,8 +52,8 @@ public:
     return NS_OK;
   }
   nsresult SetBaseMeetOrSlice(uint16_t aMeetOrSlice, nsSVGElement *aSVGElement) {
-    if (aMeetOrSlice < SVG_MEETORSLICE_MEET ||
-        aMeetOrSlice > SVG_MEETORSLICE_SLICE) {
+    if (aMeetOrSlice < SVG_MEETORSLICE_MIN_VALID ||
+        aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID) {
       return NS_ERROR_FAILURE;
     }
     SetBaseValue(SVGPreserveAspectRatio(
diff --git content/svg/content/src/SVGPreserveAspectRatio.h content/svg/content/src/SVGPreserveAspectRatio.h
index 066ad52..ebe724e 100644
--- content/svg/content/src/SVGPreserveAspectRatio.h
+++ content/svg/content/src/SVGPreserveAspectRatio.h
@@ -28,6 +28,11 @@ enum SVGAlign MOZ_ENUM_TYPE(uint8_t) {
   SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
 };
 
+// These constants represent the range of valid enum values for the <align>
+// parameter. They exclude the sentinel _UNKNOWN value.
+const uint16_t SVG_ALIGN_MIN_VALID = SVG_PRESERVEASPECTRATIO_NONE;
+const uint16_t SVG_ALIGN_MAX_VALID = SVG_PRESERVEASPECTRATIO_XMAXYMAX;
+
 // Meet-or-slice Types
 enum SVGMeetOrSlice MOZ_ENUM_TYPE(uint8_t) {
   SVG_MEETORSLICE_UNKNOWN = 0,
@@ -35,6 +40,11 @@ enum SVGMeetOrSlice MOZ_ENUM_TYPE(uint8_t) {
   SVG_MEETORSLICE_SLICE = 2
 };
 
+// These constants represent the range of valid enum values for the
+// <meetOrSlice> parameter. They exclude the sentinel _UNKNOWN value.
+const uint16_t SVG_MEETORSLICE_MIN_VALID = SVG_MEETORSLICE_MEET;
+const uint16_t SVG_MEETORSLICE_MAX_VALID = SVG_MEETORSLICE_SLICE;
+
 class SVGAnimatedPreserveAspectRatio;
 
 class SVGPreserveAspectRatio MOZ_FINAL
@@ -57,8 +67,7 @@ public:
   {}
 
   nsresult SetAlign(uint16_t aAlign) {
-    if (aAlign < SVG_PRESERVEASPECTRATIO_NONE ||
-        aAlign > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
+    if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID)
       return NS_ERROR_FAILURE;
     mAlign = static_cast<uint8_t>(aAlign);
     return NS_OK;
@@ -69,8 +78,8 @@ public:
   }
 
   nsresult SetMeetOrSlice(uint16_t aMeetOrSlice) {
-    if (aMeetOrSlice < SVG_MEETORSLICE_MEET ||
-        aMeetOrSlice > SVG_MEETORSLICE_SLICE)
+    if (aMeetOrSlice < SVG_MEETORSLICE_MIN_VALID ||
+        aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID)
       return NS_ERROR_FAILURE;
     mMeetOrSlice = static_cast<uint8_t>(aMeetOrSlice);
     return NS_OK;
