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

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: Rebased. 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
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('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 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 15 matching lines...) Expand all
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 "RuntimeEnabledFeatures.h" 32 #include "RuntimeEnabledFeatures.h"
33 #include "SVGNames.h" 33 #include "SVGNames.h"
34 #include "XMLNames.h" 34 #include "XMLNames.h"
35 #include "core/accessibility/AXObjectCache.h" 35 #include "core/accessibility/AXObjectCache.h"
36 #include "core/animation/DocumentTimeline.h"
36 #include "core/css/CSSParser.h" 37 #include "core/css/CSSParser.h"
37 #include "core/css/CSSStyleSheet.h" 38 #include "core/css/CSSStyleSheet.h"
38 #include "core/css/CSSValuePool.h" 39 #include "core/css/CSSValuePool.h"
39 #include "core/css/PropertySetCSSStyleDeclaration.h" 40 #include "core/css/PropertySetCSSStyleDeclaration.h"
40 #include "core/css/StylePropertySet.h" 41 #include "core/css/StylePropertySet.h"
41 #include "core/css/resolver/StyleResolver.h" 42 #include "core/css/resolver/StyleResolver.h"
42 #include "core/dom/Attr.h" 43 #include "core/dom/Attr.h"
43 #include "core/dom/Attribute.h" 44 #include "core/dom/Attribute.h"
44 #include "core/dom/ClientRect.h" 45 #include "core/dom/ClientRect.h"
45 #include "core/dom/ClientRectList.h" 46 #include "core/dom/ClientRectList.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 NamedNodeMap* Element::attributes() const 367 NamedNodeMap* Element::attributes() const
367 { 368 {
368 ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareDat a(); 369 ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareDat a();
369 if (NamedNodeMap* attributeMap = rareData->attributeMap()) 370 if (NamedNodeMap* attributeMap = rareData->attributeMap())
370 return attributeMap; 371 return attributeMap;
371 372
372 rareData->setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this))); 373 rareData->setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this)));
373 return rareData->attributeMap(); 374 return rareData->attributeMap();
374 } 375 }
375 376
376 void Element::addActiveAnimation(Animation* animation) 377 ActiveAnimations* Element::activeAnimations() const
378 {
379 if (hasActiveAnimations())
380 return elementRareData()->activeAnimations();
381 return 0;
382 }
383
384 ActiveAnimations* Element::ensureActiveAnimations()
377 { 385 {
378 ElementRareData* rareData = ensureElementRareData(); 386 ElementRareData* rareData = ensureElementRareData();
379 if (!rareData->activeAnimations()) 387 if (!elementRareData()->activeAnimations())
380 rareData->setActiveAnimations(adoptPtr(new Vector<Animation*>)); 388 rareData->setActiveAnimations(adoptPtr(new ActiveAnimations()));
381 rareData->activeAnimations()->append(animation); 389 return rareData->activeAnimations();
382 }
383
384 void Element::removeActiveAnimation(Animation* animation)
385 {
386 ElementRareData* rareData = elementRareData();
387 ASSERT(rareData);
388 size_t position = rareData->activeAnimations()->find(animation);
389 ASSERT(position != notFound);
390 rareData->activeAnimations()->remove(position);
391 } 390 }
392 391
393 bool Element::hasActiveAnimations() const 392 bool Element::hasActiveAnimations() const
394 { 393 {
395 return hasRareData() && elementRareData()->activeAnimations() 394 if (!RuntimeEnabledFeatures::webAnimationsEnabled())
396 && elementRareData()->activeAnimations()->size(); 395 return false;
397 }
398 396
399 Vector<Animation*>* Element::activeAnimations() const 397 if (!hasRareData())
400 { 398 return false;
401 if (!elementRareData()) 399
402 return 0; 400 ActiveAnimations* activeAnimations = elementRareData()->activeAnimations();
403 return elementRareData()->activeAnimations(); 401 return activeAnimations && !activeAnimations->isEmpty();
404 } 402 }
405 403
406 Node::NodeType Element::nodeType() const 404 Node::NodeType Element::nodeType() const
407 { 405 {
408 return ELEMENT_NODE; 406 return ELEMENT_NODE;
409 } 407 }
410 408
411 bool Element::hasAttribute(const QualifiedName& name) const 409 bool Element::hasAttribute(const QualifiedName& name) const
412 { 410 {
413 return hasAttributeNS(name.namespaceURI(), name.localName()); 411 return hasAttributeNS(name.namespaceURI(), name.localName());
(...skipping 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 return 0; 3622 return 0;
3625 } 3623 }
3626 3624
3627 Attribute* UniqueElementData::attributeItem(unsigned index) 3625 Attribute* UniqueElementData::attributeItem(unsigned index)
3628 { 3626 {
3629 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3627 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3630 return &m_attributeVector.at(index); 3628 return &m_attributeVector.at(index);
3631 } 3629 }
3632 3630
3633 } // namespace WebCore 3631 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698