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

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

Issue 131253002: [SVG] SVGAnimatedBoolean migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/core/svg/SVGBoolean.h
diff --git a/Source/core/svg/SVGLengthList.h b/Source/core/svg/SVGBoolean.h
similarity index 61%
copy from Source/core/svg/SVGLengthList.h
copy to Source/core/svg/SVGBoolean.h
index 3d9b622a7a639bf822f3f3a4401f1fc6dbc92182..2f3e43d489113c4bdf23d1da2eeb22c39b53e01c 100644
--- a/Source/core/svg/SVGLengthList.h
+++ b/Source/core/svg/SVGBoolean.h
@@ -28,53 +28,60 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SVGLengthList_h
-#define SVGLengthList_h
+#ifndef SVGBoolean_h
+#define SVGBoolean_h
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/svg/SVGLength.h"
-#include "core/svg/properties/NewSVGListPropertyHelper.h"
+#include "core/svg/properties/NewSVGProperty.h"
namespace WebCore {
-class SVGLengthListTearOff;
-
-class SVGLengthList : public NewSVGListPropertyHelper<SVGLengthList, SVGLength> {
+class SVGBoolean : public NewSVGPropertyBase {
public:
- typedef SVGLengthListTearOff TearOffType;
+ // SVGBoolean do not have a tear-off type.
haraken 2014/01/09 11:09:23 do not => does not
kouhei (in TOK) 2014/01/10 08:16:10 Done.
+ // The below typedef is used by NewSVGAnimatedProperty.
+ typedef void TearOffType;
+ typedef bool PrimitiveType;
- static PassRefPtr<SVGLengthList> create(SVGLengthMode mode = LengthModeOther)
+ static PassRefPtr<SVGBoolean> create(bool value = false)
{
- return adoptRef(new SVGLengthList(mode));
+ return adoptRef(new SVGBoolean(value));
}
- ~SVGLengthList();
-
- PassRefPtr<SVGLengthList> clone();
-
- void setValueAsString(const String&, ExceptionState&);
-
- // NewSVGPropertyBase:
+ PassRefPtr<SVGBoolean> clone() const { return create(m_value); }
virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) const OVERRIDE;
+
virtual String valueAsString() const OVERRIDE;
+ void setValueAsString(const String&, ExceptionState&);
virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE;
- virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fromValue, PassRefPtr<NewSVGPropertyBase> toValue, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, 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;
- static AnimatedPropertyType classType() { return AnimatedLengthList; }
+ bool operator==(const SVGBoolean& other) const { return m_value == other.m_value; }
+ bool operator!=(const SVGBoolean& other) const { return !operator==(other); }
-private:
- explicit SVGLengthList(SVGLengthMode);
+ bool value() const { return m_value; }
+ void setValue(bool value) { m_value = value; }
- bool adjustFromToListValues(PassRefPtr<SVGLengthList> fromList, PassRefPtr<SVGLengthList> toList, float percentage, bool isToAnimation, bool resizeAnimatedListIfNeeded);
+ static AnimatedPropertyType classType() { return AnimatedBoolean; }
- template <typename CharType>
- void parseInternal(const CharType*& ptr, const CharType* end, ExceptionState&);
+private:
+ SVGBoolean(bool value)
+ : NewSVGPropertyBase(classType())
+ , m_value(value)
+ {
+ }
- SVGLengthMode m_mode;
+ bool m_value;
};
+inline PassRefPtr<SVGBoolean> toSVGBoolean(PassRefPtr<NewSVGPropertyBase> passBase)
haraken 2014/01/09 11:09:23 It looks a bit strange that toXXX takes a PassRefP
kouhei (in TOK) 2014/01/10 08:16:10 Discussed offline. Keeping this.
+{
+ RefPtr<NewSVGPropertyBase> base = passBase;
+ ASSERT(base->type() == SVGBoolean::classType());
+ return static_pointer_cast<SVGBoolean>(base.release());
+}
+
} // namespace WebCore
-#endif // SVGLengthList_h
+#endif // SVGBoolean_h

Powered by Google App Engine
This is Rietveld 408576698