Diff
Modified: trunk/Source/WebCore/ChangeLog (121569 => 121570)
--- trunk/Source/WebCore/ChangeLog 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/ChangeLog 2012-06-29 17:20:19 UTC (rev 121570)
@@ -1,3 +1,54 @@
+2012-06-29 Andreas Kling <[email protected]>
+
+ Unreviewed, rolling out r121562.
+ http://trac.webkit.org/changeset/121562
+ https://bugs.webkit.org/show_bug.cgi?id=89945
+
+ Broke a couple of editing/pasteboard tests.
+
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ (WebCore::PropertySetCSSStyleDeclaration::length):
+ (WebCore::PropertySetCSSStyleDeclaration::item):
+ (WebCore::PropertySetCSSStyleDeclaration::cssText):
+ (WebCore::PropertySetCSSStyleDeclaration::setCssText):
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue):
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue):
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority):
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand):
+ (WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit):
+ (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+ (WebCore::PropertySetCSSStyleDeclaration::removeProperty):
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
+ (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
+ (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+ (WebCore::PropertySetCSSStyleDeclaration::copy):
+ (WebCore::PropertySetCSSStyleDeclaration::makeMutable):
+ (WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches):
+ (WebCore::InlineCSSStyleDeclaration::didMutate):
+ (WebCore::InlineCSSStyleDeclaration::parentStyleSheet):
+ * css/PropertySetCSSStyleDeclaration.h:
+ (WebCore::PropertySetCSSStyleDeclaration::clearParentElement):
+ (PropertySetCSSStyleDeclaration):
+ (WebCore::InlineCSSStyleDeclaration::InlineCSSStyleDeclaration):
+ * css/StylePropertySet.cpp:
+ (WebCore::StylePropertySet::ensureInlineCSSStyleDeclaration):
+ (WebCore::StylePropertySet::clearParentElement):
+ (WebCore):
+ * css/StylePropertySet.h:
+ (StylePropertySet):
+ * dom/ElementAttributeData.cpp:
+ (WebCore::ElementAttributeData::destroyInlineStyle):
+ (WebCore):
+ * dom/ElementAttributeData.h:
+ (ElementAttributeData):
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::~StyledElement):
+ (WebCore):
+ (WebCore::StyledElement::styleAttributeChanged):
+ * dom/StyledElement.h:
+ (StyledElement):
+ (WebCore::StyledElement::destroyInlineStyle):
+
2012-06-29 Bruno de Oliveira Abinader <[email protected]>
[Qt] Add missing support for tiled shadow blur on fillRect
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (121569 => 121570)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2012-06-29 17:20:19 UTC (rev 121570)
@@ -132,19 +132,19 @@
unsigned PropertySetCSSStyleDeclaration::length() const
{
- return propertySet()->propertyCount();
+ return m_propertySet->propertyCount();
}
String PropertySetCSSStyleDeclaration::item(unsigned i) const
{
- if (i >= propertySet()->propertyCount())
+ if (i >= m_propertySet->propertyCount())
return "";
- return getPropertyName(propertySet()->propertyAt(i).id());
+ return getPropertyName(m_propertySet->propertyAt(i).id());
}
String PropertySetCSSStyleDeclaration::cssText() const
{
- return propertySet()->asText();
+ return m_propertySet->asText();
}
void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec)
@@ -156,7 +156,7 @@
ec = 0;
// FIXME: Detect syntax errors and set ec.
- ensureMutablePropertySet()->parseDeclaration(text, contextStyleSheet());
+ m_propertySet->parseDeclaration(text, contextStyleSheet());
didMutate(PropertyChanged);
@@ -170,7 +170,7 @@
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return 0;
- return cloneAndCacheForCSSOM(propertySet()->getPropertyCSSValue(propertyID).get());
+ return cloneAndCacheForCSSOM(m_propertySet->getPropertyCSSValue(propertyID).get());
}
String PropertySetCSSStyleDeclaration::getPropertyValue(const String &propertyName)
@@ -178,7 +178,7 @@
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return String();
- return propertySet()->getPropertyValue(propertyID);
+ return m_propertySet->getPropertyValue(propertyID);
}
String PropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName)
@@ -186,7 +186,7 @@
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return String();
- return propertySet()->propertyIsImportant(propertyID) ? "important" : "";
+ return m_propertySet->propertyIsImportant(propertyID) ? "important" : "";
}
String PropertySetCSSStyleDeclaration::getPropertyShorthand(const String& propertyName)
@@ -194,7 +194,7 @@
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return String();
- CSSPropertyID shorthandID = propertySet()->getPropertyShorthand(propertyID);
+ CSSPropertyID shorthandID = m_propertySet->getPropertyShorthand(propertyID);
if (!shorthandID)
return String();
return getPropertyName(shorthandID);
@@ -205,7 +205,7 @@
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return false;
- return propertySet()->isPropertyImplicit(propertyID);
+ return m_propertySet->isPropertyImplicit(propertyID);
}
void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec)
@@ -222,7 +222,7 @@
willMutate();
ec = 0;
- bool changed = ensureMutablePropertySet()->setProperty(propertyID, value, important, contextStyleSheet());
+ bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet());
didMutate(changed ? PropertyChanged : NoChanges);
@@ -248,7 +248,7 @@
ec = 0;
String result;
- bool changed = ensureMutablePropertySet()->removeProperty(propertyID, &result);
+ bool changed = m_propertySet->removeProperty(propertyID, &result);
didMutate(changed ? PropertyChanged : NoChanges);
@@ -262,12 +262,12 @@
PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
{
- return propertySet()->getPropertyCSSValue(propertyID);
+ return m_propertySet->getPropertyCSSValue(propertyID);
}
String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
{
- return propertySet()->getPropertyValue(propertyID);
+ return m_propertySet->getPropertyValue(propertyID);
}
void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec)
@@ -278,7 +278,7 @@
willMutate();
ec = 0;
- bool changed = ensureMutablePropertySet()->setProperty(propertyID, value, important, contextStyleSheet());
+ bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet());
didMutate(changed ? PropertyChanged : NoChanges);
@@ -313,17 +313,17 @@
PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const
{
- return propertySet()->copy();
+ return m_propertySet->copy();
}
PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable()
{
- return ensureMutablePropertySet();
+ return m_propertySet;
}
bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
{
- return propertySet()->propertyMatches(property);
+ return m_propertySet->propertyMatches(property);
}
StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(StylePropertySet* propertySet, CSSRule* parentRule)
@@ -380,22 +380,6 @@
m_propertySet->ref();
}
-InlineCSSStyleDeclaration::InlineCSSStyleDeclaration(StyledElement* parentElement)
- : PropertySetCSSStyleDeclaration(const_cast<StylePropertySet*>(parentElement->inlineStyle()))
- , m_parentElement(parentElement)
-{
-}
-
-void InlineCSSStyleDeclaration::ref()
-{
- m_parentElement->ref();
-}
-
-void InlineCSSStyleDeclaration::deref()
-{
- m_parentElement->deref();
-}
-
void InlineCSSStyleDeclaration::didMutate(MutationType type)
{
if (type == NoChanges)
@@ -403,6 +387,8 @@
m_cssomCSSValueClones.clear();
+ if (!m_parentElement)
+ return;
m_parentElement->setNeedsStyleRecalc(InlineStyleChange);
m_parentElement->invalidateStyleAttribute();
StyleAttributeMutationScope(this).didInvalidateStyleAttr();
@@ -410,14 +396,7 @@
CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const
{
- return m_parentElement->document()->elementSheet();
+ return m_parentElement ? m_parentElement->document()->elementSheet() : 0;
}
-StylePropertySet* InlineCSSStyleDeclaration::ensureMutablePropertySet()
-{
- ASSERT(m_propertySet);
- ASSERT(m_propertySet == m_parentElement->inlineStyle());
- return m_propertySet;
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (121569 => 121570)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h 2012-06-29 17:20:19 UTC (rev 121570)
@@ -42,15 +42,12 @@
PropertySetCSSStyleDeclaration(StylePropertySet* propertySet) : m_propertySet(propertySet) { }
virtual StyledElement* parentElement() const { return 0; }
+ virtual void clearParentElement() { ASSERT_NOT_REACHED(); }
StyleSheetContents* contextStyleSheet() const;
virtual void ref() OVERRIDE;
virtual void deref() OVERRIDE;
-protected:
- const StylePropertySet* propertySet() const { return m_propertySet; }
- virtual StylePropertySet* ensureMutablePropertySet() { return m_propertySet; }
-
private:
virtual CSSRule* parentRule() const OVERRIDE { return 0; };
virtual unsigned length() const OVERRIDE;
@@ -109,8 +106,6 @@
virtual void willMutate() OVERRIDE;
virtual void didMutate(MutationType) OVERRIDE;
- virtual StylePropertySet* ensureMutablePropertySet() OVERRIDE { return m_propertySet; }
-
unsigned m_refCount;
CSSRule* m_parentRule;
};
@@ -118,18 +113,18 @@
class InlineCSSStyleDeclaration : public PropertySetCSSStyleDeclaration
{
public:
- InlineCSSStyleDeclaration(StyledElement*);
-
- virtual void ref() OVERRIDE;
- virtual void deref() OVERRIDE;
+ InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* parentElement)
+ : PropertySetCSSStyleDeclaration(propertySet)
+ , m_parentElement(parentElement)
+ {
+ }
private:
virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
virtual StyledElement* parentElement() const OVERRIDE { return m_parentElement; }
+ virtual void clearParentElement() OVERRIDE { m_parentElement = 0; }
virtual void didMutate(MutationType) OVERRIDE;
-
- virtual StylePropertySet* ensureMutablePropertySet() OVERRIDE;
StyledElement* m_parentElement;
};
Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (121569 => 121570)
--- trunk/Source/WebCore/css/StylePropertySet.cpp 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp 2012-06-29 17:20:19 UTC (rev 121570)
@@ -1051,11 +1051,19 @@
return propertySetCSSOMWrapperMap().get(this);
}
m_ownsCSSOMWrapper = true;
- PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<StyledElement*>(parentElement));
+ PropertySetCSSStyleDeclaration* cssomWrapper = new InlineCSSStyleDeclaration(const_cast<StylePropertySet*>(this), const_cast<StyledElement*>(parentElement));
propertySetCSSOMWrapperMap().add(this, adoptPtr(cssomWrapper));
return cssomWrapper;
}
+void StylePropertySet::clearParentElement(StyledElement* element)
+{
+ if (!m_ownsCSSOMWrapper)
+ return;
+ ASSERT_UNUSED(element, propertySetCSSOMWrapperMap().get(this)->parentElement() == element);
+ propertySetCSSOMWrapperMap().get(this)->clearParentElement();
+}
+
unsigned StylePropertySet::averageSizeInBytes()
{
// Please update this if the storage scheme changes so that this longer reflects the actual size.
Modified: trunk/Source/WebCore/css/StylePropertySet.h (121569 => 121570)
--- trunk/Source/WebCore/css/StylePropertySet.h 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/css/StylePropertySet.h 2012-06-29 17:20:19 UTC (rev 121570)
@@ -103,6 +103,8 @@
String asText() const;
+ void clearParentElement(StyledElement*);
+
CSSStyleDeclaration* ensureCSSStyleDeclaration() const;
CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(const StyledElement* parentElement) const;
Modified: trunk/Source/WebCore/dom/ElementAttributeData.cpp (121569 => 121570)
--- trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-06-29 17:20:19 UTC (rev 121570)
@@ -161,6 +161,14 @@
m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents());
}
+void ElementAttributeData::destroyInlineStyle(StyledElement* element)
+{
+ if (!m_inlineStyleDecl)
+ return;
+ m_inlineStyleDecl->clearParentElement(element);
+ m_inlineStyleDecl = 0;
+}
+
void ElementAttributeData::addAttribute(const Attribute& attribute, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute)
{
if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute)
Modified: trunk/Source/WebCore/dom/ElementAttributeData.h (121569 => 121570)
--- trunk/Source/WebCore/dom/ElementAttributeData.h 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/dom/ElementAttributeData.h 2012-06-29 17:20:19 UTC (rev 121570)
@@ -67,6 +67,7 @@
StylePropertySet* ensureInlineStyle(StyledElement*);
StylePropertySet* ensureMutableInlineStyle(StyledElement*);
void updateInlineStyleAvoidingMutation(StyledElement*, const String& text);
+ void destroyInlineStyle(StyledElement*);
StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); }
void setAttributeStyle(PassRefPtr<StylePropertySet> style) { m_attributeStyle = style; }
Modified: trunk/Source/WebCore/dom/StyledElement.cpp (121569 => 121570)
--- trunk/Source/WebCore/dom/StyledElement.cpp 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/dom/StyledElement.cpp 2012-06-29 17:20:19 UTC (rev 121570)
@@ -135,6 +135,11 @@
{
}
+StyledElement::~StyledElement()
+{
+ destroyInlineStyle();
+}
+
CSSStyleDeclaration* StyledElement::style()
{
return ensureAttributeData()->ensureMutableInlineStyle(this)->ensureInlineCSSStyleDeclaration(this);
@@ -178,7 +183,9 @@
WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst();
if (document() && document()->scriptableDocumentParser() && !document()->isInDocumentWrite())
startLineNumber = document()->scriptableDocumentParser()->lineNumber();
- if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))
+ if (newStyleString.isNull())
+ destroyInlineStyle();
+ else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))
ensureAttributeData()->updateInlineStyleAvoidingMutation(this, newStyleString);
setIsStyleAttributeValid();
}
Modified: trunk/Source/WebCore/dom/StyledElement.h (121569 => 121570)
--- trunk/Source/WebCore/dom/StyledElement.h 2012-06-29 17:17:02 UTC (rev 121569)
+++ trunk/Source/WebCore/dom/StyledElement.h 2012-06-29 17:20:19 UTC (rev 121570)
@@ -35,7 +35,7 @@
class StyledElement : public Element {
public:
- virtual ~StyledElement() { }
+ virtual ~StyledElement();
virtual StylePropertySet* additionalAttributeStyle() { return 0; }
void invalidateStyleAttribute();
@@ -86,6 +86,12 @@
void makePresentationAttributeCacheKey(PresentationAttributeCacheKey&) const;
void updateAttributeStyle();
+
+ void destroyInlineStyle()
+ {
+ if (attributeData())
+ attributeData()->destroyInlineStyle(this);
+ }
};
inline const SpaceSplitString& StyledElement::classNames() const