Changeset 280646 in webkit
- Timestamp:
- Aug 4, 2021, 11:39:37 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 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 (added)
-
LayoutTests/platform/ios-simulator/fast/canvas/canvas-crash-expected.txt (added)
-
LayoutTests/platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt (added)
-
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
r280645 r280646 1 2021-08-04 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r280630. 4 https://bugs.webkit.org/show_bug.cgi?id=228788 5 6 broke some downstream tests 7 8 Reverted changeset: 9 10 "fast/canvas/canvas-crash.html doesn't test what it intends to 11 on iOS" 12 https://bugs.webkit.org/show_bug.cgi?id=228747 13 https://commits.webkit.org/r280630 14 1 15 2021-08-04 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 16 -
trunk/LayoutTests/fast/canvas/canvas-crash.html
r280630 r280646 13 13 function canvastest() 14 14 { 15 if (window.internals) {16 window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4);17 window.internals.setMaxCanvasArea(13951 * 11138);18 }19 15 var ctx = document.getCSSCanvasContext("2d", "canvastest", 13951, 11138); 20 16 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
r280630 r280646 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 }18 13 19 14 var canvas = document.getElementById("bigCanvas"); -
trunk/Source/WebCore/ChangeLog
r280643 r280646 1 2021-08-04 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r280630. 4 https://bugs.webkit.org/show_bug.cgi?id=228788 5 6 broke some downstream tests 7 8 Reverted changeset: 9 10 "fast/canvas/canvas-crash.html doesn't test what it intends to 11 on iOS" 12 https://bugs.webkit.org/show_bug.cgi?id=228747 13 https://commits.webkit.org/r280630 14 1 15 2021-08-04 Antti Koivisto <antti@apple.com> 2 16 -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r280630 r280646 112 112 const int defaultHeight = 150; 113 113 114 static std::optional<size_t> maxCanvasAreaForTesting; 115 static std::optional<size_t> maxActivePixelMemoryForTesting; 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; 116 124 117 125 HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document& document) … … 205 213 { 206 214 if (maxActivePixelMemoryForTesting) 207 return *maxActivePixelMemoryForTesting;215 return maxActivePixelMemoryForTesting; 208 216 209 217 static size_t maxPixelMemory; … … 220 228 } 221 229 222 void HTMLCanvasElement::setMaxPixelMemoryForTesting(s td::optional<size_t>size)230 void HTMLCanvasElement::setMaxPixelMemoryForTesting(size_t size) 223 231 { 224 232 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 it233 // 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 #else238 return 16384 * 16384;239 #endif240 }241 242 void HTMLCanvasElement::setMaxCanvasAreaForTesting(std::optional<size_t> size)243 {244 maxCanvasAreaForTesting = size;245 233 } 246 234 … … 879 867 auto checkedArea = size().area<RecordOverflow>(); 880 868 881 if (checkedArea.hasOverflowed() || checkedArea > maxCanvasArea ()) {882 auto message = makeString("Canvas area exceeds the maximum limit (width * height > ", maxCanvasArea (), ").");869 if (checkedArea.hasOverflowed() || checkedArea > maxCanvasArea) { 870 auto message = makeString("Canvas area exceeds the maximum limit (width * height > ", maxCanvasArea, ")."); 883 871 document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, message); 884 872 return; -
trunk/Source/WebCore/html/HTMLCanvasElement.h
r280630 r280646 129 129 void setImageBufferAndMarkDirty(RefPtr<ImageBuffer>&&); 130 130 131 WEBCORE_EXPORT static void setMaxPixelMemoryForTesting(std::optional<size_t>); 132 WEBCORE_EXPORT static void setMaxCanvasAreaForTesting(std::optional<size_t>); 131 WEBCORE_EXPORT static void setMaxPixelMemoryForTesting(size_t); 133 132 134 133 bool needsPreparationForDisplay(); -
trunk/Source/WebCore/testing/Internals.cpp
r280630 r280646 601 601 #endif 602 602 603 HTMLCanvasElement::setMaxPixelMemoryForTesting(std::nullopt); 604 HTMLCanvasElement::setMaxCanvasAreaForTesting(std::nullopt); 603 HTMLCanvasElement::setMaxPixelMemoryForTesting(0); // This means use the default value. 605 604 DOMWindow::overrideTransientActivationDurationForTesting(std::nullopt); 606 605 … … 6011 6010 } 6012 6011 6013 void Internals::setMaxCanvasArea(unsigned size)6014 {6015 HTMLCanvasElement::setMaxCanvasAreaForTesting(size);6016 }6017 6018 6012 int Internals::processIdentifier() const 6019 6013 { -
trunk/Source/WebCore/testing/Internals.h
r280630 r280646 347 347 348 348 void setMaxCanvasPixelMemory(unsigned); 349 void setMaxCanvasArea(unsigned);350 349 351 350 ExceptionOr<unsigned> wheelEventHandlerCount(); -
trunk/Source/WebCore/testing/Internals.idl
r280630 r280646 938 938 939 939 undefined setMaxCanvasPixelMemory(unsigned long size); 940 undefined setMaxCanvasArea(unsigned long size);941 940 942 941 [Conditional=VIDEO] readonly attribute NowPlayingState nowPlayingState;
Note:
See TracChangeset
for help on using the changeset viewer.