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

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

Issue 2097383002: Added support of calc() for SVGLength (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: third_party/WebKit/Source/core/svg/SVGLength.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGLength.cpp b/third_party/WebKit/Source/core/svg/SVGLength.cpp
index 8d66d974af40ea2aa6faf4d7a18ca2a7ebf75b5a..9dbc683313247806283dd90fbf5cd47ec7f1259f 100644
--- a/third_party/WebKit/Source/core/svg/SVGLength.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLength.cpp
@@ -86,7 +86,7 @@ void SVGLength::setValue(float value, const SVGLengthContext& context)
bool isSupportedCSSUnitType(CSSPrimitiveValue::UnitType type)
{
- return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::UnitType::Number || type == CSSPrimitiveValue::UnitType::Percentage)
+ return (CSSPrimitiveValue::isLength(type) || type == CSSPrimitiveValue::UnitType::Number || type == CSSPrimitiveValue::UnitType::Percentage || (type >= CSSPrimitiveValue::UnitType::Calc && type <= CSSPrimitiveValue::UnitType::CalcPercentageWithLengthAndNumber))
fs 2016/06/29 09:28:17 Suggest you reformat this function, to maybe make
Shanmuga Pandi 2016/07/15 12:18:22 Done.
&& type != CSSPrimitiveValue::UnitType::QuirkyEms;
}
@@ -139,8 +139,7 @@ SVGParsingError SVGLength::setValueAsString(const String& string)
return SVGParseStatus::ExpectedLength;
CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed);
- // TODO(fs): Enable calc for SVG lengths
- if (newValue->isCalculated() || !isSupportedCSSUnitType(newValue->typeWithCalcResolved()))
+ if (!isSupportedCSSUnitType(newValue->typeWithCalcResolved()))
return SVGParseStatus::ExpectedLength;
m_value = newValue;

Powered by Google App Engine
This is Rietveld 408576698