Changeset 280715 in webkit
- Timestamp:
- Aug 5, 2021, 6:56:58 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-crash.html (modified) (2 diffs)
-
LayoutTests/fast/canvas/canvas-skia-excessive-size.html (modified) (1 diff)
-
LayoutTests/platform/ios-simulator/fast/canvas (deleted)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLCanvasElement.cpp (modified) (4 diffs)
-
Source/WebCore/html/HTMLCanvasElement.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.cpp (modified) (2 diffs)
-
Source/WebCore/testing/Internals.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r280711 r280715 1 2021-08-05 Tim Horton <timothy_horton@apple.com> 2 3 fast/canvas/canvas-crash.html doesn't test what it intends to on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=228747 5 6 Reviewed by Simon Fraser. 7 8 * fast/canvas/canvas-crash.html: 9 * fast/canvas/canvas-skia-excessive-size.html: 10 * platform/ios-simulator/fast/canvas/canvas-crash-expected.txt: Removed. 11 * platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt: Removed. 12 Delete the iOS-specific results, and adopt the new overrides in these two tests. 13 1 14 2021-08-05 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 15 -
trunk/LayoutTests/fast/canvas/canvas-crash.html
r280646 r280715 5 5 6 6 <a id="a"></a> 7 <canvas id="c" class="output" width="100" height="50"></canvas>8 7 9 8 <script> … … 13 12 function canvastest() 14 13 { 14 if (window.internals) { 15 window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4); 16 window.internals.setMaxCanvasArea(13951 * 11138); 17 } 15 18 var ctx = document.getCSSCanvasContext("2d", "canvastest", 13951, 11138); 16 19 ctx.putImageData(ctx.getImageData(1431655766, document.getElementById("a").appendChild(document.createElement("media")).clientWidth, 4096, -1024), 128, -65535, 127, -2147483648, 2147483647, -2147483648); 20 21 // Resize the context to ensure the large canvas doesn't leak into the next test. 22 document.getCSSCanvasContext("2d", "canvastest", 1, 1); 17 23 } 18 24 -
trunk/LayoutTests/fast/canvas/canvas-skia-excessive-size.html
r280646 r280715 12 12 testRunner.dumpAsText(); 13 13 14 if (window.internals) { 15 window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4); 16 window.internals.setMaxCanvasArea(134217728); 17 } 18 14 19 var canvas = document.getElementById("bigCanvas"); 15 20 var width = canvas.width; 16 21 // We need to perform a context fetch to force allocation of 17 22 // canvas resources. 18 if (canvas.getContext) 19 { 20 var ctx = canvas.getContext("2d"); 21 if (ctx == null) 22 { 23 print("Canvas 2d context = null!"); 24 } 23 if (canvas.getContext) { 24 var ctx = canvas.getContext("2d"); 25 if (ctx == null) 26 print("Canvas 2d context = null!"); 25 27 } 26 28 27 29 print("Survived canvas creation attempt. Width = " + width); 30 31 // Resize the canvas to ensure the large canvas doesn't leak into the next test. 32 canvas.width = 1; 28 33 } 29 34 </script> -
trunk/Source/WebCore/ChangeLog
r280705 r280715 1 2021-08-05 Tim Horton <timothy_horton@apple.com> 2 3 fast/canvas/canvas-crash.html doesn't test what it intends to on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=228747 5 6 Reviewed by Simon Fraser. 7 8 The test fast/canvas/canvas-crash.html intends to test changes made 9 to actual canvas code (see r215632); however, on the iOS simulator 10 the test doesn't even manage to make a canvas context because of 11 "maximum area" and "maximum backing store size" limits, which differ 12 per-platform. This results in unique test results for iOS, as well 13 as the test not actually exercising the code it was intended to. 14 15 Fix this by adding an override for the maximum area limit (we already 16 had one for maximum backing store size), and overriding them in 17 this test (and another similarly afflicted test). 18 19 * html/HTMLCanvasElement.cpp: 20 (WebCore::maxCanvasArea): 21 (WebCore::HTMLCanvasElement::setMaxCanvasAreaForTesting): 22 (WebCore::HTMLCanvasElement::createImageBuffer const): 23 * html/HTMLCanvasElement.h: 24 * testing/Internals.cpp: 25 (WebCore::Internals::resetToConsistentState): 26 (WebCore::Internals::setMaxCanvasArea): 27 * testing/Internals.h: 28 * testing/Internals.idl: 29 1 30 2021-08-05 Andres Gonzalez <andresg_22@apple.com> 2 31 -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r280646 r280715 112 112 const int defaultHeight = 150; 113 113 114 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it 115 // reaches that limit. We limit by area instead, giving us larger maximum dimensions, 116 // in exchange for a smaller maximum canvas size. The maximum canvas size is in device pixels. 117 #if PLATFORM(IOS_FAMILY) 118 const unsigned maxCanvasArea = 4096 * 4096; 119 #else 120 const unsigned maxCanvasArea = 16384 * 16384; 121 #endif 122 123 static size_t maxActivePixelMemoryForTesting = 0; 114 static std::optional<size_t> maxCanvasAreaForTesting; 115 static std::optional<size_t> maxActivePixelMemoryForTesting; 124 116 125 117 HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document& document) … … 213 205 { 214 206 if (maxActivePixelMemoryForTesting) 215 return maxActivePixelMemoryForTesting;207 return *maxActivePixelMemoryForTesting; 216 208 217 209 static size_t maxPixelMemory; … … 228 220 } 229 221 230 void HTMLCanvasElement::setMaxPixelMemoryForTesting(s ize_tsize)222 void HTMLCanvasElement::setMaxPixelMemoryForTesting(std::optional<size_t> size) 231 223 { 232 224 maxActivePixelMemoryForTesting = size; 225 } 226 227 static inline size_t maxCanvasArea() 228 { 229 if (maxCanvasAreaForTesting) 230 return *maxCanvasAreaForTesting; 231 232 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it 233 // reaches that limit. We limit by area instead, giving us larger maximum dimensions, 234 // in exchange for a smaller maximum canvas size. The maximum canvas size is in device pixels. 235 #if PLATFORM(IOS_FAMILY) 236 return 4096 * 4096; 237 #else 238 return 16384 * 16384; 239 #endif 240 } 241 242 void HTMLCanvasElement::setMaxCanvasAreaForTesting(std::optional<size_t> size) 243 { 244 maxCanvasAreaForTesting = size; 233 245 } 234 246 … … 867 879 auto checkedArea = size().area<RecordOverflow>(); 868 880 869 if (checkedArea.hasOverflowed() || checkedArea > maxCanvasArea ) {870 auto message = makeString("Canvas area exceeds the maximum limit (width * height > ", maxCanvasArea , ").");881 if (checkedArea.hasOverflowed() || checkedArea > maxCanvasArea()) { 882 auto message = makeString("Canvas area exceeds the maximum limit (width * height > ", maxCanvasArea(), ")."); 871 883 document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, message); 872 884 return; -
trunk/Source/WebCore/html/HTMLCanvasElement.h
r280646 r280715 129 129 void setImageBufferAndMarkDirty(RefPtr<ImageBuffer>&&); 130 130 131 WEBCORE_EXPORT static void setMaxPixelMemoryForTesting(size_t); 131 WEBCORE_EXPORT static void setMaxPixelMemoryForTesting(std::optional<size_t>); 132 WEBCORE_EXPORT static void setMaxCanvasAreaForTesting(std::optional<size_t>); 132 133 133 134 bool needsPreparationForDisplay(); -
trunk/Source/WebCore/testing/Internals.cpp
r280646 r280715 601 601 #endif 602 602 603 HTMLCanvasElement::setMaxPixelMemoryForTesting(0); // This means use the default value. 603 HTMLCanvasElement::setMaxPixelMemoryForTesting(std::nullopt); 604 HTMLCanvasElement::setMaxCanvasAreaForTesting(std::nullopt); 604 605 DOMWindow::overrideTransientActivationDurationForTesting(std::nullopt); 605 606 … … 6010 6011 } 6011 6012 6013 void Internals::setMaxCanvasArea(unsigned size) 6014 { 6015 HTMLCanvasElement::setMaxCanvasAreaForTesting(size); 6016 } 6017 6012 6018 int Internals::processIdentifier() const 6013 6019 { -
trunk/Source/WebCore/testing/Internals.h
r280646 r280715 347 347 348 348 void setMaxCanvasPixelMemory(unsigned); 349 void setMaxCanvasArea(unsigned); 349 350 350 351 ExceptionOr<unsigned> wheelEventHandlerCount(); -
trunk/Source/WebCore/testing/Internals.idl
r280646 r280715 938 938 939 939 undefined setMaxCanvasPixelMemory(unsigned long size); 940 undefined setMaxCanvasArea(unsigned long size); 940 941 941 942 [Conditional=VIDEO] readonly attribute NowPlayingState nowPlayingState;
Note:
See TracChangeset
for help on using the changeset viewer.