From a0a437f47c03ff51756b0948097878b4bbab1850 Mon Sep 17 00:00:00 2001 From: JerryShih Date: Sun, 16 Oct 2016 03:15:35 +0800 Subject: [PATCH] Bug 1295456 - Support percentage opacity value in CSS color functions. r=dholbert --HG-- extra : rebase_source : 79bf692da80a5ea861482e9bc021834f60b6d81a extra : histedit_source : 384f41d812fecf511be8b319d91a687e9c02673d --- dom/locales/en-US/chrome/layout/css.properties | 1 + layout/style/nsCSSParser.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/locales/en-US/chrome/layout/css.properties b/dom/locales/en-US/chrome/layout/css.properties index ecb536910caf..360fdcbcea94 100644 --- a/dom/locales/en-US/chrome/layout/css.properties +++ b/dom/locales/en-US/chrome/layout/css.properties @@ -98,6 +98,7 @@ PEColorNotColor=Expected color but found ‘%1$S’. PEColorComponentEOF=color component PEExpectedPercent=Expected a percentage but found ‘%1$S’. PEExpectedInt=Expected an integer but found ‘%1$S’. +PEExpectedNumberOrPercent=Expected a number or a percentage but found ‘%1$S’. PEColorBadRGBContents=Expected number or percentage in rgb() but found ‘%1$S’. PEColorComponentBadTerm=Expected ‘%2$S’ but found ‘%1$S’. PEColorHueEOF=hue diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index bd42ae2febd5..e11cddb72d03 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -6972,8 +6972,9 @@ CSSParserImpl::ParseColorOpacity(float& aOpacity) return false; } - if (mToken.mType != eCSSToken_Number) { - REPORT_UNEXPECTED_TOKEN(PEExpectedNumber); + // eCSSToken_Number or eCSSToken_Percentage. + if (mToken.mType != eCSSToken_Number && mToken.mType != eCSSToken_Percentage) { + REPORT_UNEXPECTED_TOKEN(PEExpectedNumberOrPercent); UngetToken(); return false; }