OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return result; | 126 return result; |
127 } | 127 } |
128 | 128 |
129 SVGParsingError SVGLength::setValueAsString(const String& string) | 129 SVGParsingError SVGLength::setValueAsString(const String& string) |
130 { | 130 { |
131 if (string.isEmpty()) { | 131 if (string.isEmpty()) { |
132 m_value = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::User
Units); | 132 m_value = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::User
Units); |
133 return SVGParseStatus::NoError; | 133 return SVGParseStatus::NoError; |
134 } | 134 } |
135 | 135 |
136 CSSParserContext svgParserContext(SVGAttributeMode, 0); | 136 CSSParserContext svgParserContext(SVGAttributeMode, nullptr); |
137 CSSValue* parsed = CSSParser::parseSingleValue(CSSPropertyX, string, svgPars
erContext); | 137 CSSValue* parsed = CSSParser::parseSingleValue(CSSPropertyX, string, svgPars
erContext); |
138 if (!parsed || !parsed->isPrimitiveValue()) | 138 if (!parsed || !parsed->isPrimitiveValue()) |
139 return SVGParseStatus::ExpectedLength; | 139 return SVGParseStatus::ExpectedLength; |
140 | 140 |
141 CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed); | 141 CSSPrimitiveValue* newValue = toCSSPrimitiveValue(parsed); |
142 // TODO(fs): Enable calc for SVG lengths | 142 // TODO(fs): Enable calc for SVG lengths |
143 if (newValue->isCalculated() || !isSupportedCSSUnitType(newValue->typeWithCa
lcResolved())) | 143 if (newValue->isCalculated() || !isSupportedCSSUnitType(newValue->typeWithCa
lcResolved())) |
144 return SVGParseStatus::ExpectedLength; | 144 return SVGParseStatus::ExpectedLength; |
145 | 145 |
146 m_value = newValue; | 146 m_value = newValue; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context
Element) | 257 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context
Element) |
258 { | 258 { |
259 SVGLengthContext lengthContext(contextElement); | 259 SVGLengthContext lengthContext(contextElement); |
260 SVGLength* toLength = toSVGLength(toValue); | 260 SVGLength* toLength = toSVGLength(toValue); |
261 | 261 |
262 return fabsf(toLength->value(lengthContext) - value(lengthContext)); | 262 return fabsf(toLength->value(lengthContext) - value(lengthContext)); |
263 } | 263 } |
264 | 264 |
265 } // namespace blink | 265 } // namespace blink |
OLD | NEW |