Bug 198779 - [cairo][SVG] If clipPath has multiple elements, clip-path coordinate system is wrongly scaled in high DPI
Summary: [cairo][SVG] If clipPath has multiple elements, clip-path coordinate system i...
Status: RESOLVED DUPLICATE of bug 198746
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-11 21:00 PDT by Fujii Hironori
Modified: 2019-06-12 06:41 PDT (History)
3 users (show)

See Also:


Attachments
test case (582 bytes, text/html)
2019-06-11 21:00 PDT, Fujii Hironori
no flags Details
[Screenshot] WinCairo port in 150% DPI display (7.69 KB, image/png)
2019-06-11 21:06 PDT, Fujii Hironori
no flags Details
WIP patch (926 bytes, patch)
2019-06-11 21:49 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2019-06-11 21:00:56 PDT
Created attachment 371919 [details]
test case

[cairo][SVG] If clipPath has multiple elements, clip-path coordinate system is wrongly scaled in high DPI

This test case is created by doubling a rect element in clipPath element of svg/foreignObject/clip.html.
Comment 1 Fujii Hironori 2019-06-11 21:06:17 PDT
Created attachment 371920 [details]
[Screenshot] WinCairo port in 150% DPI display
Comment 2 Fujii Hironori 2019-06-11 21:49:43 PDT
Created attachment 371925 [details]
WIP patch
Comment 3 Carlos Garcia Campos 2019-06-12 03:05:15 PDT
Comment on attachment 371925 [details]
WIP patch

View in context: https://bugs.webkit.org/attachment.cgi?id=371925&action=review

> Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp:88
> +        // Reset the current matrix because the mask surface doesn't have a matrix.
> +        cairo_matrix_t matrix;
> +        cairo_get_matrix(m_cr.get(), &matrix);
> +        cairo_identity_matrix(m_cr.get());
>          cairo_mask_surface(m_cr.get(), maskInformation.maskSurface(), maskRect.x(), maskRect.y());
> +        cairo_set_matrix(m_cr.get(), &matrix);

This works for svg, but not for other users of GraphicsContext::clipToImageBuffer() like shadow blur, for example. It seems that svg is the only one using absolute coordinates. Removing:

AffineTransform absoluteTransform = SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(renderer);

from RenderSVGResourceClipper::applyClippingToContext and using the identity fixes the test case too. Or keeping the absolute transform but setting the device scale factor in the image buffer cairo surface.
Comment 4 Carlos Garcia Campos 2019-06-12 03:14:21 PDT
You can try with fast/box-shadow/box-shadow-transformed.html for example
Comment 5 Carlos Garcia Campos 2019-06-12 06:41:02 PDT

*** This bug has been marked as a duplicate of bug 198746 ***