void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& property) { CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()); CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant); if (toReplace && prefixingVariant != property.id()) *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit); }
bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText) { if (removeShorthandProperty(propertyID)) { // FIXME: Return an equivalent shorthand when possible. if (returnText) *returnText = ""; return true; } CSSProperty* foundProperty = findPropertyWithId(propertyID); if (!foundProperty) { if (returnText) *returnText = ""; return false; } if (returnText) *returnText = foundProperty->value()->cssText(); // 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()); return true; }
void StylePropertySet::setPrefixingVariantProperty(const CSSProperty& property) { CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()); CSSProperty* toReplace = findMutableCSSPropertyWithID(prefixingVariant); if (toReplace) *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit); }
void StylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property) { mutablePropertyVector().append(property); CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()); if (prefixingVariant == property.id()) return; mutablePropertyVector().append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit)); }
void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property) { m_propertyVector.append(property); CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()); if (prefixingVariant == property.id()) return; m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit)); }
CSSValueImpl *CSSStyleDeclarationImpl::getPropertyCSSValue( int propertyID ) const { if(!m_lstValues) return 0; QPtrListIterator<CSSProperty> lstValuesIt(*m_lstValues); CSSProperty *current; for ( lstValuesIt.toLast(); (current = lstValuesIt.current()); --lstValuesIt ) if (current->m_id == propertyID && !current->nonCSSHint) return current->value(); return 0; }
void StylePropertySet::merge(const StylePropertySet* other, bool argOverridesOnConflict) { unsigned size = other->m_properties.size(); for (unsigned n = 0; n < size; ++n) { const CSSProperty& toMerge = other->m_properties[n]; CSSProperty* old = findPropertyWithId(toMerge.id()); if (old) { if (!argOverridesOnConflict && old->value()) continue; setProperty(toMerge, old); } else m_properties.append(toMerge); } }
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; }
DOMString CSSStyleDeclarationImpl::removeProperty( int propertyID, bool NonCSSHint ) { if(!m_lstValues) return DOMString(); DOMString value; QPtrListIterator<CSSProperty> lstValuesIt(*m_lstValues); CSSProperty *current; for ( lstValuesIt.toLast(); (current = lstValuesIt.current()); --lstValuesIt ) if (current->m_id == propertyID && NonCSSHint == current->nonCSSHint) { value = current->value()->cssText(); m_lstValues->removeRef(current); setChanged(); break; } return value; }
void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other, bool argOverridesOnConflict) { ASSERT(!m_iteratorCount); unsigned size = other->m_properties.size(); for (unsigned n = 0; n < size; ++n) { const CSSProperty& toMerge = other->m_properties[n]; CSSProperty* old = findPropertyWithId(toMerge.id()); if (old) { if (!argOverridesOnConflict && old->value()) continue; setPropertyInternal(toMerge, old); } else m_properties.append(toMerge); } // FIXME: This probably should have a call to setNeedsStyleRecalc() if something changed. We may also wish to add // a notifyChanged argument to this function to follow the model of other functions in this class. }
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; }