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

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

Issue 19266007: Web Animations: Introduce ActiveAnimations and AnimationStack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/dom/Element.h" 27 #include "core/dom/Element.h"
28 28
29 #include "CSSPropertyNames.h" 29 #include "CSSPropertyNames.h"
30 #include "CSSValueKeywords.h" 30 #include "CSSValueKeywords.h"
31 #include "HTMLNames.h" 31 #include "HTMLNames.h"
32 #include "SVGNames.h" 32 #include "SVGNames.h"
33 #include "XMLNames.h" 33 #include "XMLNames.h"
34 #include "core/accessibility/AXObjectCache.h" 34 #include "core/accessibility/AXObjectCache.h"
35 #include "core/animation/DocumentTimeline.h"
35 #include "core/css/CSSParser.h" 36 #include "core/css/CSSParser.h"
36 #include "core/css/CSSStyleSheet.h" 37 #include "core/css/CSSStyleSheet.h"
37 #include "core/css/CSSValuePool.h" 38 #include "core/css/CSSValuePool.h"
38 #include "core/css/PropertySetCSSStyleDeclaration.h" 39 #include "core/css/PropertySetCSSStyleDeclaration.h"
39 #include "core/css/StylePropertySet.h" 40 #include "core/css/StylePropertySet.h"
40 #include "core/css/resolver/StyleResolver.h" 41 #include "core/css/resolver/StyleResolver.h"
41 #include "core/dom/Attr.h" 42 #include "core/dom/Attr.h"
42 #include "core/dom/Attribute.h" 43 #include "core/dom/Attribute.h"
43 #include "core/dom/ClientRect.h" 44 #include "core/dom/ClientRect.h"
44 #include "core/dom/ClientRectList.h" 45 #include "core/dom/ClientRectList.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 NamedNodeMap* Element::attributes() const 368 NamedNodeMap* Element::attributes() const
368 { 369 {
369 ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareDat a(); 370 ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareDat a();
370 if (NamedNodeMap* attributeMap = rareData->attributeMap()) 371 if (NamedNodeMap* attributeMap = rareData->attributeMap())
371 return attributeMap; 372 return attributeMap;
372 373
373 rareData->setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this))); 374 rareData->setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this)));
374 return rareData->attributeMap(); 375 return rareData->attributeMap();
375 } 376 }
376 377
377 void Element::addActiveAnimation(Animation* animation)
378 {
379 ElementRareData* rareData = ensureElementRareData();
380 if (!rareData->activeAnimations())
381 rareData->setActiveAnimations(adoptPtr(new Vector<Animation*>));
382 rareData->activeAnimations()->append(animation);
383 }
384
385 void Element::removeActiveAnimation(Animation* animation)
386 {
387 ElementRareData* rareData = elementRareData();
388 ASSERT(rareData);
389 size_t position = rareData->activeAnimations()->find(animation);
390 ASSERT(position != notFound);
391 rareData->activeAnimations()->remove(position);
392 }
393
394 bool Element::hasActiveAnimations() const 378 bool Element::hasActiveAnimations() const
395 { 379 {
396 return hasRareData() && elementRareData()->activeAnimations() 380 if (!RuntimeEnabledFeatures::webAnimationsEnabled())
397 && elementRareData()->activeAnimations()->size(); 381 return false;
398 }
399 382
400 Vector<Animation*>* Element::activeAnimations() const 383 if (!document())
401 { 384 return false;
402 if (!elementRareData()) 385
403 return 0; 386 return document()->timeline()->animationStack().hasActiveAnimations(this);
404 return elementRareData()->activeAnimations();
405 } 387 }
406 388
407 Node::NodeType Element::nodeType() const 389 Node::NodeType Element::nodeType() const
408 { 390 {
409 return ELEMENT_NODE; 391 return ELEMENT_NODE;
410 } 392 }
411 393
412 bool Element::hasAttribute(const QualifiedName& name) const 394 bool Element::hasAttribute(const QualifiedName& name) const
413 { 395 {
414 return hasAttributeNS(name.namespaceURI(), name.localName()); 396 return hasAttributeNS(name.namespaceURI(), name.localName());
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3649 return 0; 3631 return 0;
3650 } 3632 }
3651 3633
3652 Attribute* UniqueElementData::attributeItem(unsigned index) 3634 Attribute* UniqueElementData::attributeItem(unsigned index)
3653 { 3635 {
3654 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3636 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3655 return &m_attributeVector.at(index); 3637 return &m_attributeVector.at(index);
3656 } 3638 }
3657 3639
3658 } // namespace WebCore 3640 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698