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

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: Update comment. 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SVG images never have composited animations we can update
534 // animations directly without worrying about including
535 // PaintArtifactCompositor analysis of whether animations should be
536 // composited.
537 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
538 DocumentAnimations::updateAnimations(frameView->layoutView()->document(),
539 DocumentLifecycle::LayoutClean);
540 }
529 } 541 }
530 542
531 void SVGImage::advanceAnimationForTesting() { 543 void SVGImage::advanceAnimationForTesting() {
532 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) { 544 if (SVGSVGElement* rootElement = svgRootElement(m_page.get())) {
533 rootElement->timeContainer()->advanceFrameForTesting(); 545 rootElement->timeContainer()->advanceFrameForTesting();
534 546
535 // The following triggers animation updates which can issue a new draw 547 // The following triggers animation updates which can issue a new draw
536 // but will not permanently change the animation timeline. 548 // but will not permanently change the animation timeline.
537 // TODO(pdr): Actually advance the document timeline so CSS animations 549 // TODO(pdr): Actually advance the document timeline so CSS animations
538 // can be properly tested. 550 // can be properly tested.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 664 }
653 665
654 return m_page ? SizeAvailable : SizeUnavailable; 666 return m_page ? SizeAvailable : SizeUnavailable;
655 } 667 }
656 668
657 String SVGImage::filenameExtension() const { 669 String SVGImage::filenameExtension() const {
658 return "svg"; 670 return "svg";
659 } 671 }
660 672
661 } // namespace blink 673 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698