Bug 14150 - SVG DOM is broken in fundamental ways
Summary: SVG DOM is broken in fundamental ways
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Eric Seidel (no email)
Depends on:
Blocks: 15395
  Show dependency treegraph
Reported: 2007-06-14 16:03 PDT by Nikolas Zimmermann
Modified: 2007-10-11 07:42 PDT (History)
0 users

See Also:

Fix (and formal application for my 1337 template hacker merit badge) (10.95 KB, patch)
2007-10-11 00:13 PDT, Eric Seidel (no email)
zimmermann: review+
Details | Formatted Diff | Diff
test case (1.79 KB, application/xhtml+xml)
2007-10-11 01:30 PDT, Eric Seidel (no email)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolas Zimmermann 2007-06-14 16:03:30 PDT
try: alert(myRect.x == myRect.x) :-)

snippet from JSSVGRectElement:
JSValue* JSSVGRectElement::getValueProperty(ExecState* exec, int token) const
    SVGRectElement* imp = static_cast<SVGRectElement*>(impl());

    switch (token) {
    case XAttrNum:
        ASSERT(exec && exec->dynamicInterpreter());
        RefPtr<SVGAnimatedLength> obj = imp->xAnimated();

snippet from SVGElement.h:
PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
{ \
    return RefPtr<ClassName::SVGAnimatedTemplate##UpperProperty>(new ClassName::SVGAnimatedTemplate##UpperProperty(this)); \

It's pretty clear that the SVG DOM semantics are broken w/o this.
Need to discuss with Eric, and come up with yet another caching solution.

Bug 13963 fixes similar problems for JSSVGLength - same fixes are needed
for JSSVGAnimatedLength. Once that patch is landed, this already works:

var one = myRect.x.baseVal; var two = myRect.x.baseVal;
one.value = 100; two.value = 200;

and one.value == two.value returns true.

Similar fix is needed for the JSSVGAnimated* classes.
Will be fun :-)
Comment 1 Nikolas Zimmermann 2007-06-14 16:16:07 PDT
In case anyone wonders if we were smoking crack because no one ever noticed that before:
Visually everything works - there are no crashes etc.

It only breaks if you're making assumptions about the SVG DOM itself!
I think Antoine reported similar stuff.
Comment 2 Eric Seidel (no email) 2007-10-11 00:13:47 PDT
Created attachment 16623 [details]
Fix (and formal application for my 1337 template hacker merit badge)
Comment 3 Eric Seidel (no email) 2007-10-11 01:30:06 PDT
Created attachment 16625 [details]
test case
Comment 4 Nikolas Zimmermann 2007-10-11 03:40:51 PDT
Comment on attachment 16623 [details]
Fix (and formal application for my 1337 template hacker merit badge)

Yay! Excellent work Eric - this was on my TODO list way too long :-)

Finally it's fixed, r=me.
Comment 5 Eric Seidel (no email) 2007-10-11 07:42:05 PDT
Landed on feature-branch as r26357.