Changeset 95899 in webkit
- Timestamp:
- Sep 23, 2011 8:24:35 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95897 r95899 1 2011-09-23 Justin Novosad <junov@chromium.org> 2 3 Unwarranted DOM Exception when canvas2D drawImage is called with src 4 rect is out of bounds 5 https://bugs.webkit.org/show_bug.cgi?id=65709 6 7 Reviewed by Oliver Hunt. 8 9 * fast/canvas/drawImage-with-invalid-args-expected.txt: 10 * fast/canvas/drawImage-with-invalid-args.html: 11 This test covers (among other things) cases where the source rectangle is 12 _completely_ outside the bounds of the source image. It was modified to no 13 longer expect DOM exceptions 14 * platform/chromium/test_expectations.txt: 15 Out-dated test canvas/philip/tests/2d.drawImage.outsidesource.html 16 is now expected to fail 17 * platform/mac/Skipped: 18 Skipping canvas/philip/tests/2d.drawImage.outsidesource.html 19 1 20 2011-09-23 Mihai Parparita <mihaip@chromium.org> 2 21 -
trunk/LayoutTests/fast/canvas/drawImage-with-invalid-args-expected.txt
r93359 r95899 16 16 PASS: null image, got exception as expected 17 17 PASS: null image, got exception as expected 18 PASS: imageRect does not contain sourceRect on the left side , got exception as expected19 PASS: imageRect does not contain sourceRect on the right side , got exception as expected20 PASS: imageRect does not contain sourceRect on top , got exception as expected21 PASS: imageRect does not contain sourceRect on bottom , got exception as expected22 PASS: sourceRect is bigger than imageSource on every side , got exception as expected23 PASS: negative size of source, imageRect does not contain sourceRect on the left side , got exception as expected24 PASS: negative size of source, imageRect does not contain sourceRect on the right side , got exception as expected25 PASS: negative size of source, imageRect does not contain sourceRect on top , got exception as expected26 PASS: negative size of source, imageRect does not contain sourceRect on bottom , got exception as expected27 PASS: negative size of source, imageRect does not contain sourceRect on every side , got exception as expected18 PASS: imageRect does not contain sourceRect on the left side 19 PASS: imageRect does not contain sourceRect on the right side 20 PASS: imageRect does not contain sourceRect on top 21 PASS: imageRect does not contain sourceRect on bottom 22 PASS: sourceRect is bigger than imageSource on every side 23 PASS: negative size of source, imageRect does not contain sourceRect on the left side 24 PASS: negative size of source, imageRect does not contain sourceRect on the right side 25 PASS: negative size of source, imageRect does not contain sourceRect on top 26 PASS: negative size of source, imageRect does not contain sourceRect on bottom 27 PASS: negative size of source, imageRect does not contain sourceRect on every side 28 28 Test complete. 29 29 -
trunk/LayoutTests/fast/canvas/drawImage-with-invalid-args.html
r93359 r95899 115 115 try{ 116 116 ctx.drawImage(myImage, -10, 0, 52, 64, 0, 0, 20, 20); 117 print("PASS: imageRect does not contain sourceRect on the left side"); 118 } catch (e) { 117 119 print("FAIL"); 118 } catch (e) {119 print("PASS: imageRect does not contain sourceRect on the left side, got exception as expected");120 120 } 121 121 try{ 122 122 ctx.drawImage(myImage, 10, 0, 52, 64, 0, 0, 20, 20); 123 print("PASS: imageRect does not contain sourceRect on the right side"); 124 } catch (e) { 123 125 print("FAIL"); 124 } catch (e) {125 print("PASS: imageRect does not contain sourceRect on the right side, got exception as expected");126 126 } 127 127 try{ 128 128 ctx.drawImage(myImage, 0, -10, 52, 64, 0, 0, 20, 20); 129 print("PASS: imageRect does not contain sourceRect on top"); 130 } catch (e) { 129 131 print("FAIL"); 130 } catch (e) {131 print("PASS: imageRect does not contain sourceRect on top, got exception as expected");132 132 } 133 133 try{ 134 134 ctx.drawImage(myImage, 0, 10, 52, 64, 0, 0, 20, 20); 135 print("PASS: imageRect does not contain sourceRect on bottom"); 136 } catch (e) { 135 137 print("FAIL"); 136 } catch (e) {137 print("PASS: imageRect does not contain sourceRect on bottom, got exception as expected");138 138 } 139 139 try{ 140 140 ctx.drawImage(myImage, -10, -10, 72, 84, 0, 0, 20, 20); 141 print("PASS: sourceRect is bigger than imageSource on every side"); 142 } catch (e) { 141 143 print("FAIL"); 142 } catch (e) {143 print("PASS: sourceRect is bigger than imageSource on every side, got exception as expected");144 144 } 145 145 try{ 146 146 ctx.drawImage(myImage, 42, 64, -52, -64, 0, 0, 20, 20); 147 print("PASS: negative size of source, imageRect does not contain sourceRect on the left side"); 148 } catch (e) { 147 149 print("FAIL"); 148 } catch (e) {149 print("PASS: negative size of source, imageRect does not contain sourceRect on the left side, got exception as expected");150 150 } 151 151 try{ 152 152 ctx.drawImage(myImage, 62, 64, -52, -64, 0, 0, 20, 20); 153 print("PASS: negative size of source, imageRect does not contain sourceRect on the right side"); 154 } catch (e) { 153 155 print("FAIL"); 154 } catch (e) {155 print("PASS: negative size of source, imageRect does not contain sourceRect on the right side, got exception as expected");156 156 } 157 157 try{ 158 158 ctx.drawImage(myImage, 52, 54, -52, -64, 0, 0, 20, 20); 159 print("PASS: negative size of source, imageRect does not contain sourceRect on top"); 160 } catch (e) { 159 161 print("FAIL"); 160 } catch (e) {161 print("PASS: negative size of source, imageRect does not contain sourceRect on top, got exception as expected");162 162 } 163 163 try{ 164 164 ctx.drawImage(myImage, 52, 74, -52, -64, 0, 0, 20, 20); 165 print("PASS: negative size of source, imageRect does not contain sourceRect on bottom"); 166 } catch (e) { 165 167 print("FAIL"); 166 } catch (e) {167 print("PASS: negative size of source, imageRect does not contain sourceRect on bottom, got exception as expected");168 168 } 169 169 try{ 170 170 ctx.drawImage(myImage, 62, 74, -72, -84, 0, 0, 20, 20); 171 print("PASS: negative size of source, imageRect does not contain sourceRect on every side"); 172 } catch (e) { 171 173 print("FAIL"); 172 } catch (e) {173 print("PASS: negative size of source, imageRect does not contain sourceRect on every side, got exception as expected");174 174 } 175 175 ctx.fillStyle = 'green'; -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r95892 r95899 234 234 // We don't let anyone set status in the browser. 235 235 WONTFIX SKIP : plugins/set-status.html = TEXT 236 237 // This test is out of date with respect to the latest version of the HTML5 spec 238 // Test had to be decommissioned to fix https://bugs.webkit.org/show_bug.cgi?id=65709 239 // We can re-enable the test when it gets changed upstream to become spec-compliant 240 WONTFIX : canvas/philip/tests/2d.drawImage.outsidesource.html = TEXT 236 241 237 242 // We don't care about dashboard compatibility mode. -
trunk/LayoutTests/platform/mac/Skipped
r95752 r95899 163 163 canvas/philip/tests/2d.imageData.object.wrap.html 164 164 165 # This canvas test is skipped because it is out of date with respect to 166 # the current spec, and the fix for https://bugs.webkit.org/show_bug.cgi?id=65709 167 # which complies with the current spec, makes this test fail by no longer throwing 168 # exceptions that were previously expected 169 canvas/philip/tests/2d.drawImage.outsidesource.html 170 165 171 # IndexedDB is not yet enabled. 166 172 storage/indexeddb -
trunk/Source/WebCore/ChangeLog
r95898 r95899 1 2011-09-23 Justin Novosad <junov@chromium.org> 2 3 Unwarranted DOM Exception when canvas2D drawImage is called with src 4 rect out of bounds 5 https://bugs.webkit.org/show_bug.cgi?id=65709 6 7 Reviewed by Oliver Hunt. 8 9 * html/canvas/CanvasRenderingContext2D.cpp: 10 (WebCore::CanvasRenderingContext2D::drawImage): 11 Return early without throwing an exception if source rectangle is out of 12 bounds to match the spec. 13 1 14 2011-09-23 Lukasz Slachciak <l.slachciak@samsung.com> 2 15 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r95346 r95899 1272 1272 1273 1273 FloatRect imageRect = FloatRect(FloatPoint(), size(image)); 1274 if (! imageRect.contains(normalizedSrcRect) || !srcRect.width() || !srcRect.height()) {1274 if (!srcRect.width() || !srcRect.height()) { 1275 1275 ec = INDEX_SIZE_ERR; 1276 1276 return; 1277 1277 } 1278 if (!imageRect.contains(normalizedSrcRect)) 1279 return; 1278 1280 1279 1281 GraphicsContext* c = drawingContext(); … … 1334 1336 } 1335 1337 1336 if (!src CanvasRect.contains(normalizeRect(srcRect)) || !srcRect.width() || !srcRect.height()) {1338 if (!srcRect.width() || !srcRect.height()) { 1337 1339 ec = INDEX_SIZE_ERR; 1338 1340 return; … … 1341 1343 ec = 0; 1342 1344 1343 if (! dstRect.width() || !dstRect.height())1345 if (!srcCanvasRect.contains(normalizeRect(srcRect)) || !dstRect.width() || !dstRect.height()) 1344 1346 return; 1345 1347 … … 1415 1417 1416 1418 FloatRect videoRect = FloatRect(FloatPoint(), size(video)); 1417 if (! videoRect.contains(normalizeRect(srcRect)) || !srcRect.width() || !srcRect.height()) {1419 if (!srcRect.width() || !srcRect.height()) { 1418 1420 ec = INDEX_SIZE_ERR; 1419 1421 return; 1420 1422 } 1421 1423 1422 if (! dstRect.width() || !dstRect.height())1424 if (!videoRect.contains(normalizeRect(srcRect)) || !dstRect.width() || !dstRect.height()) 1423 1425 return; 1424 1426
Note: See TracChangeset
for help on using the changeset viewer.