Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1370)

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2693363002: Move animation update to follow paint phase for SPv2. (Closed)
Patch Set: Call updateAnimations in SVGImage for SPv2. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "core/svg/graphics/SVGImage.h" 28 #include "core/svg/graphics/SVGImage.h"
29 29
30 #include "core/animation/DocumentAnimations.h"
30 #include "core/animation/DocumentTimeline.h" 31 #include "core/animation/DocumentTimeline.h"
31 #include "core/dom/NodeTraversal.h" 32 #include "core/dom/NodeTraversal.h"
32 #include "core/dom/shadow/FlatTreeTraversal.h" 33 #include "core/dom/shadow/FlatTreeTraversal.h"
33 #include "core/frame/FrameView.h" 34 #include "core/frame/FrameView.h"
34 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
35 #include "core/frame/Settings.h" 36 #include "core/frame/Settings.h"
37 #include "core/layout/LayoutView.h"
36 #include "core/layout/svg/LayoutSVGRoot.h" 38 #include "core/layout/svg/LayoutSVGRoot.h"
37 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
38 #include "core/paint/FloatClipRecorder.h" 40 #include "core/paint/FloatClipRecorder.h"
39 #include "core/paint/TransformRecorder.h" 41 #include "core/paint/TransformRecorder.h"
40 #include "core/style/ComputedStyle.h" 42 #include "core/style/ComputedStyle.h"
41 #include "core/svg/SVGDocumentExtensions.h" 43 #include "core/svg/SVGDocumentExtensions.h"
42 #include "core/svg/SVGFEImageElement.h" 44 #include "core/svg/SVGFEImageElement.h"
43 #include "core/svg/SVGImageElement.h" 45 #include "core/svg/SVGImageElement.h"
44 #include "core/svg/SVGSVGElement.h" 46 #include "core/svg/SVGSVGElement.h"
45 #include "core/svg/animation/SMILTimeContainer.h" 47 #include "core/svg/animation/SMILTimeContainer.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // The calls below may trigger GCs, so set up the required persistent 518 // The calls below may trigger GCs, so set up the required persistent
517 // reference on the ImageResourceContent which owns this SVGImage. By 519 // reference on the ImageResourceContent which owns this SVGImage. By
518 // transitivity, that will keep the associated SVGImageChromeClient object 520 // transitivity, that will keep the associated SVGImageChromeClient object
519 // alive. 521 // alive.
520 Persistent<ImageObserver> protect(getImageObserver()); 522 Persistent<ImageObserver> protect(getImageObserver());
521 m_page->animator().serviceScriptedAnimations(monotonicAnimationStartTime); 523 m_page->animator().serviceScriptedAnimations(monotonicAnimationStartTime);
522 // Do *not* update the paint phase. It's critical to paint only when 524 // Do *not* update the paint phase. It's critical to paint only when
523 // actually generating painted output, not only for performance reasons, 525 // actually generating painted output, not only for performance reasons,
524 // but to preserve correct coherence of the cache of the output with 526 // but to preserve correct coherence of the cache of the output with
525 // the needsRepaint bits of the PaintLayers in the image. 527 // the needsRepaint bits of the PaintLayers in the image.
526 toLocalFrame(m_page->mainFrame()) 528 FrameView* frameView = toLocalFrame(m_page->mainFrame())->view();
527 ->view() 529 frameView->updateAllLifecyclePhasesExceptPaint();
528 ->updateAllLifecyclePhasesExceptPaint(); 530
531 // For SPv2 we run updateAnimations after the paint phase, but per above
532 // comment we don't want to run lifecycle through to paint for SVG images.
533 // Since we know that SVG images never have composited animations, we can just
534 // update animations directly here without worrying about including
535 // PaintArtifactCompositor analysis of whether animations should be
536 // composited.
537 // TODO(wkorman): I'm not actually sure whether this is kosher. Is it possible
wkorman 2017/02/16 23:42:08 This patch now fixes the SVG image test that was f
wkorman 2017/02/17 19:35:14 I looked through things and I think this is ok too
538 // that a potentially-compositable-animation, call it 'A', is added, but
539 // FrameView hasn't yet run updateAnimations(), and then our SVG animation
540 // timer fires and we run updateAnimations() below, but without the
541 // PAC-provided info we need to potentially decide not to composite 'A'. Then
542 // updateAnimations() will analyze and start all animations, and could
543 // potentially end up compositing something we'd want not to composite.
544 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
545 DocumentAnimations::updateAnimations(frameView->layoutView()->document(),
546 DocumentLifecycle::LayoutClean);
547 }
529 } 548 }
530 549
531 void SVGImage::advanceAnimationForTesting() { 550 void SVGImage::advanceAnimationForTesting() {
532 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) { 551 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) {
533 rootElement->timeContainer()->advanceFrameForTesting(); 552 rootElement->timeContainer()->advanceFrameForTesting();
534 553
535 // The following triggers animation updates which can issue a new draw 554 // The following triggers animation updates which can issue a new draw
536 // but will not permanently change the animation timeline. 555 // but will not permanently change the animation timeline.
537 // TODO(pdr): Actually advance the document timeline so CSS animations 556 // TODO(pdr): Actually advance the document timeline so CSS animations
538 // can be properly tested. 557 // can be properly tested.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 671 }
653 672
654 return m_page ? SizeAvailable : SizeUnavailable; 673 return m_page ? SizeAvailable : SizeUnavailable;
655 } 674 }
656 675
657 String SVGImage::filenameExtension() const { 676 String SVGImage::filenameExtension() const {
658 return "svg"; 677 return "svg";
659 } 678 }
660 679
661 } // namespace blink 680 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698