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

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

Issue 19263002: Get rid of special casing for SVGNumber in the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Build fix for mac Created 7 years, 5 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/SVGFEConvolveMatrixElement.cpp ('k') | Source/core/svg/SVGNumberList.h » ('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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef URLRegistry_h 31 #ifndef SVGNumber_h
32 #define URLRegistry_h 32 #define SVGNumber_h
33 33
34 #include "wtf/text/WTFString.h" 34 #include "core/svg/properties/SVGPropertyTraits.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class KURL; 38 class SVGNumber {
39 class SecurityOrigin; 39 WTF_MAKE_FAST_ALLOCATED;
40 class URLRegistry; 40 public:
41 SVGNumber()
42 : m_value(0)
abarth-chromium 2013/07/15 21:10:07 This line should be indented four more spaces.
43 { }
abarth-chromium 2013/07/15 21:10:07 These should each be on their own line.
41 44
42 class URLRegistrable { 45 SVGNumber(float value)
43 public: 46 : m_value(value)
44 virtual ~URLRegistrable() { } 47 { }
45 virtual URLRegistry& registry() const = 0; 48
49 SVGNumber& operator+=(const SVGNumber& rhs)
50 {
51 m_value += rhs.value();
52 return *this;
53 }
54
55 float value() const { return m_value; }
56 float& valueRef() { return m_value; }
57 String valueAsString() const { return String::number(m_value); }
58 void setValue(float value) { m_value = value; }
59
60 private:
61 float m_value;
46 }; 62 };
47 63
48 class URLRegistry { 64 COMPILE_ASSERT(sizeof(SVGNumber) == sizeof(float), SVGNumber_same_size_as_float) ;
49 WTF_MAKE_FAST_ALLOCATED;
50 public:
51 virtual ~URLRegistry() { }
52 virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) = 0;
53 virtual void unregisterURL(const KURL&) = 0;
54 65
55 // This is an optional API 66 template<>
56 virtual URLRegistrable* lookup(const String&) { ASSERT_NOT_REACHED(); return 0; } 67 struct SVGPropertyTraits<SVGNumber> {
68 static SVGNumber initialValue() { return SVGNumber(); }
69 static String toString(const SVGNumber& type) { return type.valueAsString(); }
57 }; 70 };
58 71
59 } // namespace WebCore 72 } // namespace WebCore
60 73
61 #endif // URLRegistry_h 74 #endif // SVGNumber_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEConvolveMatrixElement.cpp ('k') | Source/core/svg/SVGNumberList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698