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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGLength.h

Issue 1544673003: Refactor propagation of parsing errors for SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef SVGLength_h 21 #ifndef SVGLength_h
22 #define SVGLength_h 22 #define SVGLength_h
23 23
24 #include "core/css/CSSPrimitiveValue.h" 24 #include "core/css/CSSPrimitiveValue.h"
25 #include "core/svg/SVGLengthContext.h" 25 #include "core/svg/SVGLengthContext.h"
26 #include "core/svg/SVGParsingError.h"
26 #include "core/svg/properties/SVGProperty.h" 27 #include "core/svg/properties/SVGProperty.h"
27 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
28 29
29 namespace blink { 30 namespace blink {
30 31
31 class ExceptionState;
32 class QualifiedName; 32 class QualifiedName;
33 33
34 class SVGLengthTearOff; 34 class SVGLengthTearOff;
35 35
36 class SVGLength final : public SVGPropertyBase { 36 class SVGLength final : public SVGPropertyBase {
37 public: 37 public:
38 typedef SVGLengthTearOff TearOffType; 38 typedef SVGLengthTearOff TearOffType;
39 39
40 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = SVGLeng thMode::Other) 40 static PassRefPtrWillBeRawPtr<SVGLength> create(SVGLengthMode mode = SVGLeng thMode::Other)
41 { 41 {
(...skipping 26 matching lines...) Expand all
68 // Resolves LengthTypePercentage into a normalized floating point number (fu ll value is 1.0). 68 // Resolves LengthTypePercentage into a normalized floating point number (fu ll value is 1.0).
69 float valueAsPercentage() const; 69 float valueAsPercentage() const;
70 70
71 // Returns a number to be used as percentage (so full value is 100) 71 // Returns a number to be used as percentage (so full value is 100)
72 float valueAsPercentage100() const; 72 float valueAsPercentage100() const;
73 73
74 // Scale the input value by this SVGLength. Higher precision than input * va lueAsPercentage(). 74 // Scale the input value by this SVGLength. Higher precision than input * va lueAsPercentage().
75 float scaleByPercentage(float) const; 75 float scaleByPercentage(float) const;
76 76
77 String valueAsString() const override; 77 String valueAsString() const override;
78 void setValueAsString(const String&, ExceptionState&); 78 SVGParsingError setValueAsString(const String&);
79 79
80 void newValueSpecifiedUnits(CSSPrimitiveValue::UnitType, float valueInSpecif iedUnits); 80 void newValueSpecifiedUnits(CSSPrimitiveValue::UnitType, float valueInSpecif iedUnits);
81 void convertToSpecifiedUnits(CSSPrimitiveValue::UnitType, const SVGLengthCon text&); 81 void convertToSpecifiedUnits(CSSPrimitiveValue::UnitType, const SVGLengthCon text&);
82 82
83 // Helper functions 83 // Helper functions
84 static inline bool isRelativeUnit(CSSPrimitiveValue::UnitType unitType) 84 static inline bool isRelativeUnit(CSSPrimitiveValue::UnitType unitType)
85 { 85 {
86 return unitType == CSSPrimitiveValue::UnitType::Percentage 86 return unitType == CSSPrimitiveValue::UnitType::Percentage
87 || unitType == CSSPrimitiveValue::UnitType::Ems 87 || unitType == CSSPrimitiveValue::UnitType::Ems
88 || unitType == CSSPrimitiveValue::UnitType::Exs 88 || unitType == CSSPrimitiveValue::UnitType::Exs
(...skipping 22 matching lines...) Expand all
111 111
112 RefPtrWillBeMember<CSSPrimitiveValue> m_value; 112 RefPtrWillBeMember<CSSPrimitiveValue> m_value;
113 unsigned m_unitMode : 2; 113 unsigned m_unitMode : 2;
114 }; 114 };
115 115
116 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength); 116 DEFINE_SVG_PROPERTY_TYPE_CASTS(SVGLength);
117 117
118 } // namespace blink 118 } // namespace blink
119 119
120 #endif // SVGLength_h 120 #endif // SVGLength_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698