void StyleBaseImpl::setParsedValue(int propId, const CSSValueImpl *parsedValue, bool important, QList<CSSProperty*> *propList) { QMutableListIterator<CSSProperty*> propIt(*propList); propIt.toBack(); // just remove the top one - not sure what should happen if we have multiple instances of the property CSSProperty* p; while (propIt.hasPrevious()) { p = propIt.previous(); if (p->m_id == propId && p->m_important == important ) { delete propIt.value(); propIt.remove(); break; } } CSSProperty *prop = new CSSProperty(); prop->m_id = propId; prop->setValue(const_cast<CSSValueImpl *>(parsedValue)); prop->m_important = important; propList->append(prop); #ifdef CSS_DEBUG kDebug( 6080 ) << "added property: " << getPropertyName(propId).string() // non implemented yet << ", value: " << parsedValue->cssText().string() << " important: " << prop->m_important; #endif }
void StyleBaseImpl::setParsedValue(int propId, const CSSValueImpl *parsedValue, bool important, bool nonCSSHint, TQPtrList<CSSProperty> *propList) { TQPtrListIterator<CSSProperty> propIt(*propList); propIt.toLast(); // just remove the top one - not sure what should happen if we have multiple instances of the property while (propIt.current() && ( propIt.current()->m_id != propId || propIt.current()->nonCSSHint != nonCSSHint || propIt.current()->m_important != important) ) --propIt; if (propIt.current()) propList->removeRef(propIt.current()); CSSProperty *prop = new CSSProperty(); prop->m_id = propId; prop->setValue((CSSValueImpl *) parsedValue); prop->m_important = important; prop->nonCSSHint = nonCSSHint; propList->append(prop); #ifdef CSS_DEBUG kdDebug( 6080 ) << "added property: " << getPropertyName(propId).string() // non implemented yet << ", value: " << parsedValue->cssText().string() << " important: " << prop->m_important << " nonCSS: " << prop->nonCSSHint << endl; #endif }
void CSSStyleDeclarationImpl::setLengthProperty(int id, const DOMString &value, bool important, bool nonCSSHint) { strictParsing = false; setProperty( id, value, important, nonCSSHint); strictParsing = true; #if 0 // ### FIXME after 2.0 if(!value.unicode() || value.length() == 0) return; if(!m_lstValues) { m_lstValues = new QList<CSSProperty>; m_lstValues->setAutoDelete(true); } CSSValueImpl *v = parseUnit(value.unicode(), value.unicode()+value.length(), INTEGER | PERCENT | LENGTH, ); if(!v) { kdDebug( 6080 ) << "invalid length" << endl; return; } CSSPrimitiveValueImpl *p = static_cast<CSSPrimitiveValueImpl *>(v); if(p->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) { // set the parsed number in pixels p->setPrimitiveType(CSSPrimitiveValue::CSS_PX); } CSSProperty *prop = new CSSProperty(); prop->m_id = id; prop->setValue(v); prop->m_bImportant = important; prop->nonCSSHint = nonCSSHint; m_lstValues->append(prop); #endif }