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

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

Issue 966923003: Make SVGLengthMode an enum class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGLength.cpp ('k') | Source/core/svg/SVGLengthContext.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) Research In Motion Limited 2011. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 26 matching lines...) Expand all
37 LengthTypeEMS, 37 LengthTypeEMS,
38 LengthTypeEXS, 38 LengthTypeEXS,
39 LengthTypePX, 39 LengthTypePX,
40 LengthTypeCM, 40 LengthTypeCM,
41 LengthTypeMM, 41 LengthTypeMM,
42 LengthTypeIN, 42 LengthTypeIN,
43 LengthTypePT, 43 LengthTypePT,
44 LengthTypePC 44 LengthTypePC
45 }; 45 };
46 46
47 enum SVGLengthMode { 47 enum class SVGLengthMode {
48 LengthModeWidth = 0, 48 Width,
49 LengthModeHeight, 49 Height,
50 LengthModeOther 50 Other
51 }; 51 };
52 52
53 class SVGLengthContext { 53 class SVGLengthContext {
54 STACK_ALLOCATED(); 54 STACK_ALLOCATED();
55 public: 55 public:
56 explicit SVGLengthContext(const SVGElement*); 56 explicit SVGLengthContext(const SVGElement*);
57 57
58 template<typename T> 58 template<typename T>
59 static FloatRect resolveRectangle(const T* context, SVGUnitTypes::SVGUnitTyp e type, const FloatRect& viewport) 59 static FloatRect resolveRectangle(const T* context, SVGUnitTypes::SVGUnitTyp e type, const FloatRect& viewport)
60 { 60 {
61 return resolveRectangle(context, type, viewport, *context->x()->currentV alue(), *context->y()->currentValue(), *context->width()->currentValue(), *conte xt->height()->currentValue()); 61 return resolveRectangle(context, type, viewport, *context->x()->currentV alue(), *context->y()->currentValue(), *context->width()->currentValue(), *conte xt->height()->currentValue());
62 } 62 }
63 63
64 static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitTy pe, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVG Length& width, const SVGLength& height); 64 static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitTy pe, const FloatRect& viewport, const SVGLength& x, const SVGLength& y, const SVG Length& width, const SVGLength& height);
65 static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength& x, const SVGLength& y); 65 static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength& x, const SVGLength& y);
66 static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, con st SVGLength&); 66 static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, con st SVGLength&);
67 67
68 float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit) const; 68 float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit) const;
69 float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit) const; 69 float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit) const;
70 70
71 float valueForLength(const Length&, const LayoutStyle&, SVGLengthMode = Leng thModeOther) const; 71 float valueForLength(const Length&, const LayoutStyle&, SVGLengthMode = SVGL engthMode::Other) const;
72 72
73 bool determineViewport(FloatSize&) const; 73 bool determineViewport(FloatSize&) const;
74 74
75 private: 75 private:
76 float valueForLengthWithZoom(const Length&, float, SVGLengthMode) const; 76 float valueForLengthWithZoom(const Length&, float, SVGLengthMode) const;
77 77
78 float convertValueFromUserUnitsToEMS(float value) const; 78 float convertValueFromUserUnitsToEMS(float value) const;
79 float convertValueFromEMSToUserUnits(float value) const; 79 float convertValueFromEMSToUserUnits(float value) const;
80 80
81 float convertValueFromUserUnitsToEXS(float value) const; 81 float convertValueFromUserUnitsToEXS(float value) const;
82 float convertValueFromEXSToUserUnits(float value) const; 82 float convertValueFromEXSToUserUnits(float value) const;
83 83
84 RawPtrWillBeMember<const SVGElement> m_context; 84 RawPtrWillBeMember<const SVGElement> m_context;
85 }; 85 };
86 86
87 } // namespace blink 87 } // namespace blink
88 88
89 #endif // SVGLengthContext_h 89 #endif // SVGLengthContext_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGLength.cpp ('k') | Source/core/svg/SVGLengthContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698