Bug 76282

Summary: ForeignObject content is zoomed two times
Product: WebKit Reporter: Florin Malita <fmalita>
Component: SVGAssignee: Florin Malita <fmalita>
Status: RESOLVED FIXED    
Severity: Normal CC: fmalita, hugo, macpherson, menard, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
FO content zoomed twice
none
Patch
none
Patch
none
Patch none

Florin Malita
Reported 2012-01-13 09:33:46 PST
Created attachment 122441 [details] FO content zoomed twice The zoom factor is applied twice to FO-embedded elements. This affects both SVG and HTML content, but for different reasons: * When embedding foreign SVG content, we end up with two RenderSVGRoot nodes on the render path: RenderSVGRoot {svg} RenderSVGForeignObject {foreignObject} RenderSVGRoot {svg} RenderSVGRect {rect} ... Each RenderSVGRoot::paint() applies the zoom factor to its current canvas context - hence the duplicate zooming: http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp#L310 , http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp#L355 * When embedding foreign HTML content, the CSS properties appear to be pre-scaled by the zoom factor (http://trac.webkit.org/browser/trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp#L334), so the zoom introduced by RenderSVGRoot up the tree is compounding the effect. See the attached test for an example; try zooming in/out a few times and observe how the FO content is scaled twice. The test works correctly in FF8+.
Attachments
FO content zoomed twice (770 bytes, image/svg+xml)
2012-01-13 09:33 PST, Florin Malita
no flags
Patch (5.61 KB, patch)
2012-03-21 13:51 PDT, Florin Malita
no flags
Patch (154.52 KB, patch)
2012-03-23 12:32 PDT, Florin Malita
no flags
Patch (154.79 KB, patch)
2012-03-24 08:32 PDT, Florin Malita
no flags
Florin Malita
Comment 1 2012-03-21 13:51:50 PDT
Nikolas Zimmermann
Comment 2 2012-03-22 01:31:38 PDT
Comment on attachment 133107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=133107&action=review Good catch, I'd like to r+ this, though the test should be extended to cover text as well, or a new test should be added. Its possible that theres still a bug related to non-shapes drawing in fO trees. > LayoutTests/svg/zoom/page/zoom-foreign-content.svg:2 > +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()"> For the record: in theory this could use a reftest, if we'd zoom the subtrees by specifying zoom CSS properties, though for testing zooming the preferred way is to use the DRT functionality, as that uses the same code path, as if you'd zoom in eg. Safari. So using a pixel+repaint test is just right for this case. > LayoutTests/svg/zoom/page/zoom-foreign-content.svg:7 > + <rect width="99" height="99" fill="red"/> I'd like to see another test that includes text in the SVG subtree (and maybe also in the HTML subtree). As <text> depends on the accumulated transforms up to RenderSVGRoot, we should verify this works as well, including zooming.
Florin Malita
Comment 3 2012-03-22 09:16:11 PDT
(In reply to comment #2) > (From update of attachment 133107 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=133107&action=review > > Good catch, I'd like to r+ this, though the test should be extended to cover text as well, or a new test should be added. Its possible that theres still a bug related to non-shapes drawing in fO trees. There's already a test covering zooming of FO text: svg/zoom/{page,text}/zoom-foreignObject.svg Should I go ahead and add more coverage to it (SVG text maybe)? I was hoping to avoid having to deal with a gazillion platform rebaselines :)
Florin Malita
Comment 4 2012-03-23 12:32:23 PDT
Nikolas Zimmermann
Comment 5 2012-03-24 01:44:05 PDT
Comment on attachment 133535 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=133535&action=review Looks great, r=me, with one comment: > LayoutTests/platform/mac/Skipped:566 > +# Rebaseline needed after https://bugs.webkit.org/show_bug.cgi?id=76282 > +svg/zoom/page/zoom-foreignObject.svg > +svg/zoom/text/zoom-foreignObject.svg You can use platform/mac/test_expectations.txt as well btw, so there's no need to skip those tests!
Florin Malita
Comment 6 2012-03-24 08:32:31 PDT
Florin Malita
Comment 7 2012-03-24 08:34:04 PDT
(In reply to comment #5) > You can use platform/mac/test_expectations.txt as well btw, so there's no need to skip those tests! Good to know! Still figuring out which platforms observe the expectations files :)
WebKit Review Bot
Comment 8 2012-03-24 21:08:24 PDT
Comment on attachment 133635 [details] Patch Clearing flags on attachment: 133635 Committed r112022: <http://trac.webkit.org/changeset/112022>
WebKit Review Bot
Comment 9 2012-03-24 21:08:29 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.