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

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

Issue 1073803002: SVG doesn't recognize ch units. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased 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 7b37c161fd9f5d31a7893774fd9767157be1d57c..cf5d734742338ddeaa22f77ec30b70049c77f0be 100644
--- a/Source/core/svg/SVGLength.cpp
+++ b/Source/core/svg/SVGLength.cpp
@@ -63,6 +63,8 @@ inline const char* lengthTypeToString(SVGLengthType type)
return "pc";
case LengthTypeREMS:
return "rem";
+ case LengthTypeCHS:
+ return "ch";
}
ASSERT_NOT_REACHED();
@@ -103,8 +105,11 @@ SVGLengthType stringToLengthType(const CharType*& ptr, const CharType* end)
if (thirdChar == 'm')
type = LengthTypeREMS;
}
- } else if (firstChar == 'c' && secondChar == 'm') {
- type = LengthTypeCM;
+ } else if (firstChar == 'c') {
+ if (secondChar == 'h')
+ type = LengthTypeCHS;
+ if (secondChar == 'm')
+ type = LengthTypeCM;
} else if (firstChar == 'm' && secondChar == 'm') {
type = LengthTypeMM;
} else if (firstChar == 'i' && secondChar == 'n') {
@@ -311,6 +316,9 @@ PassRefPtrWillBeRawPtr<SVGLength> SVGLength::fromCSSPrimitiveValue(CSSPrimitiveV
case CSSPrimitiveValue::CSS_REMS:
svgType = LengthTypeREMS;
break;
+ case CSSPrimitiveValue::CSS_CHS:
+ svgType = LengthTypeCHS;
+ break;
default:
ASSERT(value->primitiveType() == CSSPrimitiveValue::CSS_PC);
svgType = LengthTypePC;
@@ -363,6 +371,9 @@ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(PassRef
case LengthTypeREMS:
cssType = CSSPrimitiveValue::CSS_REMS;
break;
+ case LengthTypeCHS:
+ cssType = CSSPrimitiveValue::CSS_CHS;
+ break;
};
return CSSPrimitiveValue::create(length->valueInSpecifiedUnits(), cssType);
@@ -416,7 +427,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 == LengthTypeREMS) && fromType != toType))
+ || (!from->isZero() && !isZero() && (fromType == LengthTypeEMS || fromType == LengthTypeEXS || fromType == LengthTypeREMS || fromType == LengthTypeCHS) && fromType != toType))
return clone();
RefPtrWillBeRawPtr<SVGLength> length = create();
@@ -428,7 +439,7 @@ PassRefPtrWillBeRawPtr<SVGLength> SVGLength::blend(PassRefPtrWillBeRawPtr<SVGLen
return length;
}
- if (fromType == toType || from->isZero() || isZero() || fromType == LengthTypeEMS || fromType == LengthTypeEXS || fromType == LengthTypeREMS) {
+ if (fromType == toType || from->isZero() || isZero() || fromType == LengthTypeEMS || fromType == LengthTypeEXS || fromType == LengthTypeREMS || fromType == LengthTypeCHS) {
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