Bug 30073 - Need to scale the canvas, not resize it on CSS width/height change
Summary: Need to scale the canvas, not resize it on CSS width/height change
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Chris Marrin
Depends on:
Reported: 2009-10-05 07:14 PDT by Chris Marrin
Modified: 2010-01-18 15:09 PST (History)
3 users (show)

See Also:

Patch (1.76 KB, patch)
2010-01-18 13:56 PST, Chris Marrin
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Marrin 2009-10-05 07:14:27 PDT
Canvas should only resize when canvas width and height attributes are changed
Comment 1 Chris Marrin 2009-10-19 20:44:46 PDT
Another odd characteristic of this bug happens if you open (for instance):


and then hit cmd-+. The planets get smaller. This is happening because I am looking at the CSS size to set the canvas, but at the canvas width and height to set the viewport. The canvas size doesn't change but the css size gets bigger, so the viewport is small relative to the canvas size.

This is all fixed by not changing the canvas based on the CSS size, which is what fixing this bug will do.
Comment 2 Chris Marrin 2010-01-18 13:56:59 PST
Created attachment 46844 [details]
Comment 3 WebKit Review Bot 2010-01-18 13:59:01 PST
Attachment 46844 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/html/HTMLCanvasElement.cpp:277:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
WebCore/html/HTMLCanvasElement.cpp:277:  Use 0 instead of NULL.  [readability/null] [5]
Total errors found: 2

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Chris Marrin 2010-01-18 15:09:47 PST
Landed in http://trac.webkit.org/changeset/53434