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

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

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 unified diff | Download patch
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/svg/SVGLength.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 PassRefPtrWillBeRawPtr<SVGLength> clone() const; 50 PassRefPtrWillBeRawPtr<SVGLength> clone() const;
51 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri ng&) const override; 51 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri ng&) const override;
52 52
53 SVGLengthType unitType() const { return static_cast<SVGLengthType>(m_unitTyp e); } 53 SVGLengthType unitType() const { return static_cast<SVGLengthType>(m_unitTyp e); }
54 CSSPrimitiveValue::UnitType cssUnitTypeQuirk() const 54 CSSPrimitiveValue::UnitType cssUnitTypeQuirk() const
55 { 55 {
56 if (m_unitType == LengthTypeNumber) 56 if (m_unitType == LengthTypeNumber)
57 return CSSPrimitiveValue::UnitType::CSS_PX; 57 return CSSPrimitiveValue::UnitType::CSS_PX;
58
59 if (m_unitType == LengthTypeREMS)
60 return CSSPrimitiveValue::UnitType::CSS_REMS;
61
58 return static_cast<CSSPrimitiveValue::UnitType>(m_unitType); 62 return static_cast<CSSPrimitiveValue::UnitType>(m_unitType);
59 } 63 }
60 void setUnitType(SVGLengthType); 64 void setUnitType(SVGLengthType);
61 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod e); } 65 SVGLengthMode unitMode() const { return static_cast<SVGLengthMode>(m_unitMod e); }
62 66
63 bool operator==(const SVGLength&) const; 67 bool operator==(const SVGLength&) const;
64 bool operator!=(const SVGLength& other) const { return !operator==(other); } 68 bool operator!=(const SVGLength& other) const { return !operator==(other); }
65 69
66 float value(const SVGLengthContext&) const; 70 float value(const SVGLengthContext&) const;
67 void setValue(float, const SVGLengthContext&); 71 void setValue(float, const SVGLengthContext&);
(...skipping 14 matching lines...) Expand all
82 void setValueAsString(const String&, ExceptionState&); 86 void setValueAsString(const String&, ExceptionState&);
83 87
84 void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits); 88 void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits);
85 void convertToSpecifiedUnits(SVGLengthType, const SVGLengthContext&); 89 void convertToSpecifiedUnits(SVGLengthType, const SVGLengthContext&);
86 90
87 // Helper functions 91 // Helper functions
88 static inline bool isRelativeUnit(SVGLengthType unitType) 92 static inline bool isRelativeUnit(SVGLengthType unitType)
89 { 93 {
90 return unitType == LengthTypePercentage 94 return unitType == LengthTypePercentage
91 || unitType == LengthTypeEMS 95 || unitType == LengthTypeEMS
92 || unitType == LengthTypeEXS; 96 || unitType == LengthTypeEXS
97 || unitType == LengthTypeREMS;
93 } 98 }
94 inline bool isRelative() const { return isRelativeUnit(unitType()); } 99 inline bool isRelative() const { return isRelativeUnit(unitType()); }
95 100
96 bool isZero() const 101 bool isZero() const
97 { 102 {
98 return !m_valueInSpecifiedUnits; 103 return !m_valueInSpecifiedUnits;
99 } 104 }
100 105
101 static PassRefPtrWillBeRawPtr<SVGLength> fromCSSPrimitiveValue(CSSPrimitiveV alue*); 106 static PassRefPtrWillBeRawPtr<SVGLength> fromCSSPrimitiveValue(CSSPrimitiveV alue*);
102 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(PassRef PtrWillBeRawPtr<SVGLength>); 107 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> toCSSPrimitiveValue(PassRef PtrWillBeRawPtr<SVGLength>);
(...skipping 19 matching lines...) Expand all
122 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP ropertyBase> passBase) 127 inline PassRefPtrWillBeRawPtr<SVGLength> toSVGLength(PassRefPtrWillBeRawPtr<SVGP ropertyBase> passBase)
123 { 128 {
124 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; 129 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase;
125 ASSERT(base->type() == SVGLength::classType()); 130 ASSERT(base->type() == SVGLength::classType());
126 return static_pointer_cast<SVGLength>(base.release()); 131 return static_pointer_cast<SVGLength>(base.release());
127 } 132 }
128 133
129 } // namespace blink 134 } // namespace blink
130 135
131 #endif // SVGLength_h 136 #endif // SVGLength_h
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/svg/SVGLength.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698