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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 73643004: Web Animations: Extract an API for servicing animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/frame/FrameView.cpp » ('j') | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 25 matching lines...) Expand all
36 #include "XMLNSNames.h" 36 #include "XMLNSNames.h"
37 #include "XMLNames.h" 37 #include "XMLNames.h"
38 #include "bindings/v8/CustomElementConstructorBuilder.h" 38 #include "bindings/v8/CustomElementConstructorBuilder.h"
39 #include "bindings/v8/Dictionary.h" 39 #include "bindings/v8/Dictionary.h"
40 #include "bindings/v8/ExceptionMessages.h" 40 #include "bindings/v8/ExceptionMessages.h"
41 #include "bindings/v8/ExceptionState.h" 41 #include "bindings/v8/ExceptionState.h"
42 #include "bindings/v8/ExceptionStatePlaceholder.h" 42 #include "bindings/v8/ExceptionStatePlaceholder.h"
43 #include "bindings/v8/ScriptController.h" 43 #include "bindings/v8/ScriptController.h"
44 #include "core/accessibility/AXObjectCache.h" 44 #include "core/accessibility/AXObjectCache.h"
45 #include "core/animation/AnimationClock.h" 45 #include "core/animation/AnimationClock.h"
46 #include "core/animation/DocumentAnimations.h"
46 #include "core/animation/DocumentTimeline.h" 47 #include "core/animation/DocumentTimeline.h"
47 #include "core/animation/css/TransitionTimeline.h" 48 #include "core/animation/css/TransitionTimeline.h"
48 #include "core/css/CSSDefaultStyleSheets.h" 49 #include "core/css/CSSDefaultStyleSheets.h"
49 #include "core/css/CSSFontSelector.h" 50 #include "core/css/CSSFontSelector.h"
50 #include "core/css/CSSStyleDeclaration.h" 51 #include "core/css/CSSStyleDeclaration.h"
51 #include "core/css/CSSStyleSheet.h" 52 #include "core/css/CSSStyleSheet.h"
52 #include "core/css/MediaQueryMatcher.h" 53 #include "core/css/MediaQueryMatcher.h"
53 #include "core/css/StylePropertySet.h" 54 #include "core/css/StylePropertySet.h"
54 #include "core/css/StyleSheetContents.h" 55 #include "core/css/StyleSheetContents.h"
55 #include "core/css/StyleSheetList.h" 56 #include "core/css/StyleSheetList.h"
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& e xceptionState) 1502 PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho w, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& e xceptionState)
1502 { 1503 {
1503 UNUSED_PARAM(expandEntityReferences); 1504 UNUSED_PARAM(expandEntityReferences);
1504 if (!root) { 1505 if (!root) {
1505 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r); 1506 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro r);
1506 return 0; 1507 return 0;
1507 } 1508 }
1508 return TreeWalker::create(root, whatToShow, filter); 1509 return TreeWalker::create(root, whatToShow, filter);
1509 } 1510 }
1510 1511
1511 void Document::serviceAnimations(double monotonicAnimationStartTime)
1512 {
1513 if (!RuntimeEnabledFeatures::webAnimationsEnabled())
1514 return;
1515
1516 animationClock().updateTime(monotonicAnimationStartTime);
1517 bool didTriggerStyleRecalc = timeline()->serviceAnimations();
1518 didTriggerStyleRecalc |= transitionTimeline()->serviceAnimations();
1519 if (!didTriggerStyleRecalc)
1520 animationClock().unfreeze();
1521 }
1522
1523 void Document::dispatchAnimationEvents()
1524 {
1525 if (!RuntimeEnabledFeatures::webAnimationsEnabled())
1526 return;
1527
1528 timeline()->dispatchEvents();
1529 transitionTimeline()->dispatchEvents();
1530 }
1531
1532 void Document::scheduleStyleRecalc() 1512 void Document::scheduleStyleRecalc()
1533 { 1513 {
1534 if (shouldDisplaySeamlesslyWithParent()) { 1514 if (shouldDisplaySeamlesslyWithParent()) {
1535 // When we're seamless, our parent document manages our style recalcs. 1515 // When we're seamless, our parent document manages our style recalcs.
1536 ownerElement()->setNeedsStyleRecalc(); 1516 ownerElement()->setNeedsStyleRecalc();
1537 ownerElement()->document().scheduleStyleRecalc(); 1517 ownerElement()->document().scheduleStyleRecalc();
1538 return; 1518 return;
1539 } 1519 }
1540 1520
1541 if (m_styleRecalcTimer.isActive()) 1521 if (m_styleRecalcTimer.isActive())
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 { 1745 {
1766 ASSERT(isMainThread()); 1746 ASSERT(isMainThread());
1767 ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting())); 1747 ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting()));
1768 1748
1769 if (!needsStyleRecalc() && !childNeedsStyleRecalc() && !childNeedsDistributi onRecalc()) 1749 if (!needsStyleRecalc() && !childNeedsStyleRecalc() && !childNeedsDistributi onRecalc())
1770 return; 1750 return;
1771 1751
1772 AnimationUpdateBlock animationUpdateBlock(m_frame ? &m_frame->animation() : 0); 1752 AnimationUpdateBlock animationUpdateBlock(m_frame ? &m_frame->animation() : 0);
1773 recalcStyle(NoChange); 1753 recalcStyle(NoChange);
1774 1754
1775 if (RuntimeEnabledFeatures::webAnimationsEnabled()) 1755 DocumentAnimations::serviceAfterStyleRecalc(*this);
1776 cssPendingAnimations().startPendingAnimations();
1777 m_animationClock->unfreeze();
1778 } 1756 }
1779 1757
1780 void Document::updateStyleForNodeIfNeeded(Node* node) 1758 void Document::updateStyleForNodeIfNeeded(Node* node)
1781 { 1759 {
1782 if (!hasPendingForcedStyleRecalc() && !childNeedsStyleRecalc() && !needsStyl eRecalc()) 1760 if (!hasPendingForcedStyleRecalc() && !childNeedsStyleRecalc() && !needsStyl eRecalc())
1783 return; 1761 return;
1784 1762
1785 bool needsStyleRecalc = hasPendingForcedStyleRecalc(); 1763 bool needsStyleRecalc = hasPendingForcedStyleRecalc();
1786 for (Node* ancestor = node; ancestor && !needsStyleRecalc; ancestor = ancest or->parentOrShadowHostNode()) 1764 for (Node* ancestor = node; ancestor && !needsStyleRecalc; ancestor = ancest or->parentOrShadowHostNode())
1787 needsStyleRecalc = ancestor->needsStyleRecalc(); 1765 needsStyleRecalc = ancestor->needsStyleRecalc();
(...skipping 3424 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5190 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5213 { 5191 {
5214 if (!isActive()) 5192 if (!isActive())
5215 return; 5193 return;
5216 5194
5217 styleEngine()->modifiedStyleSheet(sheet); 5195 styleEngine()->modifiedStyleSheet(sheet);
5218 styleResolverChanged(when, updateMode); 5196 styleResolverChanged(when, updateMode);
5219 } 5197 }
5220 5198
5221 } // namespace WebCore 5199 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698