Bug 81448

Summary: Enable animVal support for SVGNumberOptionalNumber
Product: WebKit Reporter: Nikolas Zimmermann <zimmermann>
Component: SVGAssignee: Nikolas Zimmermann <zimmermann>
Status: RESOLVED FIXED    
Severity: Normal CC: zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 12437    
Bug Blocks: 41761    
Attachments:
Description Flags
Patch koivisto: review+

Nikolas Zimmermann
Reported 2012-03-17 04:05:11 PDT
Certain types like stdDeviationX, stdDeviationY are mapped to a single attribute SVGNames::stdDeviationAttr. Two SVG DOM properties (two distinctive SVGAnimatedNumbers) have to reflect the changes when an animation is running.
Attachments
Patch (59.68 KB, patch)
2012-03-17 04:13 PDT, Nikolas Zimmermann
koivisto: review+
Nikolas Zimmermann
Comment 1 2012-03-17 04:13:46 PDT
Antti Koivisto
Comment 2 2012-03-17 04:41:15 PDT
Comment on attachment 132457 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=132457&action=review > Source/WebCore/svg/SVGAnimateElement.cpp:245 > + for (size_t i = 0; i < m_animatedProperties.size(); ++i) > + ASSERT(m_animatedPropertyType == m_animatedProperties[i]->animatedPropertyType()); You should add an inline function returning bool for this and then assert on that, ASSERT(propertyTypesConsistent()) or similar. > Source/WebCore/svg/SVGAnimatedTypeAnimator.h:74 > + AnimatedType* copy = new AnimatedType(*reinterpret_cast<AnimatedType*>(animatedType)); > + types.append(reinterpret_cast<SVGGenericAnimatedType*>(copy)); Why is this reinterpret_cast needed? Why is it safe? There should be at least a comment. > Source/WebCore/svg/SVGAnimationElement.cpp:383 > + size_t propertiesSize = properties.size(); > + if (propertiesSize) { Note that we want to make vectors use 32 bit indexes in the future so the general direction is away from size_t. But probably better use it here for consistency for now. > Source/WebCore/svg/SVGAnimationElement.cpp:480 > -void SVGAnimationElement::animationStarted(SVGAnimatedProperty* property, SVGAnimatedType* type) > +void SVGAnimationElement::animationStarted(const Vector<SVGAnimatedProperty*>& properties, const Vector<SVGGenericAnimatedType*>& types) > { > - ASSERT(type); > - notifyAnimatedPropertyAboutAnimationBeginEnd(property, type, targetElement(), attributeName()); > + notifyAnimatedPropertyAboutAnimationBeginEnd(properties, types, targetElement(), attributeName()); It might be good to add a comment explaining what exactly is the case with more than one property per element.
Nikolas Zimmermann
Comment 3 2012-03-17 04:43:47 PDT
(In reply to comment #2) > (From update of attachment 132457 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=132457&action=review > > > Source/WebCore/svg/SVGAnimateElement.cpp:245 > > + for (size_t i = 0; i < m_animatedProperties.size(); ++i) > > + ASSERT(m_animatedPropertyType == m_animatedProperties[i]->animatedPropertyType()); > > You should add an inline function returning bool for this and then assert on that, ASSERT(propertyTypesConsistent()) or similar. Good idea. > > Source/WebCore/svg/SVGAnimatedTypeAnimator.h:74 > Why is this reinterpret_cast needed? Why is it safe? SVGGenericAnimatedType isn't defined anywhere, we use it as generic variant type. This patch is a first step moving away from that, to avoid reinterpret_casts in future. > There should be at least a comment. Ok. > > Source/WebCore/svg/SVGAnimationElement.cpp:383 > Note that we want to make vectors use 32 bit indexes in the future so the general direction is away from size_t. But probably better use it here for consistency for now. Ok, good to know. > > Source/WebCore/svg/SVGAnimationElement.cpp:480 > It might be good to add a comment explaining what exactly is the case with more than one property per element. Ok.
Antti Koivisto
Comment 4 2012-03-17 04:57:27 PDT
Comment on attachment 132457 [details] Patch r=me since this is an existing architecture. The code that requires reinterpret_casts here absolutely need to be eliminated soon and replaced with properly designed types. The code is completely unsafe as is.
Nikolas Zimmermann
Comment 5 2012-03-17 05:00:44 PDT
(In reply to comment #4) > (From update of attachment 132457 [details]) > r=me since this is an existing architecture. The code that requires reinterpret_casts here absolutely need to be eliminated soon and replaced with properly designed types. The code is completely unsafe as is. Thanks, I'll post the follow-up patch soon.
Nikolas Zimmermann
Comment 6 2012-03-17 05:14:01 PDT
Note You need to log in before you can comment on or make changes to this bug.