+2014-09-05 Tim Horton <timothy_horton@apple.com>
+
+ [iOS] Work around bug 136593 by disabling the PDFDocumentImage live resize optimization there
+ https://bugs.webkit.org/show_bug.cgi?id=136594
+ rdar://problem/17457013
+
+ Reviewed by Simon Fraser.
+
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::PDFDocumentImage::updateCachedImageIfNeeded):
+ Disable the optimization on iOS, because bug 136593 rears its head
+ most often on iOS because it is more common to have contexts that always
+ use low-quality image interpolation on that platform.
+
2014-09-05 Tim Horton <timothy_horton@apple.com>
Doing a navigation on a non-opaque WKWebView can result in an empty layer tree
void PDFDocumentImage::updateCachedImageIfNeeded(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect)
{
+#if PLATFORM(IOS)
+ // On iOS, some clients use low-quality image interpolation always, which throws off this optimization,
+ // as we never get the subsequent high-quality paint. Since live resize is rare on iOS, disable the optimization.
+ // FIXME (136593): It's also possible to do the wrong thing here if CSS specifies low-quality interpolation via the "image-rendering"
+ // property, on all platforms. We should only do this optimization if we're actually in a ImageQualityController live resize,
+ // and are guaranteed to do a high-quality paint later.
+ bool repaintIfNecessary = true;
+#else
// If we have an existing image, reuse it if we're doing a low-quality paint, even if cache parameters don't match;
// we'll rerender when we do the subsequent high-quality paint.
InterpolationQuality interpolationQuality = context->imageInterpolationQuality();
- bool useLowQualityInterpolation = interpolationQuality == InterpolationNone || interpolationQuality == InterpolationLow;
+ bool repaintIfNecessary = interpolationQuality != InterpolationNone && interpolationQuality != InterpolationLow;
+#endif
- if (!m_cachedImageBuffer || (!cacheParametersMatch(context, dstRect, srcRect) && !useLowQualityInterpolation)) {
+ if (!m_cachedImageBuffer || (!cacheParametersMatch(context, dstRect, srcRect) && repaintIfNecessary)) {
m_cachedImageBuffer = context->createCompatibleBuffer(FloatRect(enclosingIntRect(dstRect)).size());
if (!m_cachedImageBuffer)
return;