Changeset 280630 in webkit
- Timestamp:
- Aug 4, 2021, 2:40:46 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-crash.html (modified) (1 diff)
-
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
r280625 r280630 1 2021-08-04 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-03 Lauro Moura <lmoura@igalia.com> 2 15 -
trunk/LayoutTests/fast/canvas/canvas-crash.html
r276877 r280630 13 13 function canvastest() 14 14 { 15 if (window.internals) { 16 window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4); 17 window.internals.setMaxCanvasArea(13951 * 11138); 18 } 15 19 var ctx = document.getCSSCanvasContext("2d", "canvastest", 13951, 11138); 16 20 ctx.putImageData(ctx.getImageData(1431655766, document.getElementById("a").appendChild(document.createElement("media")).clientWidth, 4096, -1024), 128, -65535, 127, -2147483648, 2147483647, -2147483648); -
trunk/LayoutTests/fast/canvas/canvas-skia-excessive-size.html
r120683 r280630 11 11 if (window.testRunner) 12 12 testRunner.dumpAsText(); 13 14 if (window.internals) { 15 window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4); 16 window.internals.setMaxCanvasArea(134217728); 17 } 13 18 14 19 var canvas = document.getElementById("bigCanvas"); -
trunk/Source/WebCore/ChangeLog
r280629 r280630 1 2021-08-04 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-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 31 -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r280467 r280630 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
r280467 r280630 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
r280308 r280630 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
r280308 r280630 347 347 348 348 void setMaxCanvasPixelMemory(unsigned); 349 void setMaxCanvasArea(unsigned); 349 350 350 351 ExceptionOr<unsigned> wheelEventHandlerCount(); -
trunk/Source/WebCore/testing/Internals.idl
r280308 r280630 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.