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

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

Issue 1933183002: Move isEmptyValue and emptyValue to SVGCharacterData (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
(...skipping 15 matching lines...) Expand all
26 #include "wtf/Noncopyable.h" 26 #include "wtf/Noncopyable.h"
27 27
28 namespace blink { 28 namespace blink {
29 29
30 class LayoutSVGInlineText; 30 class LayoutSVGInlineText;
31 31
32 struct SVGCharacterData { 32 struct SVGCharacterData {
33 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 33 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
34 SVGCharacterData(); 34 SVGCharacterData();
35 35
36 static float emptyValue() { return std::numeric_limits<float>::quiet_NaN(); }
37 static bool isEmptyValue(float value) { return std::isnan(value); }
38
39 bool hasX() const { return !isEmptyValue(x); }
40 bool hasY() const { return !isEmptyValue(y); }
41 bool hasDx() const { return !isEmptyValue(dx); }
42 bool hasDy() const { return !isEmptyValue(dy); }
43 bool hasRotate() const { return !isEmptyValue(rotate); }
44
36 float x; 45 float x;
37 float y; 46 float y;
38 float dx; 47 float dx;
39 float dy; 48 float dy;
40 float rotate; 49 float rotate;
41 }; 50 };
42 51
43 typedef HashMap<unsigned, SVGCharacterData> SVGCharacterDataMap; 52 typedef HashMap<unsigned, SVGCharacterData> SVGCharacterDataMap;
44 53
45 class SVGTextLayoutAttributes { 54 class SVGTextLayoutAttributes {
(...skipping 10 matching lines...) Expand all
56 65
57 SVGCharacterDataMap& characterDataMap() { return m_characterDataMap; } 66 SVGCharacterDataMap& characterDataMap() { return m_characterDataMap; }
58 const SVGCharacterDataMap& characterDataMap() const { return m_characterData Map; } 67 const SVGCharacterDataMap& characterDataMap() const { return m_characterData Map; }
59 68
60 private: 69 private:
61 LayoutSVGInlineText* m_context; 70 LayoutSVGInlineText* m_context;
62 SVGCharacterDataMap m_characterDataMap; 71 SVGCharacterDataMap m_characterDataMap;
63 }; 72 };
64 73
65 inline SVGCharacterData::SVGCharacterData() 74 inline SVGCharacterData::SVGCharacterData()
66 : x(SVGTextLayoutAttributes::emptyValue()) 75 : x(emptyValue())
67 , y(SVGTextLayoutAttributes::emptyValue()) 76 , y(emptyValue())
68 , dx(SVGTextLayoutAttributes::emptyValue()) 77 , dx(emptyValue())
69 , dy(SVGTextLayoutAttributes::emptyValue()) 78 , dy(emptyValue())
70 , rotate(SVGTextLayoutAttributes::emptyValue()) 79 , rotate(emptyValue())
71 { 80 {
72 } 81 }
73 82
74 } // namespace blink 83 } // namespace blink
75 84
76 #endif 85 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698