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

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

Issue 1937043002: Remove the LayoutSVGInlineText* context in SVGTextLayoutAttributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef SVGTextLayoutAttributes_h 20 #ifndef SVGCharacterData_h
21 #define SVGTextLayoutAttributes_h 21 #define SVGCharacterData_h
22 22
23 #include "wtf/Allocator.h" 23 #include "wtf/Allocator.h"
24 #include "wtf/HashMap.h" 24 #include "wtf/HashMap.h"
25 #include "wtf/MathExtras.h" 25 #include "wtf/MathExtras.h"
26 #include "wtf/Noncopyable.h"
27 26
28 namespace blink { 27 namespace blink {
29 28
30 class LayoutSVGInlineText;
31
32 struct SVGCharacterData { 29 struct SVGCharacterData {
33 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 30 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
34 SVGCharacterData(); 31 SVGCharacterData();
35 32
36 static float emptyValue() { return std::numeric_limits<float>::quiet_NaN(); } 33 static float emptyValue() { return std::numeric_limits<float>::quiet_NaN(); }
37 static bool isEmptyValue(float value) { return std::isnan(value); } 34 static bool isEmptyValue(float value) { return std::isnan(value); }
38 35
39 bool hasX() const { return !isEmptyValue(x); } 36 bool hasX() const { return !isEmptyValue(x); }
40 bool hasY() const { return !isEmptyValue(y); } 37 bool hasY() const { return !isEmptyValue(y); }
41 bool hasDx() const { return !isEmptyValue(dx); } 38 bool hasDx() const { return !isEmptyValue(dx); }
42 bool hasDy() const { return !isEmptyValue(dy); } 39 bool hasDy() const { return !isEmptyValue(dy); }
43 bool hasRotate() const { return !isEmptyValue(rotate); } 40 bool hasRotate() const { return !isEmptyValue(rotate); }
44 41
45 float x; 42 float x;
46 float y; 43 float y;
47 float dx; 44 float dx;
48 float dy; 45 float dy;
49 float rotate; 46 float rotate;
50 }; 47 };
51 48
52 typedef HashMap<unsigned, SVGCharacterData> SVGCharacterDataMap;
53
54 class SVGTextLayoutAttributes {
55 DISALLOW_NEW();
56 WTF_MAKE_NONCOPYABLE(SVGTextLayoutAttributes);
57 public:
58 SVGTextLayoutAttributes(LayoutSVGInlineText*);
59
60 void clear();
61 static float emptyValue() { return std::numeric_limits<float>::quiet_NaN(); }
62 static bool isEmptyValue(float value) { return std::isnan(value); }
63
64 LayoutSVGInlineText* context() const { return m_context; }
65
66 SVGCharacterDataMap& characterDataMap() { return m_characterDataMap; }
67 const SVGCharacterDataMap& characterDataMap() const { return m_characterData Map; }
68
69 private:
70 LayoutSVGInlineText* m_context;
71 SVGCharacterDataMap m_characterDataMap;
72 };
73
74 inline SVGCharacterData::SVGCharacterData() 49 inline SVGCharacterData::SVGCharacterData()
75 : x(emptyValue()) 50 : x(emptyValue())
76 , y(emptyValue()) 51 , y(emptyValue())
77 , dx(emptyValue()) 52 , dx(emptyValue())
78 , dy(emptyValue()) 53 , dy(emptyValue())
79 , rotate(emptyValue()) 54 , rotate(emptyValue())
80 { 55 {
81 } 56 }
82 57
58 typedef HashMap<unsigned, SVGCharacterData> SVGCharacterDataMap;
59
83 } // namespace blink 60 } // namespace blink
84 61
85 #endif 62 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698