[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

simon.fraser at apple.com simon.fraser at apple.com
Wed Dec 22 12:45:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c0065e059d5228a28f58be361c103c57135b7a07
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 28 17:38:59 2010 +0000

    2010-08-28  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Sam Weinig.
    
            When properties are missing from animation keyframes, interpolate between those keyframes that specify them
            https://bugs.webkit.org/show_bug.cgi?id=40794
    
            Some preliminary cleanup; for vectors, prefer indexed access rather than using iterators.
    
            No behavior changes.
    
            * css/CSSStyleSelector.cpp:
            (WebCore::CSSStyleSelector::keyframeStylesForAnimation):
            * page/animation/KeyframeAnimation.cpp:
            (WebCore::KeyframeAnimation::getKeyframeAnimationInterval):
            (WebCore::KeyframeAnimation::validateTransformFunctionList):
            * rendering/RenderLayerBacking.cpp:
            (WebCore::RenderLayerBacking::startAnimation):
            * rendering/style/KeyframeList.h:
            (WebCore::KeyframeList::at):
            (WebCore::KeyframeList::keyframes):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0f6ec65..562b872 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-08-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        When properties are missing from animation keyframes, interpolate between those keyframes that specify them
+        https://bugs.webkit.org/show_bug.cgi?id=40794
+
+        Some preliminary cleanup; for vectors, prefer indexed access rather than using iterators.
+        
+        No behavior changes.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::keyframeStylesForAnimation):
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::getKeyframeAnimationInterval):
+        (WebCore::KeyframeAnimation::validateTransformFunctionList):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::startAnimation):
+        * rendering/style/KeyframeList.h:
+        (WebCore::KeyframeList::at):
+        (WebCore::KeyframeList::keyframes):
+
 2010-08-28  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 0ba63e0..203a414 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -1483,7 +1483,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle*
     
     // If the 0% keyframe is missing, create it (but only if there is at least one other keyframe)
     int initialListSize = list.size();
-    if (initialListSize > 0 && list.beginKeyframes()->key() != 0) {
+    if (initialListSize > 0 && list[0].key() != 0) {
         RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create();
         keyframe->setKeyText("0%");
         keyframeStyle = styleForKeyframe(elementStyle, keyframe.get(), list);
@@ -1491,7 +1491,7 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle*
     }
 
     // If the 100% keyframe is missing, create it (but only if there is at least one other keyframe)
-    if (initialListSize > 0 && (list.endKeyframes() - 1)->key() != 1) {
+    if (initialListSize > 0 && (list[list.size() - 1].key() != 1)) {
         RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create();
         keyframe->setKeyText("100%");
         keyframeStyle = styleForKeyframe(elementStyle, keyframe.get(), list);
diff --git a/WebCore/page/animation/KeyframeAnimation.cpp b/WebCore/page/animation/KeyframeAnimation.cpp
index 2f2cfc0..2f5a73e 100644
--- a/WebCore/page/animation/KeyframeAnimation.cpp
+++ b/WebCore/page/animation/KeyframeAnimation.cpp
@@ -80,19 +80,20 @@ void KeyframeAnimation::getKeyframeAnimationInterval(const RenderStyle*& fromSty
 
     double scale = 1;
     double offset = 0;
-    Vector<KeyframeValue>::const_iterator endKeyframes = m_keyframes.endKeyframes();
-    for (Vector<KeyframeValue>::const_iterator it = m_keyframes.beginKeyframes(); it != endKeyframes; ++it) {
-        if (t < it->key()) {
+    size_t numKeyframes = m_keyframes.size();
+    for (size_t i = 0; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        if (t < currentKeyframe.key()) {
             // The first key should always be 0, so we should never succeed on the first key
             if (!fromStyle)
                 break;
-            scale = 1.0 / (it->key() - offset);
-            toStyle = it->style();
+            scale = 1.0 / (currentKeyframe.key() - offset);
+            toStyle = currentKeyframe.style();
             break;
         }
 
-        offset = it->key();
-        fromStyle = it->style();
+        offset = currentKeyframe.key();
+        fromStyle = currentKeyframe.style();
     }
 
     if (!fromStyle || !toStyle)
@@ -346,27 +347,27 @@ void KeyframeAnimation::validateTransformFunctionList()
     if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitTransform))
         return;
 
-    Vector<KeyframeValue>::const_iterator end = m_keyframes.endKeyframes();
-
     // Empty transforms match anything, so find the first non-empty entry as the reference
-    size_t firstIndex = 0;
-    Vector<KeyframeValue>::const_iterator firstIt = end;
-    
-    for (Vector<KeyframeValue>::const_iterator it = m_keyframes.beginKeyframes(); it != end; ++it, ++firstIndex) {
-        if (it->style()->transform().operations().size() > 0) {
-            firstIt = it;
+    size_t numKeyframes = m_keyframes.size();
+    size_t firstNonEmptyTransformKeyframeIndex = numKeyframes;
+
+    for (size_t i = 0; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        if (currentKeyframe.style()->transform().operations().size()) {
+            firstNonEmptyTransformKeyframeIndex = i;
             break;
         }
     }
     
-    if (firstIt == end)
+    if (firstNonEmptyTransformKeyframeIndex == numKeyframes)
         return;
         
-    const TransformOperations* firstVal = &firstIt->style()->transform();
+    const TransformOperations* firstVal = &m_keyframes[firstNonEmptyTransformKeyframeIndex].style()->transform();
     
     // See if the keyframes are valid
-    for (Vector<KeyframeValue>::const_iterator it = firstIt+1; it != end; ++it) {
-        const TransformOperations* val = &it->style()->transform();
+    for (size_t i = firstNonEmptyTransformKeyframeIndex + 1; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        const TransformOperations* val = &currentKeyframe.style()->transform();
         
         // A null transform matches anything
         if (val->operations().isEmpty())
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index 96d6d1a..43d1945 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -1114,9 +1114,11 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim
     KeyframeValueList transformVector(AnimatedPropertyWebkitTransform);
     KeyframeValueList opacityVector(AnimatedPropertyOpacity);
 
-    for (Vector<KeyframeValue>::const_iterator it = keyframes.beginKeyframes(); it != keyframes.endKeyframes(); ++it) {
-        const RenderStyle* keyframeStyle = it->style();
-        float key = it->key();
+    size_t numKeyframes = keyframes.size();
+    for (size_t i = 0; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = keyframes[i];
+        const RenderStyle* keyframeStyle = currentKeyframe.style();
+        float key = currentKeyframe.key();
 
         if (!keyframeStyle)
             continue;
diff --git a/WebCore/rendering/style/KeyframeList.h b/WebCore/rendering/style/KeyframeList.h
index bb5f180..44a2bdf 100644
--- a/WebCore/rendering/style/KeyframeList.h
+++ b/WebCore/rendering/style/KeyframeList.h
@@ -75,8 +75,7 @@ public:
     void clear();
     bool isEmpty() const { return m_keyframes.isEmpty(); }
     size_t size() const { return m_keyframes.size(); }
-    Vector<KeyframeValue>::const_iterator beginKeyframes() const { return m_keyframes.begin(); }
-    Vector<KeyframeValue>::const_iterator endKeyframes() const { return m_keyframes.end(); }
+    const KeyframeValue& operator[](size_t index) const { return m_keyframes[index]; }
 
 private:
     AtomicString m_animationName;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list