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

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: rebased 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/SVGAnimatorFactory.h ('k') | Source/core/svg/SVGBoolean.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0b65bad3a1c9d11dca61942520f3df35980122c4..9444ed20cdd81181b29323d386bd73d9ae0cc60d 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 FINAL : public NewSVGListPropertyHelper<SVGLengthList, SVGLength> {
+class SVGBoolean : public NewSVGPropertyBase {
public:
- typedef SVGLengthListTearOff TearOffType;
+ // SVGBoolean does not have a tear-off type.
+ // 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));
}
- virtual ~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)
+{
+ RefPtr<NewSVGPropertyBase> base = passBase;
+ ASSERT(base->type() == SVGBoolean::classType());
+ return static_pointer_cast<SVGBoolean>(base.release());
+}
+
} // namespace WebCore
-#endif // SVGLengthList_h
+#endif // SVGBoolean_h
« no previous file with comments | « Source/core/svg/SVGAnimatorFactory.h ('k') | Source/core/svg/SVGBoolean.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698