Title: [198875] trunk/Source/WebCore
- Revision
- 198875
- Author
- [email protected]
- Date
- 2016-03-30 19:07:47 -0700 (Wed, 30 Mar 2016)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (198874 => 198875)
--- trunk/Source/WebCore/ChangeLog 2016-03-31 02:07:17 UTC (rev 198874)
+++ trunk/Source/WebCore/ChangeLog 2016-03-31 02:07:47 UTC (rev 198875)
@@ -1,3 +1,23 @@
+2016-03-30 Simon Fraser <[email protected]>
+
+ [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.
+
2016-03-30 Gyuyoung Kim <[email protected]>
[EFL][CMake] WebKit include path has been added to system include path
Modified: trunk/Source/WebCore/platform/graphics/ca/TileController.cpp (198874 => 198875)
--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp 2016-03-31 02:07:17 UTC (rev 198874)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp 2016-03-31 02:07:47 UTC (rev 198875)
@@ -36,6 +36,10 @@
#include <utility>
#include <wtf/MainThread.h>
+#if USE(IOSURFACE)
+#include "IOSurface.h"
+#endif
+
#if PLATFORM(IOS)
#include "MemoryPressureHandler.h"
#include "TileControllerMemoryHandlerIOS.h"
@@ -489,16 +493,23 @@
if (m_inLiveResize || m_tileSizeLocked)
return tileGrid().tileSize();
+ IntSize maxTileSize(kGiantTileSize, kGiantTileSize);
+#if USE(IOSURFACE)
+ IntSize surfaceSizeLimit = IOSurface::maximumSize();
+ surfaceSizeLimit.scale(1 / m_deviceScaleFactor);
+ maxTileSize = maxTileSize.shrunkTo(surfaceSizeLimit);
+#endif
+
if (owningGraphicsLayer()->platformCALayerUseGiantTiles())
- return IntSize(kGiantTileSize, kGiantTileSize);
+ return maxTileSize;
IntSize tileSize(kDefaultTileSize, kDefaultTileSize);
if (m_scrollability == NotScrollable) {
IntSize scaledSize = expandedIntSize(boundsWithoutMargin().size() * tileGrid().scale());
- tileSize = scaledSize.constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
+ tileSize = scaledSize.constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), maxTileSize);
} else if (m_scrollability == VerticallyScrollable)
- tileSize.setWidth(std::min(std::max<int>(ceilf(boundsWithoutMargin().width() * tileGrid().scale()), kDefaultTileSize), kGiantTileSize));
+ tileSize.setWidth(std::min(std::max<int>(ceilf(boundsWithoutMargin().width() * tileGrid().scale()), kDefaultTileSize), maxTileSize.width()));
LOG_WITH_STREAM(Scrolling, stream << "TileController::tileSize newSize=" << tileSize);
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (198874 => 198875)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2016-03-31 02:07:17 UTC (rev 198874)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2016-03-31 02:07:47 UTC (rev 198875)
@@ -239,7 +239,13 @@
IntSize IOSurface::maximumSize()
{
- return IntSize(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth), IOSurfaceGetPropertyMaximum(kIOSurfaceHeight));
+ IntSize maxSize(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth), IOSurfaceGetPropertyMaximum(kIOSurfaceHeight));
+#if PLATFORM(IOS)
+ // Match limits imposed by CA. FIXME: should have API for this <rdar://problem/25454148>
+ const int iOSMaxSurfaceDimension = 8 * 1024;
+ maxSize = maxSize.shrunkTo({ iOSMaxSurfaceDimension, iOSMaxSurfaceDimension });
+#endif
+ return maxSize;
}
MachSendRight IOSurface::createSendRight() const
@@ -288,7 +294,7 @@
case Format::RGB10:
case Format::RGB10A8:
// A half-float format will be used if CG needs to read back the IOSurface contents,
- // but for an IOSurface-to-IOSurface copy, there shoud be no conversion.
+ // but for an IOSurface-to-IOSurface copy, there should be no conversion.
bitsPerComponent = 16;
bitsPerPixel = 64;
bitmapInfo = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder16Host | kCGBitmapFloatComponents;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes