Title: [198877] tags/Safari-602.1.26/Source/WebCore

Diff

Modified: tags/Safari-602.1.26/Source/WebCore/ChangeLog (198876 => 198877)


--- tags/Safari-602.1.26/Source/WebCore/ChangeLog	2016-03-31 02:13:04 UTC (rev 198876)
+++ tags/Safari-602.1.26/Source/WebCore/ChangeLog	2016-03-31 02:20:36 UTC (rev 198877)
@@ -1,5 +1,29 @@
 2016-03-30  Babak Shafiei  <[email protected]>
 
+        Merge r198875.
+
+    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  Babak Shafiei  <[email protected]>
+
         Merge r198844.
 
     2016-03-30  Keith Miller <[email protected]>

Modified: tags/Safari-602.1.26/Source/WebCore/platform/graphics/ca/TileController.cpp (198876 => 198877)


--- tags/Safari-602.1.26/Source/WebCore/platform/graphics/ca/TileController.cpp	2016-03-31 02:13:04 UTC (rev 198876)
+++ tags/Safari-602.1.26/Source/WebCore/platform/graphics/ca/TileController.cpp	2016-03-31 02:20:36 UTC (rev 198877)
@@ -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: tags/Safari-602.1.26/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (198876 => 198877)


--- tags/Safari-602.1.26/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2016-03-31 02:13:04 UTC (rev 198876)
+++ tags/Safari-602.1.26/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2016-03-31 02:20:36 UTC (rev 198877)
@@ -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

Reply via email to