Added: trunk/LayoutTests/transitions/equivalent-background-image-no-transition.html (0 => 102498)
--- trunk/LayoutTests/transitions/equivalent-background-image-no-transition.html (rev 0)
+++ trunk/LayoutTests/transitions/equivalent-background-image-no-transition.html 2011-12-10 01:26:36 UTC (rev 102498)
@@ -0,0 +1,50 @@
+<html>
+<head>
+ <style>
+ #foo {
+ -webkit-transition: all 0.05s linear, top 0.1s linear;
+ position: absolute;
+ top: 30px;
+ left: 10px;
+ width: 300px;
+ height: 300px;
+ background-image: -webkit-linear-gradient(red, green, blue);
+ }
+ #foo.trans {
+ top: 40px;
+ }
+ </style>
+ <script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+ </script>
+</head>
+<body>
+ <div id="foo">This should not fire a background-image transition.</div>
+
+ <script type="text/_javascript_" charset="utf-8">
+
+ var finished = false;
+
+ document.getElementById('foo').addEventListener('webkitTransitionEnd', function(evt) {
+ if(evt.propertyName == "background-image" && !finished) {
+ document.getElementById('result').innerHTML = ("FAIL: saw a background-image transition");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ finished = true;
+ } else if(evt.propertyName == "top" && !finished) {
+ document.getElementById('result').innerHTML = ("PASS: no background-image transition");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ });
+
+ document.getElementById("foo").className="trans";
+ </script>
+
+ <div id="result">
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (102497 => 102498)
--- trunk/Source/WebCore/ChangeLog 2011-12-10 01:25:29 UTC (rev 102497)
+++ trunk/Source/WebCore/ChangeLog 2011-12-10 01:26:36 UTC (rev 102498)
@@ -1,3 +1,26 @@
+2011-12-09 Tim Horton <[email protected]>
+
+ background-image transitions trigger between equivalent images
+ https://bugs.webkit.org/show_bug.cgi?id=74229
+ <rdar://problem/10558627>
+
+ Reviewed by Darin Adler.
+ Patch by Simon Fraser.
+
+ For animation property wrappers around StyleImage properties,
+ test the equivalence of the image itself, instead of equality of
+ the StyleImage pointer.
+
+ Test: transitions/equivalent-background-image-no-transition.html
+
+ * page/animation/AnimationBase.cpp:
+ (WebCore::StyleImagePropertyWrapper::StyleImagePropertyWrapper):
+ (WebCore::StyleImagePropertyWrapper::equals):
+ (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
+ (WebCore::FillLayerStyleImagePropertyWrapper::equals):
+ (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper):
+ (WebCore::AnimationBase::ensurePropertyMap):
+
2011-12-09 Mary Wu <[email protected]>
Small style fix on DragDataBlackBerry.cpp
Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (102497 => 102498)
--- trunk/Source/WebCore/page/animation/AnimationBase.cpp 2011-12-10 01:25:29 UTC (rev 102497)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp 2011-12-10 01:26:36 UTC (rev 102498)
@@ -371,6 +371,28 @@
void (RenderStyle::*m_setter)(PassRefPtr<T>);
};
+class StyleImagePropertyWrapper : public RefCountedPropertyWrapper<StyleImage> {
+public:
+ StyleImagePropertyWrapper(int prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>))
+ : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter)
+ {
+ }
+
+ virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+ {
+ // If the style pointers are the same, don't bother doing the test.
+ // If either is null, return false. If both are null, return true.
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+
+ StyleImage* imageA = (a->*m_getter)();
+ StyleImage* imageB = (b->*m_getter)();
+ return StyleImage::imagesEquivalent(imageA, imageB);
+ }
+};
+
#if USE(ACCELERATED_COMPOSITING)
class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
public:
@@ -662,7 +684,28 @@
void (FillLayer::*m_setter)(PassRefPtr<T>);
};
+class FillLayerStyleImagePropertyWrapper : public FillLayerRefCountedPropertyWrapper<StyleImage> {
+public:
+ FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>))
+ : FillLayerRefCountedPropertyWrapper<StyleImage>(getter, setter)
+ {
+ }
+ virtual bool equals(const FillLayer* a, const FillLayer* b) const
+ {
+ // If the style pointers are the same, don't bother doing the test.
+ // If either is null, return false. If both are null, return true.
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+
+ StyleImage* imageA = (a->*m_getter)();
+ StyleImage* imageB = (b->*m_getter)();
+ return StyleImage::imagesEquivalent(imageA, imageB);
+ }
+};
+
class FillLayersPropertyWrapper : public PropertyWrapperBase {
public:
typedef const FillLayer* (RenderStyle::*LayersGetter)() const;
@@ -688,7 +731,7 @@
m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::sizeLength, &FillLayer::setSizeLength);
break;
case CSSPropertyBackgroundImage:
- m_fillLayerPropertyWrapper = new FillLayerRefCountedPropertyWrapper<StyleImage>(&FillLayer::image, &FillLayer::setImage);
+ m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper(&FillLayer::image, &FillLayer::setImage);
break;
}
}
@@ -872,13 +915,13 @@
gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
- gPropertyWrappers->append(new RefCountedPropertyWrapper<StyleImage>(CSSPropertyListStyleImage, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage));
- gPropertyWrappers->append(new RefCountedPropertyWrapper<StyleImage>(CSSPropertyWebkitMaskImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage));
+ gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyleImage, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage));
+ gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage));
- gPropertyWrappers->append(new RefCountedPropertyWrapper<StyleImage>(CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource));
+ gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource));
gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSPropertyBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage));
- gPropertyWrappers->append(new RefCountedPropertyWrapper<StyleImage>(CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource));
+ gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource));
gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));