Diff
Modified: branches/safari-605-branch/LayoutTests/ChangeLog (227881 => 227882)
--- branches/safari-605-branch/LayoutTests/ChangeLog 2018-01-31 09:08:37 UTC (rev 227881)
+++ branches/safari-605-branch/LayoutTests/ChangeLog 2018-01-31 09:09:17 UTC (rev 227882)
@@ -1,3 +1,18 @@
+2018-01-31 Jason Marcell <[email protected]>
+
+ Cherry-pick r227841. rdar://problem/37059544
+
+ 2018-01-30 Dean Jackson <[email protected]>
+
+ CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
+ https://bugs.webkit.org/show_bug.cgi?id=182299
+ <rdar://problem/36853088>
+
+ Reviewed by Simon Fraser.
+
+ * svg/animated-svgImage-scroll-expected.txt: Added.
+ * svg/animated-svgImage-scroll.html: Added.
+
2018-01-30 Jason Marcell <[email protected]>
Cherry-pick r227649. rdar://problem/37019344
Added: branches/safari-605-branch/LayoutTests/svg/animated-svgImage-scroll-expected.txt (0 => 227882)
--- branches/safari-605-branch/LayoutTests/svg/animated-svgImage-scroll-expected.txt (rev 0)
+++ branches/safari-605-branch/LayoutTests/svg/animated-svgImage-scroll-expected.txt 2018-01-31 09:09:17 UTC (rev 227882)
@@ -0,0 +1,8 @@
+Before text
+
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+
+After text
Added: branches/safari-605-branch/LayoutTests/svg/animated-svgImage-scroll.html (0 => 227882)
--- branches/safari-605-branch/LayoutTests/svg/animated-svgImage-scroll.html (rev 0)
+++ branches/safari-605-branch/LayoutTests/svg/animated-svgImage-scroll.html 2018-01-31 09:09:17 UTC (rev 227882)
@@ -0,0 +1,41 @@
+<style>
+ #container {
+ overflow: scroll;
+ width: 300px;
+ height: 200px;
+ }
+ #expander {
+ background-color: blue;
+ height: 500px;
+ }
+</style>
+<p>Before text</p>
+<div id="container">
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ <img src="" width="200" height="100"></img>
+ <p id="expander"></p>
+</div>
+<p>After text</p>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function run() {
+ let container = document.getElementById("container");
+ container.scrollTo(0, 1000);
+ setTimeout(function () {
+ let expander = document.getElementById("expander");
+ expander.style.height = "1px";
+ if (window.testRunner) {
+ setTimeout(function () {
+ testRunner.notifyDone();
+ }, 0);
+ }
+ }, 0);
+}
+
+window.addEventListener("load", run, false);
+</script>
\ No newline at end of file
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227881 => 227882)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-31 09:08:37 UTC (rev 227881)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-31 09:09:17 UTC (rev 227882)
@@ -1,3 +1,32 @@
+2018-01-31 Jason Marcell <[email protected]>
+
+ Cherry-pick r227841. rdar://problem/37059544
+
+ 2018-01-30 Dean Jackson <[email protected]>
+
+ CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
+ https://bugs.webkit.org/show_bug.cgi?id=182299
+ <rdar://problem/36853088>
+
+ Reviewed by Simon Fraser.
+
+ Mostly speculative fix for the case where a scrollTo moves an
+ animated SVG image into view, causing its animation to restart during
+ a paint operation. This was causing a release ASSERT, so we now defer
+ the resumption of the animation into a timer.
+
+ Test: svg/animated-svgImage-scroll.html
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Enqueue the
+ animation if it is an SVGImage.
+ * svg/graphics/SVGImage.cpp: Add a timer to enqueue animation starts.
+ (WebCore::SVGImage::SVGImage):
+ (WebCore::SVGImage::startAnimationTimerFired):
+ (WebCore::SVGImage::enqueueStartAnimation):
+ (WebCore::SVGImage::stopAnimation):
+ * svg/graphics/SVGImage.h:
+
2018-01-30 Jason Marcell <[email protected]>
Cherry-pick r227625. rdar://problem/37019502
Modified: branches/safari-605-branch/Source/WebCore/rendering/RenderElement.cpp (227881 => 227882)
--- branches/safari-605-branch/Source/WebCore/rendering/RenderElement.cpp 2018-01-31 09:08:37 UTC (rev 227881)
+++ branches/safari-605-branch/Source/WebCore/rendering/RenderElement.cpp 2018-01-31 09:09:17 UTC (rev 227882)
@@ -67,6 +67,7 @@
#include "RenderText.h"
#include "RenderTheme.h"
#include "RenderView.h"
+#include "SVGImage.h"
#include "SVGRenderSupport.h"
#include "Settings.h"
#include "ShadowRoot.h"
@@ -1513,8 +1514,14 @@
repaint();
- if (auto* image = cachedImage.image())
- image->startAnimation();
+ if (auto* image = cachedImage.image()) {
+ // SVGImages might cause a layout when starting an animation, so
+ // schedule them rather than start immediately.
+ if (is<SVGImage>(image))
+ downcast<SVGImage>(image)->scheduleStartAnimation();
+ else
+ image->startAnimation();
+ }
// For directly-composited animated GIFs it does not suffice to call repaint() to resume animation. We need to mark the image as changed.
if (is<RenderBoxModelObject>(*this))
Modified: branches/safari-605-branch/Source/WebCore/svg/graphics/SVGImage.cpp (227881 => 227882)
--- branches/safari-605-branch/Source/WebCore/svg/graphics/SVGImage.cpp 2018-01-31 09:08:37 UTC (rev 227881)
+++ branches/safari-605-branch/Source/WebCore/svg/graphics/SVGImage.cpp 2018-01-31 09:09:17 UTC (rev 227882)
@@ -69,6 +69,7 @@
SVGImage::SVGImage(ImageObserver& observer)
: Image(&observer)
+ , m_startAnimationTimer(*this, &SVGImage::startAnimationTimerFired)
{
}
@@ -377,6 +378,19 @@
intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0));
}
+void SVGImage::startAnimationTimerFired()
+{
+ startAnimation();
+}
+
+void SVGImage::scheduleStartAnimation()
+{
+ auto rootElement = this->rootElement();
+ if (!rootElement || !rootElement->animationsPaused())
+ return;
+ m_startAnimationTimer.startOneShot(0_s);
+}
+
void SVGImage::startAnimation()
{
auto rootElement = this->rootElement();
@@ -388,6 +402,7 @@
void SVGImage::stopAnimation()
{
+ m_startAnimationTimer.stop();
auto rootElement = this->rootElement();
if (!rootElement)
return;
Modified: branches/safari-605-branch/Source/WebCore/svg/graphics/SVGImage.h (227881 => 227882)
--- branches/safari-605-branch/Source/WebCore/svg/graphics/SVGImage.h 2018-01-31 09:08:37 UTC (rev 227881)
+++ branches/safari-605-branch/Source/WebCore/svg/graphics/SVGImage.h 2018-01-31 09:09:17 UTC (rev 227882)
@@ -60,6 +60,8 @@
void resetAnimation() final;
bool isAnimating() const final;
+ void scheduleStartAnimation();
+
#if USE(CAIRO)
NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
#endif
@@ -89,6 +91,8 @@
// FIXME: Implement this to be less conservative.
bool currentFrameKnownToBeOpaque() const final { return false; }
+ void startAnimationTimerFired();
+
explicit SVGImage(ImageObserver&);
ImageDrawResult draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode);
@@ -100,6 +104,8 @@
std::unique_ptr<SVGImageChromeClient> m_chromeClient;
std::unique_ptr<Page> m_page;
FloatSize m_intrinsicSize;
+
+ Timer m_startAnimationTimer;
};
bool isInSVGImage(const Element*);