diff --git a/layout/reftests/svg/cssComment-in-attribute-01-ref.svg b/layout/reftests/svg/cssComment-in-attribute-01-ref.svg
new file mode 100644
index 00000000000..91d0f0f3f0e
--- /dev/null
+++ b/layout/reftests/svg/cssComment-in-attribute-01-ref.svg
@@ -0,0 +1,4 @@
+
diff --git a/layout/reftests/svg/cssComment-in-attribute-01.svg b/layout/reftests/svg/cssComment-in-attribute-01.svg
new file mode 100644
index 00000000000..f14a26bc0b0
--- /dev/null
+++ b/layout/reftests/svg/cssComment-in-attribute-01.svg
@@ -0,0 +1,4 @@
+
diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list
index 8a812fa11e4..9555c39520c 100644
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -20,6 +20,7 @@ include moz-only/reftest.list
include svg-integration/reftest.list
== altGlyph-01.svg altGlyph-01-ref.svg
+== cssComment-in-attribute-01.svg cssComment-in-attribute-01-ref.svg
== clip-01.svg pass.svg
== clip-02a.svg clip-02-ref.svg
== clip-02b.svg clip-02-ref.svg
diff --git a/layout/style/nsCSSScanner.cpp b/layout/style/nsCSSScanner.cpp
index 4019b57b367..a9114eac11e 100644
--- a/layout/style/nsCSSScanner.cpp
+++ b/layout/style/nsCSSScanner.cpp
@@ -263,9 +263,7 @@ nsCSSScanner::nsCSSScanner()
: mInputStream(nsnull)
, mReadPointer(nsnull)
, mLowLevelError(NS_OK)
-#ifdef MOZ_SVG
, mSVGMode(PR_FALSE)
-#endif
#ifdef CSS_REPORT_PARSE_ERRORS
, mError(mErrorBuf, NS_ARRAY_LENGTH(mErrorBuf), 0)
#endif
@@ -783,7 +781,7 @@ nsCSSScanner::Next(nsCSSToken& aToken)
EatWhiteSpace();
return PR_TRUE;
}
- if (ch == '/') {
+ if (ch == '/' && !IsSVGMode()) {
PRInt32 nextChar = Peek();
if (nextChar == '*') {
(void) Read();
@@ -1163,7 +1161,6 @@ nsCSSScanner::ParseNumber(PRInt32 c, nsCSSToken& aToken)
}
PRBool gotE = PR_FALSE;
-#ifdef MOZ_SVG
if (IsSVGMode() && (c == 'e' || c == 'E')) {
PRInt32 nextChar = Peek();
PRInt32 expSignChar = 0;
@@ -1190,7 +1187,6 @@ nsCSSScanner::ParseNumber(PRInt32 c, nsCSSToken& aToken)
}
}
}
-#endif
nsCSSTokenType type = eCSSToken_Number;
diff --git a/layout/style/nsCSSScanner.h b/layout/style/nsCSSScanner.h
index f9dae6f239c..65fb183b678 100644
--- a/layout/style/nsCSSScanner.h
+++ b/layout/style/nsCSSScanner.h
@@ -148,7 +148,6 @@ class nsCSSScanner {
static PRBool InitGlobals();
static void ReleaseGlobals();
-#ifdef MOZ_SVG
// Set whether or not we are processing SVG
void SetSVGMode(PRBool aSVGMode) {
NS_ASSERTION(aSVGMode == PR_TRUE || aSVGMode == PR_FALSE,
@@ -159,7 +158,6 @@ class nsCSSScanner {
return mSVGMode;
}
-#endif
#ifdef CSS_REPORT_PARSE_ERRORS
void AddToError(const nsSubstring& aErrorText);
void OutputError();
@@ -238,10 +236,8 @@ protected:
nsresult mLowLevelError;
PRUint32 mLineNumber;
-#ifdef MOZ_SVG
// True if we are in SVG mode; false in "normal" CSS
PRPackedBool mSVGMode;
-#endif
#ifdef CSS_REPORT_PARSE_ERRORS
nsXPIDLCString mFileName;
nsCOMPtr mURI; // Cached so we know to not refetch mFileName