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

Side by Side Diff: Source/core/animation/EffectInput.cpp

Issue 299073003: Web Animations API: Avoid style resolution when calling element.animate() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename test to api-balls-keyframe-animations.html Created 6 years, 7 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 #include "core/animation/KeyframeEffectModel.h" 36 #include "core/animation/KeyframeEffectModel.h"
37 #include "core/animation/StringKeyframe.h" 37 #include "core/animation/StringKeyframe.h"
38 #include "core/css/parser/BisonCSSParser.h" 38 #include "core/css/parser/BisonCSSParser.h"
39 #include "core/css/resolver/StyleResolver.h" 39 #include "core/css/resolver/StyleResolver.h"
40 #include "core/dom/Element.h" 40 #include "core/dom/Element.h"
41 #include "wtf/NonCopyingSort.h" 41 #include "wtf/NonCopyingSort.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 // FIXME: Remove this once we've removed the dependency on Element. 45 // FIXME: Remove this once we've removed the dependency on Element.
46 static bool checkDocumentAndRenderer(Element* element) 46 static bool checkDocument(Element* element)
47 { 47 {
48 if (!element || !element->inActiveDocument()) 48 return (element && element->inActiveDocument());
49 return false;
50 element->document().updateRenderTreeIfNeeded();
51 return element->renderer();
alancutter (OOO until 2018) 2014/05/23 07:01:36 I think we still need to check for renderer() in c
dstockwell 2014/05/23 07:40:58 But, we won't know whether or not there should be
dstockwell 2014/05/23 07:42:25 Wait, why do we care if it's display: none?
dstockwell 2014/05/23 07:44:29 Ahh, because of forceConversions... Hmm, I'm not s
52 } 49 }
53 50
54 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat e, bool unsafe) 51 PassRefPtrWillBeRawPtr<AnimationEffect> EffectInput::convert(Element* element, c onst Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionStat e, bool unsafe)
55 { 52 {
56 // FIXME: This test will not be neccessary once resolution of keyframe value s occurs at 53 // FIXME: This test will not be neccessary once resolution of keyframe value s occurs at
57 // animation application time. 54 // animation application time.
58 if (!unsafe && !checkDocumentAndRenderer(element)) 55 if (!unsafe && !checkDocument(element))
59 return nullptr; 56 return nullptr;
60 57
61 StyleSheetContents* styleSheetContents = element->document().elementSheet(). contents(); 58 StyleSheetContents* styleSheetContents = element->document().elementSheet(). contents();
62 StringKeyframeVector keyframes; 59 StringKeyframeVector keyframes;
63 bool everyFrameHasOffset = true; 60 bool everyFrameHasOffset = true;
64 bool looselySortedByOffset = true; 61 bool looselySortedByOffset = true;
65 double lastOffset = -std::numeric_limits<double>::infinity(); 62 double lastOffset = -std::numeric_limits<double>::infinity();
66 63
67 for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) { 64 for (size_t i = 0; i < keyframeDictionaryVector.size(); ++i) {
68 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); 65 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (!keyframeEffectModel->isReplaceOnly()) { 126 if (!keyframeEffectModel->isReplaceOnly()) {
130 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a re not supported."); 127 exceptionState.throwDOMException(NotSupportedError, "Partial keyframes a re not supported.");
131 return nullptr; 128 return nullptr;
132 } 129 }
133 keyframeEffectModel->forceConversionsToAnimatableValues(element); 130 keyframeEffectModel->forceConversionsToAnimatableValues(element);
134 131
135 return keyframeEffectModel; 132 return keyframeEffectModel;
136 } 133 }
137 134
138 } // namespace WebCore 135 } // namespace WebCore
OLDNEW
« no previous file with comments | « PerformanceTests/Animation/api-balls-keyframe-animations-small.html ('k') | Source/core/animation/StringKeyframe.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698