Commit b201d93f authored by Andrea Iacovitti's avatar Andrea Iacovitti

Remove as well the shorthand property itself from the list.

BUG: 337008
FIXED-IN: 4.13.3
parent e2bd8eb5
......@@ -1253,9 +1253,10 @@ void RenderStyleDeclarationImpl::removeProperty(int, DOM::DOMString*)
// ### emit error since we're read-only
}
void RenderStyleDeclarationImpl::removePropertiesInSet(const int*, unsigned)
bool RenderStyleDeclarationImpl::removePropertiesInSet(const int*, unsigned)
{
// ### emit error since we're read-only
return false;
}
bool RenderStyleDeclarationImpl::setProperty ( int, const DOM::DOMString &, bool, int &ec)
......
......@@ -52,7 +52,7 @@ public:
unsigned long length() const;
virtual void removeProperty(int propertyID, DOM::DOMString* old = 0);
virtual void removePropertiesInSet(const int* set, unsigned length);
virtual bool removePropertiesInSet(const int* set, unsigned length);
virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; }
bool setProperty ( int propertyId, const DOM::DOMString &value, bool important, int &ec );
bool setProperty ( int propertyId, const DOM::DOMString &value, bool important = false );
......
......@@ -644,23 +644,25 @@ static void initShorthandMap(QHash<int, PropertyLonghand>& shorthandMap)
// -------------------------------------------
void CSSStyleDeclarationImpl::removeProperty(int propertyID,
DOM::DOMString* old)
void CSSStyleDeclarationImpl::removeProperty(int propertyID, DOM::DOMString* old)
{
if(!m_lstValues)
return;
bool changed = false;
static QHash<int, PropertyLonghand> shorthandMap;
if (shorthandMap.isEmpty())
initShorthandMap(shorthandMap);
PropertyLonghand longhand = shorthandMap.value(propertyID);
if (longhand.length()) {
removePropertiesInSet(longhand.properties(), longhand.length());
// FIXME: Return an equivalent shorthand when possible.
return;
// Remove shorthand's longhand subproperties
changed = removePropertiesInSet(longhand.properties(), longhand.length());
}
// FIXME: Return an equivalent shorthand when possible.
QMutableListIterator<CSSProperty*> lstValuesIt(*m_lstValues);
CSSProperty *current;
lstValuesIt.toBack();
......@@ -671,13 +673,17 @@ void CSSStyleDeclarationImpl::removeProperty(int propertyID,
*old = current->value()->cssText();
delete lstValuesIt.value();
lstValuesIt.remove();
setChanged();
changed = true;
break;
}
}
if (changed) {
setChanged();
}
}
void CSSStyleDeclarationImpl::removePropertiesInSet(const int* set, unsigned length)
bool CSSStyleDeclarationImpl::removePropertiesInSet(const int* set, unsigned length)
{
bool changed = false;
for (unsigned i = 0; i < length; i++) {
......@@ -694,8 +700,8 @@ void CSSStyleDeclarationImpl::removePropertiesInSet(const int* set, unsigned len
}
}
}
if (changed)
setChanged();
return changed;
}
void CSSStyleDeclarationImpl::setChanged()
......
......@@ -57,7 +57,7 @@ public:
virtual unsigned long length() const;
CSSRuleImpl *parentRule() const;
virtual void removeProperty(int propertyID, DOM::DOMString* old = 0);
virtual void removePropertiesInSet(const int* set, unsigned length);
virtual bool removePropertiesInSet(const int* set, unsigned length);
virtual bool setProperty ( int propertyId, const DOM::DOMString &value, bool important, int &ec);
virtual bool setProperty ( int propertyId, const DOM::DOMString &value, bool important = false);
virtual void setProperty ( int propertyId, int value, bool important = false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment