Bug 137442 - There are wrong condition checking on GraphicsContext::roundToDevicePixels
Summary: There are wrong condition checking on GraphicsContext::roundToDevicePixels
Status: RESOLVED DUPLICATE of bug 169031
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-06 00:34 PDT by byeongha.cho
Modified: 2022-06-01 18:41 PDT (History)
6 users (show)

See Also:


Attachments
Patch (1.46 KB, patch)
2014-10-06 00:38 PDT, byeongha.cho
no flags Details | Formatted Diff | Diff
Patch (2.85 KB, patch)
2014-10-14 23:07 PDT, byeongha.cho
no flags Details | Formatted Diff | Diff
Patch (1.53 KB, patch)
2014-10-14 23:38 PDT, byeongha.cho
cgarcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description byeongha.cho 2014-10-06 00:34:24 PDT
There are wrong condition checking on GraphicsContext::roundToDevicePixels() of GraphicsContextCairo.cpp.

I think this is copy and paste mistake.

    // We must ensure width and height are at least 1 (or -1) when
    // we're given float values in the range between 0 and 1 (or -1 and 0).
    double width = frect.width();
    double height = frect.height();
    cairo_user_to_device_distance(cr, &width, &height);
    if (width > -1 && width < 0)
        width = -1;
    else if (width > 0 && width < 1)
        width = 1;
    else
        width = round(width);
    if (height > -1 && width < 0) //'width' should be replaced with 'height'.
        height = -1;
    else if (height > 0 && height < 1)
        height = 1;
    else
        height = round(height);
Comment 1 byeongha.cho 2014-10-06 00:38:01 PDT
Created attachment 239315 [details]
Patch
Comment 2 Darin Adler 2014-10-07 21:42:40 PDT
Comment on attachment 239315 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        No new tests is needed. There's no functional change.

Why is there no functional change? The condition is wrong; it must lead to some kind of bug.
Comment 3 byeongha.cho 2014-10-14 23:05:08 PDT
(In reply to comment #2)
> (From update of attachment 239315 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=239315&action=review
> > Source/WebCore/ChangeLog:8
> > +        No new tests is needed. There's no functional change.
> Why is there no functional change? The condition is wrong; it must lead to some kind of bug.

Yes, you are right. I'm going to upload the patch with detailed description again.
Actually, this is regression of '[cairo][canvas] Drawing from/into float rectangles with width or height in range 0 to 1 fails' issue.
I think Zan Dobersek  <zandobersek@gmail.com> has made some mistake.
So I fixed it.
Comment 4 byeongha.cho 2014-10-14 23:07:14 PDT
Created attachment 239851 [details]
Patch
Comment 5 Gyuyoung Kim 2014-10-14 23:09:09 PDT
Comment on attachment 239851 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        commit 957e1a234d3bc5b333615b0c5b6c8da56be4600a

I think this full commit log lets us confuse to track history. I think you just mention what revision used wrong condition in ChangeLog.
Comment 6 byeongha.cho 2014-10-14 23:22:58 PDT
Please refer https://bugs.webkit.org/show_bug.cgi?id=54491.
Comment 7 byeongha.cho 2014-10-14 23:38:55 PDT
Created attachment 239852 [details]
Patch
Comment 8 Darin Adler 2014-10-15 09:40:17 PDT
Comment on attachment 239852 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        Fixing copy and paste mistake of r79129. 
> +        There are condition checking for width in place of height.

Why no test case? Generally we require test cases so we don’t introduce the same mistake again.
Comment 9 Ahmad Saleem 2022-06-01 15:32:46 PDT
I tried to look into GraphicsContextCairo.cpp from Webkit Github mirror but I think code is more simplified and this might not be be applicable anymore.

Link - https://github.com/WebKit/WebKit/blob/ecc984f22b6d9d87c82985a6fb0c8b8b4a5c7975/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

Can we close this, if it is not applicable anymore? Thanks!
Comment 10 Alexey Proskuryakov 2022-06-01 18:41:30 PDT
This was fixed in bug 169031 (without a test case!!!), and later simplified to simply call into Cairo indeed.

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