Diff
Modified: tags/Safari-604.1.10/Source/WebCore/ChangeLog (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/ChangeLog 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/ChangeLog 2017-03-10 19:15:23 UTC (rev 213721)
@@ -1,3 +1,21 @@
+2017-03-10 Jason Marcell <jmarc...@apple.com>
+
+ Merge r213715. rdar://problem/24709033
+
+ 2017-03-10 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r213618.
+ https://bugs.webkit.org/show_bug.cgi?id=169475
+
+ Suspect this is the cause of a large memory regression
+ (Requested by jonlee_ on #webkit).
+
+ Reverted changeset:
+
+ "Enable async image decoding for large images"
+ https://bugs.webkit.org/show_bug.cgi?id=165039
+ http://trac.webkit.org/changeset/213618
+
2017-03-10 Antti Koivisto <an...@apple.com>
Allow the page to render before <link> stylesheet tags in body
Modified: tags/Safari-604.1.10/Source/WebCore/html/HTMLImageElement.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/html/HTMLImageElement.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/html/HTMLImageElement.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -289,18 +289,8 @@
// image height and width for the alt text instead.
if (!m_imageLoader.image() && !renderImageResource.cachedImage())
renderImage.setImageSizeForAltText();
-
- renderImage.registerForAsyncImageDecodingCallback();
}
-
-void HTMLImageElement::willDetachRenderers()
-{
- if (!is<RenderImage>(renderer()))
- return;
- renderer()->unregisterForAsyncImageDecodingCallback();
-}
-
Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode& insertionPoint)
{
if (m_formSetByParser) {
Modified: tags/Safari-604.1.10/Source/WebCore/html/HTMLImageElement.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/html/HTMLImageElement.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/html/HTMLImageElement.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -105,7 +105,6 @@
void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
void didAttachRenderers() override;
- void willDetachRenderers() override;
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&);
Modified: tags/Safari-604.1.10/Source/WebCore/page/FrameView.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/page/FrameView.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/page/FrameView.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -1058,10 +1058,6 @@
#endif
renderView->compositor().flushPendingLayerChanges(&rootFrameForFlush == m_frame.ptr());
-
- if (TiledBacking* tiledBacking = this->tiledBacking())
- requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes(tiledBacking->tileCoverageRect());
-
return true;
}
@@ -2531,20 +2527,7 @@
updateLayoutViewport();
viewportContentsChanged();
}
-
-void FrameView::applyRecursivelyWithAbsoluteRect(const IntRect& rect, const std::function<void(FrameView&, const IntRect&)>& apply)
-{
- apply(*this, rect);
- // Recursive call for subframes. We cache the current FrameView's windowClipRect to avoid recomputing it for every subframe.
- IntRect windowClipRect = contentsToWindow(rect);
- SetForScope<IntRect*> windowClipRectCache(m_cachedWindowClipRect, &windowClipRect);
- for (Frame* childFrame = frame().tree().firstChild(); childFrame; childFrame = childFrame->tree().nextSibling()) {
- if (auto* childView = childFrame->view())
- childView->applyRecursivelyWithAbsoluteRect(rect, apply);
- }
-}
-
void FrameView::applyRecursivelyWithVisibleRect(const std::function<void (FrameView& frameView, const IntRect& visibleRect)>& apply)
{
IntRect windowClipRect = this->windowClipRect();
@@ -2598,30 +2581,6 @@
});
}
-void FrameView::requestAsyncDecodingForImagesInAbsoluteRect(const IntRect& rect)
-{
- if (!frame().view()) {
- // The frame is being destroyed.
- return;
- }
-
- if (rect.isEmpty())
- return;
-
- if (auto* renderView = frame().contentRenderer())
- renderView->requestAsyncDecodingForImagesInAbsoluteRect(rect);
-}
-
-void FrameView::requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes(const IntRect& rect)
-{
- if (!frame().settings().largeImageAsyncDecodingEnabled())
- return;
-
- applyRecursivelyWithAbsoluteRect(rect, [] (FrameView& frameView, const IntRect& rect) {
- frameView.requestAsyncDecodingForImagesInAbsoluteRect(rect);
- });
-}
-
void FrameView::updateLayerPositionsAfterScrolling()
{
// If we're scrolling as a result of updating the view size after layout, we'll update widgets and layer positions soon anyway.
Modified: tags/Safari-604.1.10/Source/WebCore/page/FrameView.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/page/FrameView.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/page/FrameView.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -275,7 +275,6 @@
void viewportContentsChanged();
WEBCORE_EXPORT void resumeVisibleImageAnimationsIncludingSubframes();
- void requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes(const IntRect&);
String mediaType() const;
WEBCORE_EXPORT void setMediaType(const String&);
@@ -646,11 +645,9 @@
void performPostLayoutTasks();
void autoSizeIfEnabled();
- void applyRecursivelyWithAbsoluteRect(const IntRect&, const std::function<void(FrameView& frameView, const IntRect& rect)>&);
void applyRecursivelyWithVisibleRect(const std::function<void (FrameView& frameView, const IntRect& visibleRect)>&);
void resumeVisibleImageAnimations(const IntRect& visibleRect);
void updateScriptedAnimationsAndTimersThrottlingState(const IntRect& visibleRect);
- void requestAsyncDecodingForImagesInAbsoluteRect(const IntRect&);
void updateLayerFlushThrottling();
WEBCORE_EXPORT void adjustTiledBackingCoverage();
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/BitmapImage.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/BitmapImage.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/BitmapImage.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -67,7 +67,7 @@
{
if (!destroyAll)
m_source.destroyDecodedDataBeforeFrame(m_currentFrame);
- else if (m_source.hasAsyncDecodingQueue())
+ else if (m_source.hasDecodingQueue())
m_source.destroyAllDecodedDataExcludeFrame(m_currentFrame);
else
m_source.destroyAllDecodedData();
@@ -74,7 +74,7 @@
// There's no need to throw away the decoder unless we're explicitly asked
// to destroy all of the frames.
- if (!destroyAll || m_source.hasAsyncDecodingQueue())
+ if (!destroyAll || m_source.hasDecodingQueue())
m_source.clearFrameBufferCache(m_currentFrame);
else
m_source.clear(data());
@@ -103,7 +103,7 @@
NativeImagePtr BitmapImage::frameImageAtIndex(size_t index, const std::optional<SubsamplingLevel>& subsamplingLevel, const std::optional<IntSize>& sizeForDrawing, const GraphicsContext* targetContext)
{
if (!frameHasValidNativeImageAtIndex(index, subsamplingLevel, sizeForDrawing)) {
- LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel was %d, resampling]", __FUNCTION__, this, sourceURL().utf8().data(), static_cast<int>(frameSubsamplingLevelAtIndex(index)));
+ LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel was %d, resampling]", __FUNCTION__, this, sourceURL().characters8(), static_cast<int>(frameSubsamplingLevelAtIndex(index)));
invalidatePlatformData();
}
@@ -164,41 +164,26 @@
m_sizeForDrawing = enclosingIntRect(destRect).size();
StartAnimationResult result = internalStartAnimation();
- if (result == StartAnimationResult::DecodingActive && showDebugBackground()) {
- fillWithSolidColor(context, destRect, Color::yellow, op);
+ Color color;
+ if (result == StartAnimationResult::DecodingActive && showDebugBackground())
+ color = Color::yellow;
+ else
+ color = singlePixelSolidColor();
+
+ if (color.isValid()) {
+ fillWithSolidColor(context, destRect, color, op);
return;
}
- NativeImagePtr image;
- if (frameIsBeingDecodedAtIndex(m_currentFrame, m_sizeForDrawing)) {
- ASSERT(!canAnimate() && !m_currentFrame);
- m_needsRepaint = true;
+ float scale = subsamplingScale(context, destRect, srcRect);
+ m_currentSubsamplingLevel = allowSubsampling() ? m_source.subsamplingLevelForScale(scale) : SubsamplingLevel::Default;
+ LOG(Images, "BitmapImage::%s - %p - url: %s [m_currentFrame = %ld subsamplingLevel = %d scale = %.4f]", __FUNCTION__, this, sourceURL().characters8(), m_currentFrame, static_cast<int>(m_currentSubsamplingLevel), scale);
- if (!frameHasDecodedNativeImage(m_currentFrame)) {
- if (showDebugBackground())
- fillWithSolidColor(context, destRect, Color::yellow, op);
- return;
- }
-
- image = frameImageAtIndex(m_currentFrame);
- } else {
- float scale = subsamplingScale(context, destRect, srcRect);
- m_currentSubsamplingLevel = allowSubsampling() ? m_source.subsamplingLevelForScale(scale) : SubsamplingLevel::Default;
- LOG(Images, "BitmapImage::%s - %p - url: %s [subsamplingLevel = %d scale = %.4f]", __FUNCTION__, this, sourceURL().utf8().data(), static_cast<int>(m_currentSubsamplingLevel), scale);
-
- ASSERT_IMPLIES(result == StartAnimationResult::DecodingActive, m_source.frameHasValidNativeImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing));
- image = frameImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing, &context);
- }
-
+ ASSERT_IMPLIES(result == StartAnimationResult::DecodingActive, m_source.frameHasValidNativeImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing));
+ auto image = frameImageAtIndex(m_currentFrame, m_currentSubsamplingLevel, m_sizeForDrawing, &context);
if (!image) // If it's too early we won't have an image yet.
return;
- Color color = singlePixelSolidColor();
- if (color.isValid()) {
- fillWithSolidColor(context, destRect, color, op);
- return;
- }
-
ImageOrientation orientation(description.imageOrientation());
if (description.respectImageOrientation() == RespectImageOrientation)
orientation = frameOrientationAtIndex(m_currentFrame);
@@ -282,11 +267,11 @@
if (m_frameTimer)
return StartAnimationResult::TimerActive;
-
+
// Don't start a new animation until we draw the frame that is currently being decoded.
size_t nextFrame = (m_currentFrame + 1) % frameCount();
if (frameIsBeingDecodedAtIndex(nextFrame, m_sizeForDrawing)) {
- LOG(Images, "BitmapImage::%s - %p - url: %s [nextFrame = %ld is being decoded]", __FUNCTION__, this, sourceURL().utf8().data(), nextFrame);
+ LOG(Images, "BitmapImage::%s - %p - url: %s [nextFrame = %ld is being decoded]", __FUNCTION__, this, sourceURL().characters8(), nextFrame);
return StartAnimationResult::DecodingActive;
}
@@ -332,9 +317,9 @@
#if !LOG_DISABLED
if (isAsyncDecode)
- LOG(Images, "BitmapImage::%s - %p - url: %s [requesting async decoding for nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), nextFrame);
+ LOG(Images, "BitmapImage::%s - %p - url: %s [requesting async decoding for nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), nextFrame);
else
- LOG(Images, "BitmapImage::%s - %p - url: %s [cachedFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), ++m_cachedFrameCount, nextFrame);
+ LOG(Images, "BitmapImage::%s - %p - url: %s [cachedFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), ++m_cachedFrameCount, nextFrame);
#else
UNUSED_PARAM(isAsyncDecode);
#endif
@@ -361,7 +346,7 @@
return;
}
}
-
+
// Don't advance to nextFrame unless its decoding has finished or was not required.
size_t nextFrame = (m_currentFrame + 1) % frameCount();
if (!frameIsBeingDecodedAtIndex(nextFrame, m_sizeForDrawing))
@@ -370,7 +355,7 @@
// Force repaint if showDebugBackground() is on.
if (showDebugBackground())
imageObserver()->changedInRect(this);
- LOG(Images, "BitmapImage::%s - %p - url: %s [lateFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), ++m_lateFrameCount, nextFrame);
+ LOG(Images, "BitmapImage::%s - %p - url: %s [lateFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), ++m_lateFrameCount, nextFrame);
}
}
@@ -384,7 +369,7 @@
if (imageObserver())
imageObserver()->animationAdvanced(this);
- LOG(Images, "BitmapImage::%s - %p - url: %s [m_currentFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), m_currentFrame);
+ LOG(Images, "BitmapImage::%s - %p - url: %s [m_currentFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), m_currentFrame);
}
void BitmapImage::stopAnimation()
@@ -410,42 +395,13 @@
void BitmapImage::newFrameNativeImageAvailableAtIndex(size_t index)
{
UNUSED_PARAM(index);
- if (canAnimate()) {
- ASSERT(index == (m_currentFrame + 1) % frameCount());
-
- // Don't advance to nextFrame unless the timer was fired before its decoding finishes.
- if (canAnimate() && !m_frameTimer)
- internalAdvanceAnimation();
- else
- LOG(Images, "BitmapImage::%s - %p - url: %s [earlyFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().utf8().data(), ++m_earlyFrameCount, index);
- } else {
- ASSERT(index == m_currentFrame && !m_currentFrame);
-
- if (m_needsRepaint) {
- imageObserver()->changedInRect(this, nullptr);
- m_needsRepaint = false;
- }
-
- // Keep the number of decoding threads under control.
- if (m_source.isAsyncDecodingQueueIdle())
- m_source.stopAsyncDecodingQueue();
- }
-}
+ ASSERT(index == (m_currentFrame + 1) % frameCount());
-void BitmapImage::requestAsyncDecoding(const IntSize& sizeForDrawing)
-{
- if (!isLargeImageAsyncDecodingRequired())
- return;
-
- ASSERT(!m_currentFrame);
- bool isAsyncDecode = m_source.requestFrameAsyncDecodingAtIndex(0, m_currentSubsamplingLevel, sizeForDrawing);
-
-#if !LOG_DISABLED
- if (isAsyncDecode)
- LOG(Images, "BitmapImage::%s - %p - url: %s", __FUNCTION__, this, sourceURL().utf8().data());
-#else
- UNUSED_PARAM(isAsyncDecode);
-#endif
+ // Don't advance to nextFrame unless the timer was fired before its decoding finishes.
+ if (canAnimate() && !m_frameTimer)
+ internalAdvanceAnimation();
+ else
+ LOG(Images, "BitmapImage::%s - %p - url: %s [earlyFrameCount = %ld nextFrame = %ld]", __FUNCTION__, this, sourceURL().characters8(), ++m_earlyFrameCount, index);
}
void BitmapImage::dump(TextStream& ts) const
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/BitmapImage.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/BitmapImage.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/BitmapImage.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -173,7 +173,6 @@
void stopAnimation() override;
void resetAnimation() override;
void newFrameNativeImageAvailableAtIndex(size_t) override;
- void requestAsyncDecoding(const IntSize& sizeForDrawing) override;
// Handle platform-specific data
void invalidatePlatformData();
@@ -208,7 +207,6 @@
RepetitionCount m_repetitionsComplete { RepetitionCountNone }; // How many repetitions we've finished.
double m_desiredFrameStartTime { 0 }; // The system time at which we hope to see the next call to startAnimation().
bool m_animationFinished { false };
- bool m_needsRepaint { false };
float m_frameDecodingDurationForTesting { 0 };
double m_desiredFrameDecodeTimeForTesting { 0 };
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/Image.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/Image.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/Image.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -130,7 +130,6 @@
virtual void stopAnimation() {}
virtual void resetAnimation() {}
virtual void newFrameNativeImageAvailableAtIndex(size_t) { }
- virtual void requestAsyncDecoding(const IntSize&) { }
// Typically the CachedImage that owns us.
ImageObserver* imageObserver() const { return m_imageObserver; }
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageFrameCache.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageFrameCache.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageFrameCache.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -67,7 +67,7 @@
ImageFrameCache::~ImageFrameCache()
{
- ASSERT(!hasAsyncDecodingQueue());
+ ASSERT(!hasDecodingQueue());
}
void ImageFrameCache::destroyDecodedData(size_t frameCount, size_t excludeFrame)
@@ -256,7 +256,7 @@
Ref<WorkQueue> ImageFrameCache::decodingQueue()
{
if (!m_decodingQueue)
- m_decodingQueue = WorkQueue::create("org.webkit.ImageDecoder", WorkQueue::Type::Serial, WorkQueue::QOS::Default);
+ m_decodingQueue = WorkQueue::create("org.webkit.ImageDecoder", WorkQueue::Type::Serial, WorkQueue::QOS::UserInteractive);
return *m_decodingQueue;
}
@@ -263,7 +263,7 @@
void ImageFrameCache::startAsyncDecodingQueue()
{
- if (hasAsyncDecodingQueue() || !isDecoderAvailable())
+ if (hasDecodingQueue() || !isDecoderAvailable())
return;
m_frameRequestQueue.open();
@@ -306,7 +306,7 @@
if (frame.hasValidNativeImage(subsamplingLevel, sizeForDrawing))
return false;
- if (!hasAsyncDecodingQueue())
+ if (!hasDecodingQueue())
startAsyncDecodingQueue();
frame.enqueueSizeForDecoding(sizeForDrawing);
@@ -314,18 +314,9 @@
return true;
}
-bool ImageFrameCache::isAsyncDecodingQueueIdle() const
-{
- for (const ImageFrame& frame : m_frames) {
- if (frame.isBeingDecoded())
- return false;
- }
- return true;
-}
-
void ImageFrameCache::stopAsyncDecodingQueue()
{
- if (!hasAsyncDecodingQueue())
+ if (!hasDecodingQueue())
return;
m_frameRequestQueue.close();
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageFrameCache.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageFrameCache.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageFrameCache.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -71,8 +71,7 @@
void startAsyncDecodingQueue();
bool requestFrameAsyncDecodingAtIndex(size_t, SubsamplingLevel, const IntSize&);
void stopAsyncDecodingQueue();
- bool hasAsyncDecodingQueue() const { return m_decodingQueue; }
- bool isAsyncDecodingQueueIdle() const;
+ bool hasDecodingQueue() { return m_decodingQueue; }
// Image metadata which is calculated either by the ImageDecoder or directly
// from the NativeImage if this class was created for a memory image.
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageSource.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageSource.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/ImageSource.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -70,8 +70,7 @@
bool isAsyncDecodingRequired();
bool requestFrameAsyncDecodingAtIndex(size_t index, SubsamplingLevel subsamplingLevel, const IntSize& sizeForDrawing) { return m_frameCache->requestFrameAsyncDecodingAtIndex(index, subsamplingLevel, sizeForDrawing); }
- bool hasAsyncDecodingQueue() const { return m_frameCache->hasAsyncDecodingQueue(); }
- bool isAsyncDecodingQueueIdle() const { return m_frameCache->isAsyncDecodingQueueIdle(); }
+ bool hasDecodingQueue() const { return m_frameCache->hasDecodingQueue(); }
void stopAsyncDecodingQueue() { m_frameCache->stopAsyncDecodingQueue(); }
// Image metadata which is calculated by the decoder or can deduced by the case of the memory NativeImage.
Modified: tags/Safari-604.1.10/Source/WebCore/platform/graphics/TiledBacking.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/platform/graphics/TiledBacking.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/platform/graphics/TiledBacking.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -145,12 +145,11 @@
virtual IntRect bounds() const = 0;
virtual IntRect boundsWithoutMargin() const = 0;
+ // Exposed for testing
virtual IntRect tileCoverageRect() const = 0;
+ virtual IntRect tileGridExtent() const = 0;
virtual void setScrollingModeIndication(ScrollingModeIndication) = 0;
- // Exposed for testing
- virtual IntRect tileGridExtent() const = 0;
-
#if USE(CA)
virtual PlatformCALayer* tiledScrollingIndicatorLayer() = 0;
#endif
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderElement.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderElement.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderElement.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -154,8 +154,6 @@
view().removeRendererWithPausedImageAnimations(*this);
if (isRegisteredForVisibleInViewportCallback())
view().unregisterForVisibleInViewportCallback(*this);
- if (isRegisteredForAsyncImageDecodingCallback())
- view().unregisterForAsyncImageDecodingCallback(*this);
}
RenderPtr<RenderElement> RenderElement::createFor(Element& element, RenderStyle&& style, RendererCreationType creationType)
@@ -1436,20 +1434,23 @@
return visibleRect.intersects(enclosingIntRect(absoluteClippedOverflowRect()));
}
-bool RenderElement::intersectsAbsoluteRect(const IntRect& rect) const
+static bool shouldRepaintForImageAnimation(const RenderElement& renderer, const IntRect& visibleRect)
{
- if (style().visibility() != VISIBLE)
+ const Document& document = renderer.document();
+ if (document.activeDOMObjectsAreSuspended())
return false;
- if (view().frameView().isOffscreen())
+ if (renderer.style().visibility() != VISIBLE)
return false;
+ if (renderer.view().frameView().isOffscreen())
+ return false;
// Use background rect if we are the root or if we are the body and the background is propagated to the root.
// FIXME: This is overly conservative as the image may not be a background-image, in which case it will not
// be propagated to the root. At this point, we unfortunately don't have access to the image anymore so we
// can no longer check if it is a background image.
- bool backgroundIsPaintedByRoot = isDocumentElementRenderer();
- if (isBody()) {
- auto& rootRenderer = *parent(); // If <body> has a renderer then <html> does too.
+ bool backgroundIsPaintedByRoot = renderer.isDocumentElementRenderer();
+ if (renderer.isBody()) {
+ auto& rootRenderer = *renderer.parent(); // If <body> has a renderer then <html> does too.
ASSERT(rootRenderer.isDocumentElementRenderer());
ASSERT(is<HTMLHtmlElement>(rootRenderer.element()));
// FIXME: Should share body background propagation code.
@@ -1456,8 +1457,11 @@
backgroundIsPaintedByRoot = !rootRenderer.hasBackground();
}
- LayoutRect backgroundPaintingRect = backgroundIsPaintedByRoot ? view().backgroundRect() : absoluteClippedOverflowRect();
- return rect.intersects(enclosingIntRect(backgroundPaintingRect));
+ LayoutRect backgroundPaintingRect = backgroundIsPaintedByRoot ? renderer.view().backgroundRect() : renderer.absoluteClippedOverflowRect();
+ if (!visibleRect.intersects(enclosingIntRect(backgroundPaintingRect)))
+ return false;
+
+ return true;
}
void RenderElement::registerForVisibleInViewportCallback()
@@ -1492,7 +1496,7 @@
{
auto& frameView = view().frameView();
auto visibleRect = frameView.windowToContents(frameView.windowClipRect());
- if (document().activeDOMObjectsAreSuspended() || !intersectsAbsoluteRect(visibleRect)) {
+ if (!shouldRepaintForImageAnimation(*this, visibleRect)) {
// FIXME: It would be better to pass the image along with the renderer
// so that we can be smarter about detecting if the image is inside the
// viewport in repaintForPausedImageAnimationsIfNeeded().
@@ -1505,7 +1509,7 @@
bool RenderElement::repaintForPausedImageAnimationsIfNeeded(const IntRect& visibleRect)
{
ASSERT(m_hasPausedImageAnimations);
- if (document().activeDOMObjectsAreSuspended() || !intersectsAbsoluteRect(visibleRect))
+ if (!shouldRepaintForImageAnimation(*this, visibleRect))
return false;
repaint();
@@ -1516,25 +1520,7 @@
return true;
}
-
-void RenderElement::registerForAsyncImageDecodingCallback()
-{
- if (isRegisteredForAsyncImageDecodingCallback())
- return;
- view().registerForAsyncImageDecodingCallback(*this);
- setIsRegisteredForAsyncImageDecodingCallback(true);
-}
-
-void RenderElement::unregisterForAsyncImageDecodingCallback()
-{
- if (!isRegisteredForAsyncImageDecodingCallback())
- return;
-
- view().unregisterForAsyncImageDecodingCallback(*this);
- setIsRegisteredForAsyncImageDecodingCallback(false);
-}
-
const RenderStyle* RenderElement::getCachedPseudoStyle(PseudoId pseudo, const RenderStyle* parentStyle) const
{
if (pseudo < FIRST_INTERNAL_PSEUDOID && !style().hasPseudoStyle(pseudo))
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderElement.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderElement.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderElement.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -138,7 +138,6 @@
bool borderImageIsLoadedAndCanBeRendered() const;
bool mayCauseRepaintInsideViewport(const IntRect* visibleRect = nullptr) const;
- bool intersectsAbsoluteRect(const IntRect&) const;
// Returns true if this renderer requires a new stacking context.
bool createsGroup() const { return isTransparent() || hasMask() || hasClipPath() || hasFilter() || hasBackdropFilter() || hasBlendMode(); }
@@ -191,9 +190,6 @@
bool repaintForPausedImageAnimationsIfNeeded(const IntRect& visibleRect);
bool hasPausedImageAnimations() const { return m_hasPausedImageAnimations; }
void setHasPausedImageAnimations(bool b) { m_hasPausedImageAnimations = b; }
-
- void registerForAsyncImageDecodingCallback();
- void unregisterForAsyncImageDecodingCallback();
void setRenderBoxNeedsLazyRepaint(bool b) { m_renderBoxNeedsLazyRepaint = b; }
bool renderBoxNeedsLazyRepaint() const { return m_renderBoxNeedsLazyRepaint; }
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderObject.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderObject.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderObject.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -1995,12 +1995,6 @@
if (visible != VisibilityUnknown || hasRareData())
ensureRareData().setVisibleInViewportState(visible);
}
-
-void RenderObject::setIsRegisteredForAsyncImageDecodingCallback(bool registered)
-{
- if (registered || hasRareData())
- ensureRareData().setIsRegisteredForAsyncImageDecodingCallback(registered);
-}
RenderObject::RareDataMap& RenderObject::rareDataMap()
{
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderObject.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderObject.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderObject.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -458,8 +458,6 @@
NotVisibleInViewport,
};
VisibleInViewportState visibleInViewportState() { return m_bitfields.hasRareData() ? rareData().visibleInViewportState() : VisibilityUnknown; }
-
- bool isRegisteredForAsyncImageDecodingCallback() { return m_bitfields.hasRareData() && rareData().isRegisteredForAsyncImageDecodingCallback(); }
bool hasLayer() const { return m_bitfields.hasLayer(); }
@@ -571,7 +569,6 @@
void setHasOutlineAutoAncestor(bool = true);
void setIsRegisteredForVisibleInViewportCallback(bool);
void setVisibleInViewportState(VisibleInViewportState);
- void setIsRegisteredForAsyncImageDecodingCallback(bool);
// Hook so that RenderTextControl can return the line height of its inner renderer.
// For other renderers, the value is the same as lineHeight(false).
@@ -988,7 +985,6 @@
, m_hasOutlineAutoAncestor(false)
, m_isRegisteredForVisibleInViewportCallback(false)
, m_visibleInViewportState(VisibilityUnknown)
- , m_isRegisteredForAsyncImageDecodingCallback(false)
{
}
ADD_BOOLEAN_BITFIELD(isDragging, IsDragging);
@@ -999,7 +995,6 @@
// From RenderElement
ADD_BOOLEAN_BITFIELD(isRegisteredForVisibleInViewportCallback, IsRegisteredForVisibleInViewportCallback);
ADD_ENUM_BITFIELD(visibleInViewportState, VisibleInViewportState, VisibleInViewportState, 2);
- ADD_BOOLEAN_BITFIELD(isRegisteredForAsyncImageDecodingCallback, IsRegisteredForAsyncImageDecodingCallback);
std::unique_ptr<RenderStyle> cachedFirstLineStyle;
};
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderReplaced.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderReplaced.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderReplaced.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -32,7 +32,6 @@
LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override;
LayoutUnit computeReplacedLogicalHeight() const override;
- LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
LayoutRect replacedContentRect(const LayoutSize& intrinsicSize) const;
bool hasReplacedLogicalWidth() const;
@@ -46,6 +45,7 @@
void layout() override;
+ LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const override;
void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const final;
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderView.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderView.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderView.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -35,13 +35,10 @@
#include "HTMLHtmlElement.h"
#include "HTMLIFrameElement.h"
#include "HitTestResult.h"
-#include "Image.h"
#include "ImageQualityController.h"
#include "NodeTraversal.h"
#include "Page.h"
-#include "RenderDescendantIterator.h"
#include "RenderGeometryMap.h"
-#include "RenderImage.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
#include "RenderLayerBacking.h"
@@ -1425,40 +1422,6 @@
removeRendererWithPausedImageAnimations(*renderer);
}
-void RenderView::registerForAsyncImageDecodingCallback(RenderElement& renderer)
-{
- ASSERT(!m_asyncDecodingImageRenderers.contains(&renderer));
- m_asyncDecodingImageRenderers.add(&renderer);
-}
-
-void RenderView::unregisterForAsyncImageDecodingCallback(RenderElement& renderer)
-{
- ASSERT(m_asyncDecodingImageRenderers.contains(&renderer));
- m_asyncDecodingImageRenderers.remove(&renderer);
-}
-
-void RenderView::requestAsyncDecodingForImagesInAbsoluteRect(const IntRect& rect)
-{
- for (auto* renderer : m_asyncDecodingImageRenderers) {
- if (!renderer->intersectsAbsoluteRect(rect))
- continue;
-
- auto& renderImage = downcast<RenderImage>(*renderer);
-
- CachedImage* image = renderImage.cachedImage();
- if (!image || !image->hasImage())
- continue;
-
- // Get the destination rectangle of the image scaled by the all the scaling factors
- // that will eventually be applied to the graphics context.
- LayoutRect replacedContentRect = renderImage.replacedContentRect(renderImage.intrinsicSize());
- FloatRect rect = snapRectToDevicePixels(replacedContentRect, document().deviceScaleFactor());
- rect.scale(frame().page()->pageScaleFactor() * frame().pageZoomFactor() * document().deviceScaleFactor());
-
- image->image()->requestAsyncDecoding(expandedIntSize(rect.size()));
- }
-}
-
RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator(RenderView* view)
: m_rootView(view ? view->document().topDocument().renderView() : nullptr)
{
Modified: tags/Safari-604.1.10/Source/WebCore/rendering/RenderView.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebCore/rendering/RenderView.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebCore/rendering/RenderView.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -231,9 +231,6 @@
void resumePausedImageAnimationsIfNeeded(IntRect visibleRect);
void addRendererWithPausedImageAnimations(RenderElement&);
void removeRendererWithPausedImageAnimations(RenderElement&);
- void registerForAsyncImageDecodingCallback(RenderElement&);
- void unregisterForAsyncImageDecodingCallback(RenderElement&);
- void requestAsyncDecodingForImagesInAbsoluteRect(const IntRect&);
class RepaintRegionAccumulator {
WTF_MAKE_NONCOPYABLE(RepaintRegionAccumulator);
@@ -391,7 +388,6 @@
HashSet<RenderElement*> m_renderersWithPausedImageAnimation;
HashSet<RenderElement*> m_visibleInViewportRenderers;
- HashSet<RenderElement*> m_asyncDecodingImageRenderers;
Vector<RefPtr<RenderWidget>> m_protectedRenderWidgets;
#if ENABLE(SERVICE_CONTROLS)
Modified: tags/Safari-604.1.10/Source/WebKit2/ChangeLog (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebKit2/ChangeLog 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebKit2/ChangeLog 2017-03-10 19:15:23 UTC (rev 213721)
@@ -1,3 +1,21 @@
+2017-03-10 Jason Marcell <jmarc...@apple.com>
+
+ Merge r213715. rdar://problem/24709033
+
+ 2017-03-10 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r213618.
+ https://bugs.webkit.org/show_bug.cgi?id=169475
+
+ Suspect this is the cause of a large memory regression
+ (Requested by jonlee_ on #webkit).
+
+ Reverted changeset:
+
+ "Enable async image decoding for large images"
+ https://bugs.webkit.org/show_bug.cgi?id=165039
+ http://trac.webkit.org/changeset/213618
+
2017-03-10 Zan Dobersek <zdober...@igalia.com>
[WK2] Guard GLib-specific typedefs in InjectedBundle.h with USE(GLIB)
Modified: tags/Safari-604.1.10/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -1691,26 +1691,6 @@
return toImpl(preferencesRef)->linkPreloadEnabled();
}
-void WKPreferencesSetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag)
-{
- toImpl(preferencesRef)->setLargeImageAsyncDecodingEnabled(flag);
-}
-
-bool WKPreferencesGetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef)
-{
- return toImpl(preferencesRef)->largeImageAsyncDecodingEnabled();
-}
-
-void WKPreferencesSetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag)
-{
- toImpl(preferencesRef)->setAnimatedImageAsyncDecodingEnabled(flag);
-}
-
-bool WKPreferencesGetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef)
-{
- return toImpl(preferencesRef)->animatedImageAsyncDecodingEnabled();
-}
-
void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setShouldSuppressKeyboardInputDuringProvisionalNavigation(flag);
Modified: tags/Safari-604.1.10/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (213720 => 213721)
--- tags/Safari-604.1.10/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h 2017-03-10 19:15:23 UTC (rev 213721)
@@ -465,14 +465,6 @@
WK_EXPORT void WKPreferencesSetSubtleCryptoEnabled(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetSubtleCryptoEnabled(WKPreferencesRef);
-// Defaults to true.
-WK_EXPORT void WKPreferencesSetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag);
-WK_EXPORT bool WKPreferencesGetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef);
-
-// Defaults to true.
-WK_EXPORT void WKPreferencesSetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag);
-WK_EXPORT bool WKPreferencesGetAnimatedImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef);
-
// Defaults to false
WK_EXPORT void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef, bool flag);
WK_EXPORT bool WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef);
Modified: tags/Safari-604.1.10/Tools/ChangeLog (213720 => 213721)
--- tags/Safari-604.1.10/Tools/ChangeLog 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Tools/ChangeLog 2017-03-10 19:15:23 UTC (rev 213721)
@@ -1,3 +1,21 @@
+2017-03-10 Jason Marcell <jmarc...@apple.com>
+
+ Merge r213715. rdar://problem/24709033
+
+ 2017-03-10 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r213618.
+ https://bugs.webkit.org/show_bug.cgi?id=169475
+
+ Suspect this is the cause of a large memory regression
+ (Requested by jonlee_ on #webkit).
+
+ Reverted changeset:
+
+ "Enable async image decoding for large images"
+ https://bugs.webkit.org/show_bug.cgi?id=165039
+ http://trac.webkit.org/changeset/213618
+
2017-03-09 Brian Nicholson <bnichol...@mozilla.com> and Alex Christensen <achristen...@webkit.org>
Expose public APIs for content filters
Modified: tags/Safari-604.1.10/Tools/DumpRenderTree/mac/DumpRenderTree.mm (213720 => 213721)
--- tags/Safari-604.1.10/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-03-10 19:15:23 UTC (rev 213721)
@@ -956,8 +956,6 @@
[preferences setHiddenPageCSSAnimationSuspensionEnabled:NO];
[preferences setMediaStreamEnabled:YES];
-
- [preferences setLargeImageAsyncDecodingEnabled:NO];
[WebPreferences _clearNetworkLoaderSession];
[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
Modified: tags/Safari-604.1.10/Tools/WebKitTestRunner/TestController.cpp (213720 => 213721)
--- tags/Safari-604.1.10/Tools/WebKitTestRunner/TestController.cpp 2017-03-10 19:12:26 UTC (rev 213720)
+++ tags/Safari-604.1.10/Tools/WebKitTestRunner/TestController.cpp 2017-03-10 19:15:23 UTC (rev 213721)
@@ -719,8 +719,6 @@
WKCookieManagerDeleteAllCookies(WKContextGetCookieManager(m_context.get()));
WKPreferencesSetMockCaptureDevicesEnabled(preferences, true);
-
- WKPreferencesSetLargeImageAsyncDecodingEnabled(preferences, false);
platformResetPreferencesToConsistentValues();
}