Changeset 259659 in webkit
- Timestamp:
- Apr 7, 2020 12:43:30 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259651 r259659 1 2020-04-07 Antti Koivisto <antti@apple.com> 2 3 Make StylePropertyShorthand iterable 4 https://bugs.webkit.org/show_bug.cgi?id=210117 5 6 Reviewed by Darin Adler. 7 8 Enable modern for-loops. 9 10 * animation/AnimationTimeline.cpp: 11 (WebCore::transitionMatchesProperty): 12 (WebCore::compileTransitionPropertiesInStyle): 13 * css/CSSComputedStyleDeclaration.cpp: 14 (WebCore::updateStyleIfNeededForProperty): 15 * css/StyleProperties.cpp: 16 (WebCore::StyleProperties::propertyIsImportant const): 17 (WebCore::MutableStyleProperties::setProperty): 18 * css/StylePropertyShorthand.h: 19 (WebCore::StylePropertyShorthand::begin const): 20 (WebCore::StylePropertyShorthand::end const): 21 * css/parser/CSSPropertyParser.cpp: 22 (WebCore::CSSPropertyParser::addExpandedPropertyForValue): 23 * inspector/agents/InspectorCSSAgent.cpp: 24 (WebCore::InspectorCSSAgent::getSupportedCSSProperties): 25 * page/animation/CSSPropertyAnimation.cpp: 26 (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 27 1 28 2020-04-07 Chris Dumez <cdumez@apple.com> 2 29 -
trunk/Source/WebCore/animation/AnimationTimeline.cpp
r258916 r259659 335 335 auto transitionProperty = transition.property(); 336 336 if (transitionProperty != property) { 337 auto shorthand = shorthandForProperty(transitionProperty); 338 for (size_t i = 0; i < shorthand.length(); ++i) { 339 if (shorthand.properties()[i] == property) 337 for (auto longhand : shorthandForProperty(transitionProperty)) { 338 if (longhand == property) 340 339 return true; 341 340 } … … 361 360 auto property = animation.property(); 362 361 if (isShorthandCSSProperty(property)) { 363 auto shorthand = shorthandForProperty(property); 364 for (size_t j = 0; j < shorthand.length(); ++j) 365 transitionProperties.add(shorthand.properties()[j]); 362 for (auto longhand : shorthandForProperty(property)) 363 transitionProperties.add(longhand); 366 364 } else if (property != CSSPropertyInvalid) 367 365 transitionProperties.add(property); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r259585 r259659 2195 2195 auto shorthand = shorthandForProperty(propertyID); 2196 2196 if (shorthand.length()) { 2197 for ( size_t i = 0; i < shorthand.length(); ++i) {2198 if (!hasValidStyleForProperty(element, shorthand.properties()[i]))2197 for (auto longhand : shorthand) { 2198 if (!hasValidStyleForProperty(element, longhand)) 2199 2199 return false; 2200 2200 } -
trunk/Source/WebCore/css/StyleProperties.cpp
r257697 r259659 834 834 return propertyAt(foundPropertyIndex).isImportant(); 835 835 836 StylePropertyShorthandshorthand = shorthandForProperty(propertyID);836 auto shorthand = shorthandForProperty(propertyID); 837 837 if (!shorthand.length()) 838 838 return false; 839 839 840 for ( unsigned i = 0; i < shorthand.length(); ++i) {841 if (!propertyIsImportant( shorthand.properties()[i]))840 for (auto longhand : shorthand) { 841 if (!propertyIsImportant(longhand)) 842 842 return false; 843 843 } … … 926 926 removePropertiesInSet(shorthand.properties(), shorthand.length()); 927 927 928 for ( unsigned i = 0; i < shorthand.length(); ++i)929 m_propertyVector.append(CSSProperty( shorthand.properties()[i], value.copyRef(), important));928 for (auto longhand : shorthand) 929 m_propertyVector.append(CSSProperty(longhand, value.copyRef(), important)); 930 930 } 931 931 -
trunk/Source/WebCore/css/StylePropertyShorthand.h
r207479 r259659 40 40 } 41 41 42 const CSSPropertyID* begin() const { return properties(); } 43 const CSSPropertyID* end() const { return properties() + length(); } 44 42 45 const CSSPropertyID* properties() const { return m_properties; } 43 46 const StylePropertyShorthand* propertiesForInitialization() const { return m_propertiesForInitialization; } -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r258148 r259659 252 252 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property, Ref<CSSValue>&& value, bool important) 253 253 { 254 const StylePropertyShorthand& shorthand = shorthandForProperty(property); 255 unsigned shorthandLength = shorthand.length(); 256 ASSERT(shorthandLength); 257 const CSSPropertyID* longhands = shorthand.properties(); 258 for (unsigned i = 0; i < shorthandLength; ++i) 259 addProperty(longhands[i], property, value.copyRef(), important); 254 for (auto longhand : shorthandForProperty(property)) 255 addProperty(longhand, property, value.copyRef(), important); 260 256 } 261 257 -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
r257199 r259659 796 796 } 797 797 798 const StylePropertyShorthand&shorthand = shorthandForProperty(propertyID);798 auto shorthand = shorthandForProperty(propertyID); 799 799 if (shorthand.length()) { 800 800 auto longhands = JSON::ArrayOf<String>::create(); 801 for (unsigned j = 0; j < shorthand.length(); ++j) { 802 CSSPropertyID longhandID = shorthand.properties()[j]; 803 if (isEnabledCSSProperty(longhandID)) 804 longhands->addItem(getPropertyNameString(longhandID)); 801 for (auto longhand : shorthand) { 802 if (isEnabledCSSProperty(longhand)) 803 longhands->addItem(getPropertyNameString(longhand)); 805 804 } 806 805 property->setLonghands(WTFMove(longhands)); -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r259532 r259659 1762 1762 for (size_t i = 0; i < animatableShorthandPropertiesCount; ++i) { 1763 1763 CSSPropertyID propertyID = animatableShorthandProperties[i]; 1764 StylePropertyShorthandshorthand = shorthandForProperty(propertyID);1764 auto shorthand = shorthandForProperty(propertyID); 1765 1765 if (!shorthand.length()) 1766 1766 continue; … … 1768 1768 Vector<AnimationPropertyWrapperBase*> longhandWrappers; 1769 1769 longhandWrappers.reserveInitialCapacity(shorthand.length()); 1770 const CSSPropertyID* properties = shorthand.properties(); 1771 for (unsigned j = 0; j < shorthand.length(); ++j) { 1772 unsigned wrapperIndex = indexFromPropertyID(properties[j]); 1770 for (auto longhand : shorthand) { 1771 unsigned wrapperIndex = indexFromPropertyID(longhand); 1773 1772 if (wrapperIndex == cInvalidPropertyWrapperIndex) 1774 1773 continue;
Note: See TracChangeset
for help on using the changeset viewer.