⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280646 in webkit


Ignore:
Timestamp:
Aug 4, 2021, 11:39:37 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r280630.
https://bugs.webkit.org/show_bug.cgi?id=228788

broke some downstream tests

Reverted changeset:

"fast/canvas/canvas-crash.html doesn't test what it intends to
on iOS"
https://bugs.webkit.org/show_bug.cgi?id=228747
https://commits.webkit.org/r280630

Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r280645 r280646  
     12021-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
    1152021-08-04  Arcady Goldmints-Orlov  <agoldmints@igalia.com>
    216
  • trunk/LayoutTests/fast/canvas/canvas-crash.html

    r280630 r280646  
    1313function canvastest()
    1414{
    15     if (window.internals) {
    16         window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4);
    17         window.internals.setMaxCanvasArea(13951 * 11138);
    18     }
    1915    var ctx = document.getCSSCanvasContext("2d", "canvastest", 13951, 11138);
    2016    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  
    1111    if (window.testRunner)
    1212        testRunner.dumpAsText();
    13 
    14     if (window.internals) {
    15         window.internals.setMaxCanvasPixelMemory(16384 * 16384 * 4);
    16         window.internals.setMaxCanvasArea(134217728);
    17     }
    1813
    1914    var canvas = document.getElementById("bigCanvas");
  • trunk/Source/WebCore/ChangeLog

    r280643 r280646  
     12021-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
    1152021-08-04  Antti Koivisto  <antti@apple.com>
    216
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r280630 r280646  
    112112const int defaultHeight = 150;
    113113
    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)
     118const unsigned maxCanvasArea = 4096 * 4096;
     119#else
     120const unsigned maxCanvasArea = 16384 * 16384;
     121#endif
     122
     123static size_t maxActivePixelMemoryForTesting = 0;
    116124
    117125HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document& document)
     
    205213{
    206214    if (maxActivePixelMemoryForTesting)
    207         return *maxActivePixelMemoryForTesting;
     215        return maxActivePixelMemoryForTesting;
    208216
    209217    static size_t maxPixelMemory;
     
    220228}
    221229
    222 void HTMLCanvasElement::setMaxPixelMemoryForTesting(std::optional<size_t> size)
     230void HTMLCanvasElement::setMaxPixelMemoryForTesting(size_t size)
    223231{
    224232    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;
    245233}
    246234
     
    879867    auto checkedArea = size().area<RecordOverflow>();
    880868
    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, ").");
    883871        document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, message);
    884872        return;
  • trunk/Source/WebCore/html/HTMLCanvasElement.h

    r280630 r280646  
    129129    void setImageBufferAndMarkDirty(RefPtr<ImageBuffer>&&);
    130130
    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);
    133132
    134133    bool needsPreparationForDisplay();
  • trunk/Source/WebCore/testing/Internals.cpp

    r280630 r280646  
    601601#endif
    602602
    603     HTMLCanvasElement::setMaxPixelMemoryForTesting(std::nullopt);
    604     HTMLCanvasElement::setMaxCanvasAreaForTesting(std::nullopt);
     603    HTMLCanvasElement::setMaxPixelMemoryForTesting(0); // This means use the default value.
    605604    DOMWindow::overrideTransientActivationDurationForTesting(std::nullopt);
    606605
     
    60116010}
    60126011
    6013 void Internals::setMaxCanvasArea(unsigned size)
    6014 {
    6015     HTMLCanvasElement::setMaxCanvasAreaForTesting(size);
    6016 }
    6017 
    60186012int Internals::processIdentifier() const
    60196013{
  • trunk/Source/WebCore/testing/Internals.h

    r280630 r280646  
    347347
    348348    void setMaxCanvasPixelMemory(unsigned);
    349     void setMaxCanvasArea(unsigned);
    350349
    351350    ExceptionOr<unsigned> wheelEventHandlerCount();
  • trunk/Source/WebCore/testing/Internals.idl

    r280630 r280646  
    938938
    939939    undefined setMaxCanvasPixelMemory(unsigned long size);
    940     undefined setMaxCanvasArea(unsigned long size);
    941940
    942941    [Conditional=VIDEO] readonly attribute NowPlayingState nowPlayingState;
Note: See TracChangeset for help on using the changeset viewer.