Bug 23243 - Need to add multLeft() to TransformationMatrix and WebKitCSSMatrix
Summary: Need to add multLeft() to TransformationMatrix and WebKitCSSMatrix
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Chris Marrin
Depends on:
Reported: 2009-01-11 13:04 PST by Simon Fraser (smfr)
Modified: 2010-09-20 20:58 PDT (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2009-01-11 13:04:26 PST
TransformationMatrix::multiply() does a multRight with the supplied matrix. The other operations, like scale(), are applied to the left (as expected).

I think TransformationMatrix needs explicit multLeft and multRight (or pre- and post-multiply).
Comment 1 Chris Marrin 2009-01-13 16:48:45 PST
I don't think it's really necessary to have both variants. This is usually provided as an optimization, since the operation is self-modifying. Today, if you wanted to multiply b * a, but put the result in a, you would have to:

    TransformationMatrix tmp = b;
    a = tmp.multiply(a);

Which isn't that bad. Alternatively, we could change to a non-destructive multiply, which would ALWAYS be more inefficient, rather than just when you need to flip the operation order. I don't think our use of TransformationMatrix is extensive enough to warrant this.
Comment 2 Simon Fraser (smfr) 2009-01-13 17:39:09 PST
We have determined that SVGMatrix's multiply() is a multRight(), which also does not match its scale() etc, and indeed we think that TransformationMatrix should be more explicit about left vs. right multiply.
Comment 3 Chris Marrin 2009-01-16 10:56:55 PST
Now multiply() does a multRight() in TransformationMatrix, CSSMatrix and SVGMatrix. I think we should leave it that way for compatibility and add a multLeft() function (at least to TransformationMatrix and CSSMatrix).

Comment 4 Jeff Schiller 2009-11-04 08:02:31 PST
I'm ready and willing to hack - does anyone care to mentor me through this and Bug 16062?  Is there a good IRC channel to ask questions?
Comment 5 Simon Fraser (smfr) 2009-11-04 08:05:35 PST
Find me (smfr) on #webkit later today.
Comment 6 Jeff Schiller 2009-11-04 09:21:21 PST
In looking at the source, TransformationMatrix now has an explicit multLeft() and a multiply(), which does a multRight.  This was done by cmarrin for Bug 6868 and landed r40761.

I will fix SVGMatrix's incorrect matrix multiplication as part of Bug 16062.

Is there anything left to do for this bug?
Comment 7 Jeff Schiller 2010-09-20 20:56:23 PDT
smfr: I think this bug can be closed, do you agree?
Comment 8 Simon Fraser (smfr) 2010-09-20 20:58:01 PDT