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

Unified Diff: Source/core/svg/SVGString.h

Issue 148173018: [SVG] SVGAnimatedString{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove debug print Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGStaticStringList.cpp ('k') | Source/core/svg/SVGString.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGString.h
diff --git a/Source/core/svg/SVGBoolean.h b/Source/core/svg/SVGString.h
similarity index 66%
copy from Source/core/svg/SVGBoolean.h
copy to Source/core/svg/SVGString.h
index 0c0da5b0bd536ec0915e8181e035b04eadeb8e82..31bc758cd65b313baf00c7d2b5d94e466f729c14 100644
--- a/Source/core/svg/SVGBoolean.h
+++ b/Source/core/svg/SVGString.h
@@ -28,59 +28,69 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SVGBoolean_h
-#define SVGBoolean_h
+#ifndef SVGString_h
+#define SVGString_h
#include "core/svg/properties/NewSVGProperty.h"
namespace WebCore {
-class SVGBoolean : public NewSVGPropertyBase {
+class SVGString : public NewSVGPropertyBase {
public:
- // SVGBoolean does not have a tear-off type.
+ // SVGString does not have a tear-off type.
typedef void TearOffType;
- typedef bool PrimitiveType;
+ typedef String PrimitiveType;
- static PassRefPtr<SVGBoolean> create(bool value = false)
+ static PassRefPtr<SVGString> create()
{
- return adoptRef(new SVGBoolean(value));
+ return adoptRef(new SVGString());
}
- PassRefPtr<SVGBoolean> clone() const { return create(m_value); }
- virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) const OVERRIDE;
+ static PassRefPtr<SVGString> create(const String& value)
+ {
+ return adoptRef(new SVGString(value));
+ }
+
+ PassRefPtr<SVGString> clone() const { return create(m_value); }
+ virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String& value) const OVERRIDE
+ {
+ return create(value);
+ }
- virtual String valueAsString() const OVERRIDE;
- void setValueAsString(const String&, ExceptionState&);
+ virtual String valueAsString() const OVERRIDE { return m_value; }
+ void setValueAsString(const String& value, ExceptionState&) { m_value = value; }
virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE;
virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRefPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, SVGElement*) OVERRIDE;
virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElement*) OVERRIDE;
- bool operator==(const SVGBoolean& other) const { return m_value == other.m_value; }
- bool operator!=(const SVGBoolean& other) const { return !operator==(other); }
+ const String& value() const { return m_value; }
+ void setValue(const String& value) { m_value = value; }
- bool value() const { return m_value; }
- void setValue(bool value) { m_value = value; }
-
- static AnimatedPropertyType classType() { return AnimatedBoolean; }
+ static AnimatedPropertyType classType() { return AnimatedString; }
private:
- SVGBoolean(bool value)
+ SVGString()
+ : NewSVGPropertyBase(classType())
+ {
+ }
+
+ explicit SVGString(const String& value)
: NewSVGPropertyBase(classType())
, m_value(value)
{
}
- bool m_value;
+ String m_value;
};
-inline PassRefPtr<SVGBoolean> toSVGBoolean(PassRefPtr<NewSVGPropertyBase> passBase)
+inline PassRefPtr<SVGString> toSVGString(PassRefPtr<NewSVGPropertyBase> passBase)
{
RefPtr<NewSVGPropertyBase> base = passBase;
- ASSERT(base->type() == SVGBoolean::classType());
- return static_pointer_cast<SVGBoolean>(base.release());
+ ASSERT(base->type() == SVGString::classType());
+ return static_pointer_cast<SVGString>(base.release());
}
} // namespace WebCore
-#endif // SVGBoolean_h
+#endif // SVGString_h
« no previous file with comments | « Source/core/svg/SVGStaticStringList.cpp ('k') | Source/core/svg/SVGString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698