Changeset 167967 in webkit
- Timestamp:
- Apr 29, 2014, 4:34:29 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167965 r167967 1 2014-04-29 Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com> 2 3 Move removeEquivalentProperties functions to EditingStyle 4 https://bugs.webkit.org/show_bug.cgi?id=131093 5 6 Reviewed by Darin Adler. 7 8 Moved the removeEquivalentProperties functions 9 from StyleProperties to EditingStyle class. 10 11 * css/StyleProperties.cpp: 12 (WebCore::MutableStyleProperties::removeEquivalentProperties): Deleted. 13 * css/StyleProperties.h: 14 * editing/EditingStyle.cpp: 15 (WebCore::EditingStyle::removeStyleAddedByNode): 16 (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode): 17 (WebCore::EditingStyle::prepareToApplyAt): 18 (WebCore::EditingStyle::removeEquivalentProperties): 19 (WebCore::extractPropertiesNotIn): 20 * editing/EditingStyle.h: 21 1 22 2014-04-29 David Hyatt <hyatt@apple.com> 2 23 -
trunk/Source/WebCore/css/StyleProperties.cpp
r167877 r167967 1174 1174 } 1175 1175 1176 void MutableStyleProperties::removeEquivalentProperties(const StyleProperties* style)1177 {1178 Vector<CSSPropertyID> propertiesToRemove;1179 unsigned size = m_propertyVector.size();1180 for (unsigned i = 0; i < size; ++i) {1181 PropertyReference property = propertyAt(i);1182 if (style->propertyMatches(property.id(), property.value()))1183 propertiesToRemove.append(property.id());1184 }1185 // FIXME: This should use mass removal.1186 for (unsigned i = 0; i < propertiesToRemove.size(); ++i)1187 removeProperty(propertiesToRemove[i]);1188 }1189 1190 void MutableStyleProperties::removeEquivalentProperties(const ComputedStyleExtractor* computedStyle)1191 {1192 Vector<CSSPropertyID> propertiesToRemove;1193 unsigned size = m_propertyVector.size();1194 for (unsigned i = 0; i < size; ++i) {1195 PropertyReference property = propertyAt(i);1196 if (computedStyle->propertyMatches(property.id(), property.value()))1197 propertiesToRemove.append(property.id());1198 }1199 // FIXME: This should use mass removal.1200 for (unsigned i = 0; i < propertiesToRemove.size(); ++i)1201 removeProperty(propertiesToRemove[i]);1202 }1203 1204 1176 PassRef<MutableStyleProperties> StyleProperties::mutableCopy() const 1205 1177 { -
trunk/Source/WebCore/css/StyleProperties.h
r164995 r167967 212 212 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length); 213 213 214 // FIXME: These two can be moved to EditingStyle.cpp215 void removeEquivalentProperties(const StyleProperties*);216 void removeEquivalentProperties(const ComputedStyleExtractor*);217 218 214 void mergeAndOverrideOnConflict(const StyleProperties&); 219 215 -
trunk/Source/WebCore/editing/EditingStyle.cpp
r166294 r167967 594 594 RefPtr<MutableStyleProperties> parentStyle = copyPropertiesFromComputedStyle(node->parentNode(), EditingPropertiesInEffect); 595 595 RefPtr<MutableStyleProperties> nodeStyle = copyPropertiesFromComputedStyle(node, EditingPropertiesInEffect); 596 nodeStyle->removeEquivalentProperties(parentStyle.get());597 m_mutableStyle->removeEquivalentProperties(nodeStyle.get());596 removeEquivalentProperties(*parentStyle); 597 removeEquivalentProperties(*nodeStyle); 598 598 } 599 599 … … 604 604 605 605 RefPtr<MutableStyleProperties> parentStyle = copyPropertiesFromComputedStyle(node->parentNode(), EditingPropertiesInEffect); 606 RefPtr<MutableStyleProperties> nodeStyle = copyPropertiesFromComputedStyle(node, EditingPropertiesInEffect); 607 nodeStyle->removeEquivalentProperties(parentStyle.get()); 608 609 unsigned propertyCount = nodeStyle->propertyCount(); 606 RefPtr<EditingStyle> nodeStyle = EditingStyle::create(node, EditingPropertiesInEffect); 607 nodeStyle->removeEquivalentProperties(*parentStyle); 608 609 MutableStyleProperties* style = nodeStyle->style(); 610 unsigned propertyCount = style->propertyCount(); 610 611 for (unsigned i = 0; i < propertyCount; ++i) 611 m_mutableStyle->removeProperty( nodeStyle->propertyAt(i).id());612 m_mutableStyle->removeProperty(style->propertyAt(i).id()); 612 613 } 613 614 … … 917 918 } 918 919 919 m_mutableStyle->removeEquivalentProperties(styleAtPosition);920 removeEquivalentProperties(*styleAtPosition); 920 921 921 922 if (textAlignResolvingStartAndEnd(m_mutableStyle.get()) == textAlignResolvingStartAndEnd(styleAtPosition)) … … 1190 1191 1191 1192 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); 1193 } 1194 1195 template<typename T> 1196 void EditingStyle::removeEquivalentProperties(const T& style) 1197 { 1198 Vector<CSSPropertyID> propertiesToRemove; 1199 for (auto& property : m_mutableStyle->m_propertyVector) { 1200 if (style.propertyMatches(property.id(), property.value())) 1201 propertiesToRemove.append(property.id()); 1202 } 1203 // FIXME: This should use mass removal. 1204 for (auto& property : propertiesToRemove) 1205 m_mutableStyle->removeProperty(property); 1192 1206 } 1193 1207 … … 1543 1557 { 1544 1558 ASSERT(styleWithRedundantProperties); 1545 RefPtr< MutableStyleProperties> result = styleWithRedundantProperties->mutableCopy();1546 1547 result->removeEquivalentProperties(baseStyle);1559 RefPtr<EditingStyle> result = EditingStyle::create(styleWithRedundantProperties); 1560 result->removeEquivalentProperties(*baseStyle); 1561 RefPtr<MutableStyleProperties> mutableStyle = result->style(); 1548 1562 1549 1563 RefPtr<CSSValue> baseTextDecorationsInEffect = extractPropertyValue(baseStyle, CSSPropertyWebkitTextDecorationsInEffect); 1550 diffTextDecorations( result.get(), CSSPropertyTextDecoration, baseTextDecorationsInEffect.get());1551 diffTextDecorations( result.get(), CSSPropertyWebkitTextDecorationsInEffect, baseTextDecorationsInEffect.get());1552 1553 if (extractPropertyValue(baseStyle, CSSPropertyFontWeight) && fontWeightIsBold( result.get()) == fontWeightIsBold(baseStyle))1554 result->removeProperty(CSSPropertyFontWeight);1555 1556 if (extractPropertyValue(baseStyle, CSSPropertyColor) && textColorFromStyle( result.get()) == textColorFromStyle(baseStyle))1557 result->removeProperty(CSSPropertyColor);1564 diffTextDecorations(mutableStyle.get(), CSSPropertyTextDecoration, baseTextDecorationsInEffect.get()); 1565 diffTextDecorations(mutableStyle.get(), CSSPropertyWebkitTextDecorationsInEffect, baseTextDecorationsInEffect.get()); 1566 1567 if (extractPropertyValue(baseStyle, CSSPropertyFontWeight) && fontWeightIsBold(mutableStyle.get()) == fontWeightIsBold(baseStyle)) 1568 mutableStyle->removeProperty(CSSPropertyFontWeight); 1569 1570 if (extractPropertyValue(baseStyle, CSSPropertyColor) && textColorFromStyle(mutableStyle.get()) == textColorFromStyle(baseStyle)) 1571 mutableStyle->removeProperty(CSSPropertyColor); 1558 1572 1559 1573 if (extractPropertyValue(baseStyle, CSSPropertyTextAlign) 1560 && textAlignResolvingStartAndEnd( result.get()) == textAlignResolvingStartAndEnd(baseStyle))1561 result->removeProperty(CSSPropertyTextAlign);1562 1563 if (extractPropertyValue(baseStyle, CSSPropertyBackgroundColor) && backgroundColorFromStyle( result.get()) == backgroundColorFromStyle(baseStyle))1564 result->removeProperty(CSSPropertyBackgroundColor);1565 1566 return result.release();1574 && textAlignResolvingStartAndEnd(mutableStyle.get()) == textAlignResolvingStartAndEnd(baseStyle)) 1575 mutableStyle->removeProperty(CSSPropertyTextAlign); 1576 1577 if (extractPropertyValue(baseStyle, CSSPropertyBackgroundColor) && backgroundColorFromStyle(mutableStyle.get()) == backgroundColorFromStyle(baseStyle)) 1578 mutableStyle->removeProperty(CSSPropertyBackgroundColor); 1579 1580 return mutableStyle.release(); 1567 1581 } 1568 1582 -
trunk/Source/WebCore/editing/EditingStyle.h
r164521 r167967 49 49 class CSSPrimitiveValue; 50 50 class CSSValue; 51 class ComputedStyleExtractor; 51 52 class Document; 52 53 class Element; … … 109 110 void removeStyleAddedByNode(Node*); 110 111 void removeStyleConflictingWithStyleOfNode(Node*); 112 template<typename T> 113 void removeEquivalentProperties(const T&); 111 114 void collapseTextDecorationProperties(); 112 115 enum ShouldIgnoreTextOnlyProperties { IgnoreTextOnlyProperties, DoNotIgnoreTextOnlyProperties };
Note:
See TracChangeset
for help on using the changeset viewer.