Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Unified Diff: Source/core/svg/SVGLength.cpp

Issue 1031223003: SVG doesn't recognize rem units (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixes builderror Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGLength.h ('k') | Source/core/svg/SVGLengthContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGLength.cpp
diff --git a/Source/core/svg/SVGLength.cpp b/Source/core/svg/SVGLength.cpp
index 92ca2346bb1b8c0805e1390c820fe1581dc7f206..1c37407b3be6f355b4f2c65a2cbe972992ca76fb 100644
--- a/Source/core/svg/SVGLength.cpp
+++ b/Source/core/svg/SVGLength.cpp
@@ -61,6 +61,8 @@ inline const char* lengthTypeToString(SVGLengthType type)
return "pt";
case LengthTypePC:
return "pc";
+ case LengthTypeREMS:
+ return "rem";
}
ASSERT_NOT_REACHED();
@@ -95,6 +97,12 @@ SVGLengthType stringToLengthType(const CharType*& ptr, const CharType* end)
type = LengthTypeEMS;
if (secondChar == 'x')
type = LengthTypeEXS;
+ } else if (firstChar == 'r') {
+ if (secondChar == 'e') {
+ const CharType thirdChar = *ptr++;
+ if (thirdChar == 'm')
+ type = LengthTypeREMS;
+ }
} else if (firstChar == 'c' && secondChar == 'm') {
type = LengthTypeCM;
} else if (firstChar == 'm' && secondChar == 'm') {
@@ -300,6 +308,9 @@ PassRefPtrWillBeRawPtr<SVGLength> SVGLength::fromCSSPrimitiveValue(CSSPrimitiveV
case CSSPrimitiveValue::CSS_PT:
svgType = LengthTypePT;
break;
+ case CSSPrimitiveValue::CSS_REMS:
+ svgType = LengthTypeREMS;
+ break;
default:
ASSERT(value->primitiveType() == CSSPrimitiveValue::CSS_PC);
svgType = LengthTypePC;
@@ -349,6 +360,9 @@ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(PassRef
case LengthTypePC:
cssType = CSSPrimitiveValue::CSS_PC;
break;
+ case LengthTypeREMS:
+ cssType = CSSPrimitiveValue::CSS_REMS;
+ break;
};
return CSSPrimitiveValue::create(length->valueInSpecifiedUnits(), cssType);
@@ -402,7 +416,7 @@ PassRefPtrWillBeRawPtr<SVGLength> SVGLength::blend(PassRefPtrWillBeRawPtr<SVGLen
|| toType == LengthTypeUnknown
|| (!from->isZero() && fromType != LengthTypePercentage && toType == LengthTypePercentage)
|| (!isZero() && fromType == LengthTypePercentage && toType != LengthTypePercentage)
- || (!from->isZero() && !isZero() && (fromType == LengthTypeEMS || fromType == LengthTypeEXS) && fromType != toType))
+ || (!from->isZero() && !isZero() && (fromType == LengthTypeEMS || fromType == LengthTypeEXS || fromType == LengthTypeREMS) && fromType != toType))
return clone();
RefPtrWillBeRawPtr<SVGLength> length = create();
@@ -414,7 +428,7 @@ PassRefPtrWillBeRawPtr<SVGLength> SVGLength::blend(PassRefPtrWillBeRawPtr<SVGLen
return length;
}
- if (fromType == toType || from->isZero() || isZero() || fromType == LengthTypeEMS || fromType == LengthTypeEXS) {
+ if (fromType == toType || from->isZero() || isZero() || fromType == LengthTypeEMS || fromType == LengthTypeEXS || fromType == LengthTypeREMS) {
float fromValue = from->valueInSpecifiedUnits();
float toValue = valueInSpecifiedUnits();
if (isZero())
« no previous file with comments | « Source/core/svg/SVGLength.h ('k') | Source/core/svg/SVGLengthContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698