It was taking a string type. I figured out how to make it take an ident instead, so you can write:
transition-property: opacity
instead of
transition-property: "opacity"
Transition layers also weren't properly repeating patterns the way they were supposed to. I fixed that.
Finally, I fixed a bug in the code to fix up transition layers where something was misplaced that should have been inside a null check.
Reviewed by aroben
* css/CSSHelper.h:
* css/CSSParser.cpp:
(WebCore::CSSParser::parseTransitionProperty):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::adjustRenderStyle):
* page/AnimationController.cpp:
(WebCore::ImplicitAnimation::animate):
* rendering/RenderStyle.cpp:
(WebCore::RenderStyle::adjustTransitions):
* rendering/RenderStyle.h:
(WebCore::RenderStyle::initialTransitionProperty):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27291
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-10-30 David Hyatt <hyatt@apple.com>
+
+ transition-property was defaulting to all when it should default to none.
+
+ It was taking a string type. I figured out how to make it take an ident instead, so you can write:
+
+ transition-property: opacity
+
+ instead of
+
+ transition-property: "opacity"
+
+ Transition layers also weren't properly repeating patterns the way they were supposed to. I fixed that.
+
+ Finally, I fixed a bug in the code to fix up transition layers where something was misplaced that should have been inside a null check.
+
+ Reviewed by aroben
+
+ * css/CSSHelper.h:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseTransitionProperty):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::adjustRenderStyle):
+ * page/AnimationController.cpp:
+ (WebCore::ImplicitAnimation::animate):
+ * rendering/RenderStyle.cpp:
+ (WebCore::RenderStyle::adjustTransitions):
+ * rendering/RenderStyle.h:
+ (WebCore::RenderStyle::initialTransitionProperty):
+
2007-10-30 Antti Koivisto <antti@apple.com>
Reviewed by Geoff.
// "absolute" CSS length units like inch and pt is always fixed and never changes.
const float cssPixelsPerInch = 96.0f;
+ // Used by animation.
+ const int cAnimateNone = 0;
+ const int cAnimateAll = -2;
+
} // namespace WebCore
#endif // CSSHelper_h
CSSValue* CSSParser::parseTransitionProperty()
{
Value* value = valueList->current();
- if (value->unit == CSSPrimitiveValue::CSS_STRING) {
- // Use getPropertyID to map from a string value to a property id.
- // FIXME: Reduce the amount of copying here.
+ if (value->unit == CSSPrimitiveValue::CSS_IDENT) {
DeprecatedString str = deprecatedString(value->string);
str.lower();
+ if (str == "all")
+ return new CSSPrimitiveValue(cAnimateAll);
+ if (str == "none")
+ return new CSSPrimitiveValue(cAnimateNone);
int result = getPropertyID(str.ascii(), str.length());
- return new CSSPrimitiveValue(result);
+ if (result)
+ return new CSSPrimitiveValue(result);
}
return 0;
}
// Cull out any useless layers and also repeat patterns into additional layers.
style->adjustBackgroundLayers();
+ // Do the same for transitions.
+ style->adjustTransitions();
+
// Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will
// alter fonts and heights/widths.
if (e && e->isControl() && style->fontSize() >= 11) {
if (m_property == prop && m_toStyle->getter() != targetStyle->getter()) \
reset(renderer, currentStyle, targetStyle); \
\
- if ((m_property == RenderStyle::initialTransitionProperty() && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
+ if ((m_property == cAnimateAll && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
if (m_fromStyle->getter() != m_toStyle->getter()) {\
m_finished = false; \
if (!animatedStyle) \
if (m_property == prop && (!m_toStyle->getter() || !targetStyle->getter() || *m_toStyle->getter() != *targetStyle->getter())) \
reset(renderer, currentStyle, targetStyle); \
\
- if ((m_property == RenderStyle::initialTransitionProperty() && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
+ if ((m_property == cAnimateAll && !animation->hasAnimationForProperty(prop)) || m_property == prop) { \
if (m_fromStyle->getter() && m_toStyle->getter() && *m_fromStyle->getter() != *m_toStyle->getter()) {\
m_finished = false; \
if (!animatedStyle) \
void ImplicitAnimation::animate(CompositeImplicitAnimation* animation, RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle, RenderStyle*& animatedStyle)
{
- // FIXME: If we have no trigger property, then the only way to tell if our goal state changed is to check
+ // FIXME: If we have no transition-property, then the only way to tell if our goal state changed is to check
// every single animatable property. For now we'll just diff the styles to ask that question,
// but we should really exclude non-animatable properties.
- if (!m_toStyle || (m_property == RenderStyle::initialTransitionProperty() && targetStyle->diff(m_toStyle)))
+ if (!m_toStyle || (m_property == cAnimateAll && targetStyle->diff(m_toStyle)))
reset(renderer, currentStyle, targetStyle);
// FIXME: Blow up shorthands so that they can be honored.
p->m_next = 0;
break;
}
+
+ // Repeat patterns into layers that don't have some properties set.
+ accessTransitions()->fillUnsetProperties();
}
-
- // Repeat patterns into layers that don't have some properties set.
- accessTransitions()->fillUnsetProperties();
}
Transition* RenderStyle::accessTransitions()
*/
#include "AffineTransform.h"
+#include "CSSHelper.h"
#include "CSSPrimitiveValue.h"
#include "CSSValueList.h"
#include "Color.h"
double m_y2;
};
-static const int cAnimateAll = -2;
-
struct Transition {
public:
Transition();
static int initialTransitionDuration() { return 250; }
static int initialTransitionRepeatCount() { return 1; }
static TimingFunction initialTransitionTimingFunction() { return TimingFunction(); }
- static int initialTransitionProperty() { return cAnimateAll; }
+ static int initialTransitionProperty() { return cAnimateNone; }
static int initialLineClamp() { return -1; }
static bool initialTextSizeAdjust() { return true; }
static ETextSecurity initialTextSecurity() { return TSNONE; }