Changeset 198875 in webkit


Ignore:
Timestamp:
Mar 30, 2016 7:07:47 PM (8 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Avoid creating tiles that are too large for rendering
https://bugs.webkit.org/show_bug.cgi?id=156050
rdar://problem/25424541

Reviewed by Darin Adler.

In the case of a WKWebView which is sized large enough to show an entire document
(for example, when enclosed inside a UIScrollView), we would create tiles that were
larger than CoreAnimation was willing to deal with.

  • platform/graphics/ca/TileController.cpp:

(WebCore::TileController::tileSize): Take the device scale, and the max IOSurface size
into account when computing the max tile size.

  • platform/graphics/cocoa/IOSurface.mm:

(IOSurface::maximumSize): CoreAnimation imposes limits in addition to the size reported
by IOSurfaceGetPropertyMaximum(), namely an 8k cap, so mimic that here.
(IOSurface::ensurePlatformContext): Typo.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r198871 r198875  
     12016-03-30  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Avoid creating tiles that are too large for rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=156050
     5        rdar://problem/25424541
     6
     7        Reviewed by Darin Adler.
     8
     9        In the case of a WKWebView which is sized large enough to show an entire document
     10        (for example, when enclosed inside a UIScrollView), we would create tiles that were
     11        larger than CoreAnimation was willing to deal with.
     12       
     13        * platform/graphics/ca/TileController.cpp:
     14        (WebCore::TileController::tileSize): Take the device scale, and the max IOSurface size
     15        into account when computing the max tile size.
     16        * platform/graphics/cocoa/IOSurface.mm:
     17        (IOSurface::maximumSize): CoreAnimation imposes limits in addition to the size reported
     18        by IOSurfaceGetPropertyMaximum(), namely an 8k cap, so mimic that here.
     19        (IOSurface::ensurePlatformContext): Typo.
     20
    1212016-03-30  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    222
  • trunk/Source/WebCore/platform/graphics/ca/TileController.cpp

    r198502 r198875  
    3737#include <wtf/MainThread.h>
    3838
     39#if USE(IOSURFACE)
     40#include "IOSurface.h"
     41#endif
     42
    3943#if PLATFORM(IOS)
    4044#include "MemoryPressureHandler.h"
     
    490494        return tileGrid().tileSize();
    491495
     496    IntSize maxTileSize(kGiantTileSize, kGiantTileSize);
     497#if USE(IOSURFACE)
     498    IntSize surfaceSizeLimit = IOSurface::maximumSize();
     499    surfaceSizeLimit.scale(1 / m_deviceScaleFactor);
     500    maxTileSize = maxTileSize.shrunkTo(surfaceSizeLimit);
     501#endif
     502   
    492503    if (owningGraphicsLayer()->platformCALayerUseGiantTiles())
    493         return IntSize(kGiantTileSize, kGiantTileSize);
     504        return maxTileSize;
    494505
    495506    IntSize tileSize(kDefaultTileSize, kDefaultTileSize);
     
    497508    if (m_scrollability == NotScrollable) {
    498509        IntSize scaledSize = expandedIntSize(boundsWithoutMargin().size() * tileGrid().scale());
    499         tileSize = scaledSize.constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
     510        tileSize = scaledSize.constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), maxTileSize);
    500511    } else if (m_scrollability == VerticallyScrollable)
    501         tileSize.setWidth(std::min(std::max<int>(ceilf(boundsWithoutMargin().width() * tileGrid().scale()), kDefaultTileSize), kGiantTileSize));
     512        tileSize.setWidth(std::min(std::max<int>(ceilf(boundsWithoutMargin().width() * tileGrid().scale()), kDefaultTileSize), maxTileSize.width()));
    502513
    503514    LOG_WITH_STREAM(Scrolling, stream << "TileController::tileSize newSize=" << tileSize);
  • trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm

    r195979 r198875  
    240240IntSize IOSurface::maximumSize()
    241241{
    242     return IntSize(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth), IOSurfaceGetPropertyMaximum(kIOSurfaceHeight));
     242    IntSize maxSize(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth), IOSurfaceGetPropertyMaximum(kIOSurfaceHeight));
     243#if PLATFORM(IOS)
     244    // Match limits imposed by CA. FIXME: should have API for this <rdar://problem/25454148>
     245    const int iOSMaxSurfaceDimension = 8 * 1024;
     246    maxSize = maxSize.shrunkTo({ iOSMaxSurfaceDimension, iOSMaxSurfaceDimension });
     247#endif
     248    return maxSize;
    243249}
    244250
     
    289295    case Format::RGB10A8:
    290296        // A half-float format will be used if CG needs to read back the IOSurface contents,
    291         // but for an IOSurface-to-IOSurface copy, there shoud be no conversion.
     297        // but for an IOSurface-to-IOSurface copy, there should be no conversion.
    292298        bitsPerComponent = 16;
    293299        bitsPerPixel = 64;
Note: See TracChangeset for help on using the changeset viewer.