Diff
Modified: trunk/Source/WebCore/ChangeLog (113576 => 113577)
--- trunk/Source/WebCore/ChangeLog 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/ChangeLog 2012-04-09 13:43:25 UTC (rev 113577)
@@ -1,3 +1,47 @@
+2012-04-09 Alexis Menard <alexis.men...@openbossa.org>
+
+ [Part 5] We should use CSSPropertyID rather than integers when manipulating CSS property ids.
+ https://bugs.webkit.org/show_bug.cgi?id=83466
+
+ Reviewed by Kentaro Hara.
+
+ CSSPropertyID enum holds all the CSS property ids but many parts of WebKit treat the ids
+ as integers, this patch should adress the last remaining occurences of ints rather than CSSPropertyIDs.
+
+ No new tests : There should be no behavior change in this patch.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+ * css/CSSStyleSelector.h:
+ (CSSStyleSelector):
+ * css/StylePropertySet.cpp:
+ (WebCore::StylePropertySet::removePropertiesInSet):
+ * page/animation/AnimationBase.cpp:
+ (WebCore::gatherEnclosingShorthandProperties):
+ (WebCore::AnimationBase::animatableShorthandsAffectingProperty):
+ * page/animation/AnimationBase.h:
+ (AnimationBase):
+ * page/animation/CompositeAnimation.cpp:
+ (WebCore::CompositeAnimation::pauseTransitionAtTime):
+ * page/animation/KeyframeAnimation.cpp:
+ (WebCore::KeyframeAnimation::animate):
+ (WebCore::KeyframeAnimation::getAnimatedStyle):
+ (WebCore::KeyframeAnimation::overrideAnimations):
+ (WebCore::KeyframeAnimation::resumeOverriddenAnimations):
+ (WebCore::KeyframeAnimation::timeToNextService):
+ * rendering/style/KeyframeList.cpp:
+ (WebCore::KeyframeList::insert):
+ * rendering/style/KeyframeList.h:
+ (WebCore::KeyframeValue::addProperty):
+ (WebCore::KeyframeValue::containsProperty):
+ (WebCore::KeyframeValue::properties):
+ (KeyframeValue):
+ (WebCore::KeyframeList::addProperty):
+ (WebCore::KeyframeList::containsProperty):
+ (WebCore::KeyframeList::beginProperties):
+ (WebCore::KeyframeList::endProperties):
+ (KeyframeList):
+
2012-04-09 Kentaro Hara <hara...@chromium.org>
Unreviewed, rebaselined run-bindings-tests results.
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (113576 => 113577)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-04-09 13:43:25 UTC (rev 113577)
@@ -5750,9 +5750,9 @@
if (m_pendingImageProperties.isEmpty())
return;
- HashSet<int>::const_iterator end = m_pendingImageProperties.end();
- for (HashSet<int>::const_iterator it = m_pendingImageProperties.begin(); it != end; ++it) {
- CSSPropertyID currentProperty = static_cast<CSSPropertyID>(*it);
+ HashSet<CSSPropertyID>::const_iterator end = m_pendingImageProperties.end();
+ for (HashSet<CSSPropertyID>::const_iterator it = m_pendingImageProperties.begin(); it != end; ++it) {
+ CSSPropertyID currentProperty = *it;
switch (currentProperty) {
case CSSPropertyBackgroundImage: {
Modified: trunk/Source/WebCore/css/CSSStyleSelector.h (113576 => 113577)
--- trunk/Source/WebCore/css/CSSStyleSelector.h 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/css/CSSStyleSelector.h 2012-04-09 13:43:25 UTC (rev 113577)
@@ -466,7 +466,7 @@
RefPtr<StaticCSSRuleList> m_ruleList;
- HashSet<int> m_pendingImageProperties; // Hash of CSSPropertyIDs
+ HashSet<CSSPropertyID> m_pendingImageProperties;
OwnPtr<MediaQueryEvaluator> m_medium;
RefPtr<RenderStyle> m_rootDefaultStyle;
Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (113576 => 113577)
--- trunk/Source/WebCore/css/StylePropertySet.cpp 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp 2012-04-09 13:43:25 UTC (rev 113577)
@@ -850,7 +850,7 @@
return false;
// FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless.
- HashSet<int> toRemove;
+ HashSet<CSSPropertyID> toRemove;
for (unsigned i = 0; i < length; ++i)
toRemove.add(set[i]);
Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (113576 => 113577)
--- trunk/Source/WebCore/page/animation/AnimationBase.cpp 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp 2012-04-09 13:43:25 UTC (rev 113577)
@@ -1291,7 +1291,7 @@
}
#endif
-static bool gatherEnclosingShorthandProperties(CSSPropertyID property, PropertyWrapperBase* wrapper, HashSet<int>& propertySet)
+static bool gatherEnclosingShorthandProperties(CSSPropertyID property, PropertyWrapperBase* wrapper, HashSet<CSSPropertyID>& propertySet)
{
if (!wrapper->isShorthandWrapper())
return false;
@@ -1313,11 +1313,11 @@
}
// Note: this is inefficient. It's only called from pauseTransitionAtTime().
-HashSet<int> AnimationBase::animatableShorthandsAffectingProperty(CSSPropertyID property)
+HashSet<CSSPropertyID> AnimationBase::animatableShorthandsAffectingProperty(CSSPropertyID property)
{
ensurePropertyMap();
- HashSet<int> foundProperties;
+ HashSet<CSSPropertyID> foundProperties;
for (int i = 0; i < getNumProperties(); ++i)
gatherEnclosingShorthandProperties(property, (*gPropertyWrappers)[i], foundProperties);
Modified: trunk/Source/WebCore/page/animation/AnimationBase.h (113576 => 113577)
--- trunk/Source/WebCore/page/animation/AnimationBase.h 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/page/animation/AnimationBase.h 2012-04-09 13:43:25 UTC (rev 113577)
@@ -195,7 +195,7 @@
static bool animationOfPropertyIsAccelerated(CSSPropertyID);
#endif
- static HashSet<int> animatableShorthandsAffectingProperty(CSSPropertyID);
+ static HashSet<CSSPropertyID> animatableShorthandsAffectingProperty(CSSPropertyID);
const Animation* animation() const { return m_animation.get(); }
Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (113576 => 113577)
--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp 2012-04-09 13:43:25 UTC (rev 113577)
@@ -526,11 +526,11 @@
if (!implAnim) {
// Check to see if this property is being animated via a shorthand.
// This code is only used for testing, so performance is not critical here.
- HashSet<int> shorthandProperties = AnimationBase::animatableShorthandsAffectingProperty(property);
+ HashSet<CSSPropertyID> shorthandProperties = AnimationBase::animatableShorthandsAffectingProperty(property);
bool anyPaused = false;
- HashSet<int>::const_iterator end = shorthandProperties.end();
- for (HashSet<int>::const_iterator it = shorthandProperties.begin(); it != end; ++it) {
- if (pauseTransitionAtTime(static_cast<CSSPropertyID>(*it), t))
+ HashSet<CSSPropertyID>::const_iterator end = shorthandProperties.end();
+ for (HashSet<CSSPropertyID>::const_iterator it = shorthandProperties.begin(); it != end; ++it) {
+ if (pauseTransitionAtTime(*it, t))
anyPaused = true;
}
return anyPaused;
Modified: trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp (113576 => 113577)
--- trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp 2012-04-09 13:43:25 UTC (rev 113577)
@@ -178,17 +178,15 @@
// FIXME: we need to be more efficient about determining which keyframes we are animating between.
// We should cache the last pair or something.
- HashSet<int>::const_iterator endProperties = m_keyframes.endProperties();
- for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
- CSSPropertyID property = static_cast<CSSPropertyID>(*it);
-
+ HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
+ for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
// Get the from/to styles and progress between
const RenderStyle* fromStyle = 0;
const RenderStyle* toStyle = 0;
double progress = 0.0;
- fetchIntervalEndpointsForProperty(property, fromStyle, toStyle, progress);
+ fetchIntervalEndpointsForProperty(*it, fromStyle, toStyle, progress);
- bool needsAnim = blendProperties(this, property, animatedStyle.get(), fromStyle, toStyle, progress);
+ bool needsAnim = blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress);
if (needsAnim)
setAnimating();
else {
@@ -215,17 +213,15 @@
if (!animatedStyle)
animatedStyle = RenderStyle::clone(m_object->style());
- HashSet<int>::const_iterator endProperties = m_keyframes.endProperties();
- for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
- CSSPropertyID property = static_cast<CSSPropertyID>(*it);
-
+ HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
+ for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
// Get the from/to styles and progress between
const RenderStyle* fromStyle = 0;
const RenderStyle* toStyle = 0;
double progress = 0.0;
- fetchIntervalEndpointsForProperty(property, fromStyle, toStyle, progress);
+ fetchIntervalEndpointsForProperty(*it, fromStyle, toStyle, progress);
- blendProperties(this, property, animatedStyle.get(), fromStyle, toStyle, progress);
+ blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress);
}
}
@@ -349,17 +345,17 @@
void KeyframeAnimation::overrideAnimations()
{
// This will override implicit animations that match the properties in the keyframe animation
- HashSet<int>::const_iterator end = m_keyframes.endProperties();
- for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
- compositeAnimation()->overrideImplicitAnimations(static_cast<CSSPropertyID>(*it));
+ HashSet<CSSPropertyID>::const_iterator end = m_keyframes.endProperties();
+ for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
+ compositeAnimation()->overrideImplicitAnimations(*it);
}
void KeyframeAnimation::resumeOverriddenAnimations()
{
// This will resume overridden implicit animations
- HashSet<int>::const_iterator end = m_keyframes.endProperties();
- for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
- compositeAnimation()->resumeOverriddenImplicitAnimations(static_cast<CSSPropertyID>(*it));
+ HashSet<CSSPropertyID>::const_iterator end = m_keyframes.endProperties();
+ for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
+ compositeAnimation()->resumeOverriddenImplicitAnimations(*it);
}
bool KeyframeAnimation::affectsProperty(CSSPropertyID property) const
@@ -458,11 +454,11 @@
// A return value of 0 means we need service. But if we only have accelerated animations we
// only need service at the end of the transition
- HashSet<int>::const_iterator endProperties = m_keyframes.endProperties();
+ HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
bool acceleratedPropertiesOnly = true;
- for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
- if (!animationOfPropertyIsAccelerated(static_cast<CSSPropertyID>(*it)) || !isAccelerated()) {
+ for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
+ if (!animationOfPropertyIsAccelerated(*it) || !isAccelerated()) {
acceleratedPropertiesOnly = false;
break;
}
Modified: trunk/Source/WebCore/rendering/style/KeyframeList.cpp (113576 => 113577)
--- trunk/Source/WebCore/rendering/style/KeyframeList.cpp 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.cpp 2012-04-09 13:43:25 UTC (rev 113577)
@@ -85,11 +85,11 @@
m_properties.clear();
for (Vector<KeyframeValue>::const_iterator it = m_keyframes.begin(); it != m_keyframes.end(); ++it) {
const KeyframeValue& currKeyframe = *it;
- for (HashSet<int>::const_iterator it = currKeyframe.properties().begin(); it != currKeyframe.properties().end(); ++it)
+ for (HashSet<CSSPropertyID>::const_iterator it = currKeyframe.properties().begin(); it != currKeyframe.properties().end(); ++it)
m_properties.add(*it);
}
} else {
- for (HashSet<int>::const_iterator it = keyframe.properties().begin(); it != keyframe.properties().end(); ++it)
+ for (HashSet<CSSPropertyID>::const_iterator it = keyframe.properties().begin(); it != keyframe.properties().end(); ++it)
m_properties.add(*it);
}
}
Modified: trunk/Source/WebCore/rendering/style/KeyframeList.h (113576 => 113577)
--- trunk/Source/WebCore/rendering/style/KeyframeList.h 2012-04-09 13:34:54 UTC (rev 113576)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.h 2012-04-09 13:43:25 UTC (rev 113577)
@@ -25,6 +25,7 @@
#ifndef KeyframeList_h
#define KeyframeList_h
+#include "CSSPropertyNames.h"
#include <wtf/Vector.h>
#include <wtf/HashSet.h>
#include <wtf/RefPtr.h>
@@ -43,9 +44,9 @@
{
}
- void addProperty(int prop) { m_properties.add(prop); }
- bool containsProperty(int prop) const { return m_properties.contains(prop); }
- const HashSet<int>& properties() const { return m_properties; }
+ void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
+ bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
+ const HashSet<CSSPropertyID>& properties() const { return m_properties; }
float key() const { return m_key; }
void setKey(float key) { m_key = key; }
@@ -55,7 +56,7 @@
private:
float m_key;
- HashSet<int> m_properties; // The properties specified in this keyframe.
+ HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe.
RefPtr<RenderStyle> m_style;
};
@@ -77,10 +78,10 @@
void insert(const KeyframeValue& keyframe);
- void addProperty(int prop) { m_properties.add(prop); }
- bool containsProperty(int prop) const { return m_properties.contains(prop); }
- HashSet<int>::const_iterator beginProperties() const { return m_properties.begin(); }
- HashSet<int>::const_iterator endProperties() const { return m_properties.end(); }
+ void addProperty(CSSPropertyID prop) { m_properties.add(prop); }
+ bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
+ HashSet<CSSPropertyID>::const_iterator beginProperties() const { return m_properties.begin(); }
+ HashSet<CSSPropertyID>::const_iterator endProperties() const { return m_properties.end(); }
void clear();
bool isEmpty() const { return m_keyframes.isEmpty(); }
@@ -89,8 +90,8 @@
private:
AtomicString m_animationName;
- Vector<KeyframeValue> m_keyframes; // kept sorted by key
- HashSet<int> m_properties; // the properties being animated
+ Vector<KeyframeValue> m_keyframes; // Kept sorted by key.
+ HashSet<CSSPropertyID> m_properties; // The properties being animated.
RenderObject* m_renderer;
};