void CSSMutableStyleDeclaration::setPropertyInternal(const CSSProperty& property, CSSProperty* slot) { ASSERT(!m_iteratorCount); if (!removeShorthandProperty(property.id(), false)) { CSSProperty* toReplace = slot ? slot : findPropertyWithId(property.id()); if (toReplace) { *toReplace = property; return; } } m_properties.append(property); }
bool MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot) { if (!removeShorthandProperty(property.id())) { const AtomicString& name = (property.id() == CSSPropertyVariable) ? toCSSCustomPropertyDeclaration(property.value())->name() : nullAtom; CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id(), name); if (toReplace && *toReplace == property) return false; if (toReplace) { *toReplace = property; return true; } } m_propertyVector.append(property); return true; }
String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyChanged, bool returnText) { ASSERT(!m_iteratorCount); if (removeShorthandProperty(propertyID, notifyChanged)) { // FIXME: Return an equivalent shorthand when possible. return String(); } CSSProperty* foundProperty = findPropertyWithId(propertyID); if (!foundProperty) return String(); String value = returnText ? foundProperty->value()->cssText() : String(); // A more efficient removal strategy would involve marking entries as empty // and sweeping them when the vector grows too big. m_properties.remove(foundProperty - m_properties.data()); if (notifyChanged) setNeedsStyleRecalc(); return value; }