From 0132a2727a917d53a28c2dfa4903ec094cabb06f Mon Sep 17 00:00:00 2001 From: "timothy_horton@apple.com" Date: Sat, 6 Sep 2014 00:15:44 +0000 Subject: [PATCH] [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. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173345 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 14 ++++++++++++++ .../platform/graphics/cg/PDFDocumentImage.cpp | 13 +++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 9b0b02a8c41f..8bceb7defe80 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2014-09-05 Tim Horton + + [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 Doing a navigation on a non-opaque WKWebView can result in an empty layer tree diff --git a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp b/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp index 4022fad11e7a..1cbcf5300056 100644 --- a/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp +++ b/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp @@ -144,12 +144,21 @@ static void transformContextForPainting(GraphicsContext* context, const FloatRec 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; -- 2.36.0