Changeset 113628 in webkit
- Timestamp:
- Apr 9, 2012 2:59:05 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r113615 r113628 1 2012-04-09 No'am Rosenthal <noam.rosenthal@nokia.com> 2 3 [Qt][WK2] Accelerated and non-accelerated animations need to be synchronized 4 https://bugs.webkit.org/show_bug.cgi?id=75780 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Remove the ui-side animation code, and return false from addAnimation so that web-side 9 animations kick in. 10 11 * Shared/WebLayerTreeInfo.cpp: 12 (WebKit): 13 * Shared/WebLayerTreeInfo.h: 14 (WebLayerInfo): 15 * UIProcess/WebLayerTreeRenderer.cpp: 16 (WebKit::WebLayerTreeRenderer::paintToCurrentGLContext): 17 (WebKit::WebLayerTreeRenderer::setLayerState): 18 * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp: 19 (WebCore::WebGraphicsLayer::didChangeGeometry): 20 (WebCore::WebGraphicsLayer::syncLayerState): 21 (WebCore::WebGraphicsLayer::computeTransformedVisibleRect): 22 * WebProcess/WebCoreSupport/WebGraphicsLayer.h: 23 (WebGraphicsLayer): 24 1 25 2012-04-09 No'am Rosenthal <noam.rosenthal@nokia.com> 2 26 -
trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp
r109302 r113628 35 35 // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments. 36 36 encoder->encode(CoreIPC::In(id, name, parent, children, flags, replica, mask, imageBackingStoreID)); 37 encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect , animations));37 encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect)); 38 38 } 39 39 … … 43 43 if (!decoder->decode(CoreIPC::Out(info.id, info.name, info.parent, info.children, info.flags, info.replica, info.mask, info.imageBackingStoreID))) 44 44 return false; 45 if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect , info.animations)))45 if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect))) 46 46 return false; 47 47 … … 68 68 return decoder->decode(CoreIPC::Out(info.layerID, info.rect, info.bitmapHandle)); 69 69 } 70 71 void WebLayerAnimation::encode(CoreIPC::ArgumentEncoder* encoder) const72 {73 encoder->encodeEnum(operation);74 encoder->encode(keyframeList);75 encoder->encode(CoreIPC::In(name, startTime, boxSize));76 77 if (operation == WebLayerAnimation::AddAnimation)78 encoder->encode(animation);79 }80 81 bool WebLayerAnimation::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerAnimation& info)82 {83 if (!decoder->decodeEnum(info.operation))84 return false;85 if (!decoder->decode(info.keyframeList))86 return false;87 if (!decoder->decode(CoreIPC::Out(info.name, info.startTime, info.boxSize)))88 return false;89 90 if (info.operation == WebLayerAnimation::AddAnimation)91 if (!decoder->decode(info.animation))92 return false;93 94 return true;95 }96 97 70 } 98 71 #endif -
trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h
r113615 r113628 49 49 }; 50 50 51 struct WebLayerAnimation {52 WebLayerAnimation()53 : operation(InvalidAnimation)54 , keyframeList(WebCore::AnimatedPropertyInvalid)55 , startTime(0) { }56 WebLayerAnimation(const WebCore::KeyframeValueList& valueList)57 : operation(InvalidAnimation)58 , keyframeList(valueList)59 , startTime(0) { }60 61 String name;62 enum Operation {63 AddAnimation,64 RemoveAnimation,65 PauseAnimation,66 InvalidAnimation67 } operation;68 WebCore::IntSize boxSize;69 RefPtr<WebCore::Animation> animation;70 WebCore::KeyframeValueList keyframeList;71 double startTime;72 73 void encode(CoreIPC::ArgumentEncoder*) const;74 static bool decode(CoreIPC::ArgumentDecoder*, WebLayerAnimation&);75 };76 77 51 struct WebLayerInfo { 78 52 WebLayerInfo() … … 112 86 }; 113 87 Vector<WebLayerID> children; 114 Vector<WebLayerAnimation> animations;115 88 RefPtr<ShareableBitmap> imageBackingStore; 116 89 -
trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
r113361 r113628 122 122 m_textureMapper->endClip(); 123 123 m_textureMapper->endPainting(); 124 125 syncAnimations();126 }127 128 void WebLayerTreeRenderer::syncAnimations()129 {130 TextureMapperLayer* layer = toTextureMapperLayer(rootLayer());131 ASSERT(layer);132 133 layer->syncAnimationsRecursively();134 if (layer->descendantsOrSelfHaveRunningAnimations())135 callOnMainThread(bind(&WebLayerTreeRenderer::updateViewport, this));136 124 } 137 125 … … 209 197 layer->setChildren(children); 210 198 211 for (size_t i = 0; i < layerInfo.animations.size(); ++i) {212 const WebKit::WebLayerAnimation anim = layerInfo.animations[i];213 214 switch (anim.operation) {215 case WebKit::WebLayerAnimation::AddAnimation: {216 const IntSize boxSize = anim.boxSize;217 layer->addAnimation(anim.keyframeList, boxSize, anim.animation.get(), anim.name, anim.startTime);218 break;219 }220 case WebKit::WebLayerAnimation::RemoveAnimation:221 layer->removeAnimation(anim.name);222 break;223 case WebKit::WebLayerAnimation::PauseAnimation:224 double offset = WTF::currentTime() - anim.startTime;225 layer->pauseAnimation(anim.name, offset);226 break;227 }228 }229 230 199 if (layerInfo.isRootLayer && m_rootLayerID != id) 231 200 setRootLayerID(id); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
r113615 r113628 23 23 #include "WebGraphicsLayer.h" 24 24 25 #include "Animation.h"26 25 #include "BackingStore.h" 27 26 #include "FloatQuad.h" … … 91 90 , m_maskTarget(0) 92 91 , m_modified(true) 93 , m_hasPendingAnimations(false)94 92 , m_inUpdateMode(false) 95 93 , m_shouldUpdateVisibleRect(true) … … 293 291 294 292 GraphicsLayer::setContentsRect(r); 295 notifyChange();296 }297 298 void WebGraphicsLayer::notifyAnimationStarted(double time)299 {300 if (client())301 client()->notifyAnimationStarted(this, time);302 }303 304 bool WebGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)305 {306 if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity))307 return false;308 309 WebLayerAnimation webAnimation(valueList);310 webAnimation.name = keyframesName;311 webAnimation.operation = WebLayerAnimation::AddAnimation;312 webAnimation.boxSize = boxSize;313 webAnimation.animation = Animation::create(anim);314 webAnimation.startTime = timeOffset;315 m_layerInfo.animations.append(webAnimation);316 if (valueList.property() == AnimatedPropertyWebkitTransform)317 m_transformAnimations.add(keyframesName);318 319 m_hasPendingAnimations = true;320 didChangeGeometry();321 322 return true;323 }324 325 void WebGraphicsLayer::pauseAnimation(const String& animationName, double timeOffset)326 {327 WebLayerAnimation webAnimation;328 webAnimation.name = animationName;329 webAnimation.operation = WebLayerAnimation::PauseAnimation;330 webAnimation.startTime = WTF::currentTime() - timeOffset;331 m_layerInfo.animations.append(webAnimation);332 notifyChange();333 }334 335 void WebGraphicsLayer::removeAnimation(const String& animationName)336 {337 WebLayerAnimation webAnimation;338 webAnimation.name = animationName;339 webAnimation.operation = WebLayerAnimation::RemoveAnimation;340 m_layerInfo.animations.append(webAnimation);341 m_transformAnimations.remove(animationName);342 293 notifyChange(); 343 294 } … … 480 431 481 432 m_modified = false; 482 if (m_hasPendingAnimations)483 notifyAnimationStarted(WTF::currentTime());484 m_layerInfo.animations.clear();485 m_hasPendingAnimations = false;486 433 } 487 434 … … 570 517 IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect() 571 518 { 572 // If this layer is part of an active transform animation, the visible rect might change,573 // so we rather render the whole layer until some better optimization is available.574 519 if (!shouldUseTiledBackingStore()) 575 520 return tiledBackingStoreContentsRect(); … … 699 644 bool WebGraphicsLayer::selfOrAncestorHaveNonAffineTransforms() 700 645 { 701 if (!m_transformAnimations.isEmpty())702 return true;703 704 646 if (!m_layerTransform.combined().isAffine()) 705 647 return true; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h
r113615 r113628 92 92 void setOpacity(float); 93 93 void setContentsRect(const IntRect&); 94 bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double);95 void pauseAnimation(const String&, double);96 void removeAnimation(const String&);97 94 void setContentsToImage(Image*); 98 95 void setMaskLayer(GraphicsLayer*); … … 112 109 void didSynchronize(); 113 110 Image* image() { return m_image.get(); } 114 void notifyAnimationStarted(double);115 111 116 112 GraphicsLayer* maskTarget() const { return m_maskTarget; } … … 148 144 LayerTransform m_layerTransform; 149 145 bool m_modified : 1; 150 bool m_hasPendingAnimations : 1;151 146 bool m_inUpdateMode : 1; 152 147 bool m_shouldUpdateVisibleRect: 1; … … 155 150 void didChangeGeometry(); 156 151 void createBackingStore(); 157 HashSet<String> m_transformAnimations;158 152 159 153 bool selfOrAncestorHaveNonAffineTransforms();
Note: See TracChangeset
for help on using the changeset viewer.