RESOLVED FIXED 89888
use scale() instead of getCTM/normalizeTransform/setCTM for svg text decorations
https://bugs.webkit.org/show_bug.cgi?id=89888
Summary use scale() instead of getCTM/normalizeTransform/setCTM for svg text decorations
Mike Reed
Reported 2012-06-25 09:04:00 PDT
use scale() instead of getCTM/normalizeTransform/setCTM for svg text decorations
Attachments
Patch (2.61 KB, patch)
2012-06-25 09:09 PDT, Mike Reed
no flags
Patch (3.65 KB, patch)
2012-06-25 10:35 PDT, Mike Reed
no flags
Patch (3.90 KB, patch)
2012-06-26 05:41 PDT, Mike Reed
no flags
Mike Reed
Comment 1 2012-06-25 09:09:55 PDT
Eric Seidel (no email)
Comment 2 2012-06-25 09:26:55 PDT
Why wouldn't all platforms want this path? Why does Skia?
Mike Reed
Comment 3 2012-06-25 09:34:24 PDT
Why: Skia-specific: The current code does not play well if we try to record/playback the drawing commands, since the getCTM() is done once, and may not be the same matrix that is present during subsequent playback. General: The old code introduces a fair amount of complexity and heuristics (e.g. why do we normalize only around identity, and not other integral scale factors or integral translates?) If other platforms want to opt-in to this change, I presume they will either remove the check, or add their platform to the list.
David Reveman
Comment 4 2012-06-25 09:35:37 PDT
Comment on attachment 149302 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149302&action=review > Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:652 > + context->save(); if we consider save/restore() lightweight, I'd prefer the save/restore pair outside the conditional so that only one "scalingFactor != 1" check is needed.
Mike Reed
Comment 5 2012-06-25 09:37:12 PDT
I can make that change. My original CL attempted to keep the existing flow as much as possible. I do think save/restore are very efficient in skia, so it should not be a perf issue there.
Mike Reed
Comment 6 2012-06-25 09:38:04 PDT
always calling save/restore might be another reason to make this Skia specific, unless the other platforms feel the same way about their relative perf cost...
Eric Seidel (no email)
Comment 7 2012-06-25 09:48:37 PDT
I don't know what the current view on the cost of GraphicsContext::save/restore is.
Eric Seidel (no email)
Comment 8 2012-06-25 09:50:12 PDT
I'd prefer if we just removed the "old" code and used scale instead, if that's perceived as the better way. We can re-visit adding the "old" code back for other platforms if scale is too slow. The perf bots will answer these questions (but I doubt it matters). So my suggestion would be to just change the code instead of adding yet another if-def.
Mike Reed
Comment 9 2012-06-25 10:24:47 PDT
I'll give it a try, and hope there are rebaselines on other platforms...
Mike Reed
Comment 10 2012-06-25 10:35:14 PDT
Mike Reed
Comment 11 2012-06-25 10:36:44 PDT
patch #2 removes #ifdefs
Mike Reed
Comment 12 2012-06-25 11:35:48 PDT
PTAL
Eric Seidel (no email)
Comment 13 2012-06-25 13:08:46 PDT
Comment on attachment 149319 [details] Patch Am I reading correctly that this patch basically undoes this change: http://trac.webkit.org/changeset/78704/trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp? Do you anticipate that this will cause rendering differences between 64 and 32 bit machines (for skia or otherwise)?
Mike Reed
Comment 14 2012-06-25 13:19:42 PDT
I would think it would, though zimmermann might comment on that. This is why I thought my change should be per-platform.
Eric Seidel (no email)
Comment 15 2012-06-25 13:25:34 PDT
I see. I can understand your desire for this to be per-platform then. I'd like to give Niko a day to comment. He's working from Germany last I knew.
Dirk Schulze
Comment 16 2012-06-25 19:31:24 PDT
Comment on attachment 149319 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149319&action=review In general I like to do this, instead of the "normalizeTransform" logic. I reviewed the original patch and thought that it might be worth at that time. But changed my mind. Even if we see rounding differences. I still think it is a good idea if Niko looks over the patch as well. r- because of the issues listed below. I am fine if someone else reviews a new patch, since I won't be available for the next weeks. > Source/WebCore/ChangeLog:8 > + > + use scale() instead of getCTM/normalizeTransform/setCTM for svg text decorations. > + https://bugs.webkit.org/show_bug.cgi?id=89888 > + > + Reviewed by NOBODY (OOPS!). > + > + No new tests. Current layouttests exercise this code path. A detailed comment is missing what you are doing and why you are doing it. > Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:618 > + context->save(); We have GraphicsContextStateSaver for save/restore. Can't this be used here? Also, why are you using save and restore here? I can remember that for some platforms it was quite an expensive operation. Can't you just unscale? > Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:623 > + context->restore(); Some lines later there is a condition and another restore is called. This seems dangerous, since no save was called before here.
Mike Reed
Comment 17 2012-06-26 05:37:41 PDT
(In reply to comment #16) > (From update of attachment 149319 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=149319&action=review > > In general I like to do this, instead of the "normalizeTransform" logic. I reviewed the original patch and thought that it might be worth at that time. But changed my mind. Even if we see rounding differences. I still think it is a good idea if Niko looks over the patch as well. > > r- because of the issues listed below. I am fine if someone else reviews a new patch, since I won't be available for the next weeks. > > > Source/WebCore/ChangeLog:8 > > + > > + use scale() instead of getCTM/normalizeTransform/setCTM for svg text decorations. > > + https://bugs.webkit.org/show_bug.cgi?id=89888 > > + > > + Reviewed by NOBODY (OOPS!). > > + > > + No new tests. Current layouttests exercise this code path. > > A detailed comment is missing what you are doing and why you are doing it. > > > Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:618 > > + context->save(); > > We have GraphicsContextStateSaver for save/restore. Can't this be used here? Also, why are you using save and restore here? I can remember that for some platforms it was quite an expensive operation. Can't you just unscale? Too numerically unstable. That is why we have save/restore. > > > Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:623 > > + context->restore(); > > Some lines later there is a condition and another restore is called. This seems dangerous, since no save was called before here. This is from code that has always been here. The restore is balance a hidden save inside applyShadowToGraphicsContext().
Mike Reed
Comment 18 2012-06-26 05:41:57 PDT
Mike Reed
Comment 19 2012-06-26 05:43:35 PDT
Updated comment, and replied to Dirk's comments. PTAL
Nikolas Zimmermann
Comment 20 2012-06-26 07:50:20 PDT
Comment on attachment 149516 [details] Patch If there are no regressions, r=me. Reverting the mess is just right, it didn't fix anything after all, and was my rude attempt to get consistent results between 32bit/64bit mac machines, but as it effectively breaks things for Chromium, it should just go away.
WebKit Review Bot
Comment 21 2012-06-27 08:06:41 PDT
Comment on attachment 149516 [details] Patch Clearing flags on attachment: 149516 Committed r121343: <http://trac.webkit.org/changeset/121343>
WebKit Review Bot
Comment 22 2012-06-27 08:06:47 PDT
All reviewed patches have been landed. Closing bug.
David Reveman
Comment 23 2012-06-28 12:49:36 PDT
*** Bug 89506 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.