Title: [126872] trunk/Source/WebCore
- Revision
- 126872
- Author
- kl...@webkit.org
- Date
- 2012-08-28 06:16:00 -0700 (Tue, 28 Aug 2012)
Log Message
Simplify cloning of inline style (below Node.cloneNode)
<http://webkit.org/b/95095>
Reviewed by Eric Seidel.
Just use StylePropertySet::copy() instead of copying the properties and CSS parser mode manually
when cloning an element that has inline style.
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::StylePropertySet):
* css/StylePropertySet.h:
(StylePropertySet):
* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::cloneDataFrom):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (126871 => 126872)
--- trunk/Source/WebCore/ChangeLog 2012-08-28 13:02:52 UTC (rev 126871)
+++ trunk/Source/WebCore/ChangeLog 2012-08-28 13:16:00 UTC (rev 126872)
@@ -1,3 +1,20 @@
+2012-08-28 Andreas Kling <kl...@webkit.org>
+
+ Simplify cloning of inline style (below Node.cloneNode)
+ <http://webkit.org/b/95095>
+
+ Reviewed by Eric Seidel.
+
+ Just use StylePropertySet::copy() instead of copying the properties and CSS parser mode manually
+ when cloning an element that has inline style.
+
+ * css/StylePropertySet.cpp:
+ (WebCore::StylePropertySet::StylePropertySet):
+ * css/StylePropertySet.h:
+ (StylePropertySet):
+ * dom/ElementAttributeData.cpp:
+ (WebCore::ElementAttributeData::cloneDataFrom):
+
2012-08-28 Sukolsak Sakshuwong <sukol...@gmail.com>
Crash in EditingStyle::mergeStyle
Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (126871 => 126872)
--- trunk/Source/WebCore/css/StylePropertySet.cpp 2012-08-28 13:02:52 UTC (rev 126871)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp 2012-08-28 13:16:00 UTC (rev 126872)
@@ -87,15 +87,22 @@
}
}
-StylePropertySet::StylePropertySet(const StylePropertySet& o)
+StylePropertySet::StylePropertySet(const StylePropertySet& other)
: RefCounted<StylePropertySet>()
- , m_cssParserMode(o.m_cssParserMode)
+ , m_cssParserMode(other.m_cssParserMode)
, m_ownsCSSOMWrapper(false)
, m_isMutable(true)
, m_arraySize(0)
, m_mutablePropertyVector(new Vector<CSSProperty>)
{
- copyPropertiesFrom(o);
+ if (other.isMutable())
+ *m_mutablePropertyVector = *other.m_mutablePropertyVector;
+ else {
+ m_mutablePropertyVector->clear();
+ m_mutablePropertyVector->reserveCapacity(other.m_arraySize);
+ for (unsigned i = 0; i < other.m_arraySize; ++i)
+ m_mutablePropertyVector->uncheckedAppend(other.array()[i]);
+ }
}
StylePropertySet::~StylePropertySet()
@@ -111,27 +118,6 @@
}
}
-void StylePropertySet::setCSSParserMode(CSSParserMode cssParserMode)
-{
- ASSERT(isMutable());
- m_cssParserMode = cssParserMode;
-}
-
-void StylePropertySet::copyPropertiesFrom(const StylePropertySet& other)
-{
- ASSERT(isMutable());
-
- if (other.isMutable()) {
- *m_mutablePropertyVector = *other.m_mutablePropertyVector;
- return;
- }
-
- m_mutablePropertyVector->clear();
- m_mutablePropertyVector->reserveCapacity(other.m_arraySize);
- for (unsigned i = 0; i < other.m_arraySize; ++i)
- m_mutablePropertyVector->uncheckedAppend(other.array()[i]);
-}
-
String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const
{
RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
Modified: trunk/Source/WebCore/css/StylePropertySet.h (126871 => 126872)
--- trunk/Source/WebCore/css/StylePropertySet.h 2012-08-28 13:02:52 UTC (rev 126871)
+++ trunk/Source/WebCore/css/StylePropertySet.h 2012-08-28 13:16:00 UTC (rev 126872)
@@ -86,16 +86,12 @@
void mergeAndOverrideOnConflict(const StylePropertySet*);
- void setCSSParserMode(CSSParserMode);
CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); }
void addSubresourceStyleURLs(ListHashSet<KURL>&, StyleSheetContents* contextStyleSheet) const;
PassRefPtr<StylePropertySet> copy() const;
- // Used by StyledElement::copyNonAttributeProperties().
- void copyPropertiesFrom(const StylePropertySet&);
-
void removeEquivalentProperties(const StylePropertySet*);
void removeEquivalentProperties(const CSSStyleDeclaration*);
Modified: trunk/Source/WebCore/dom/ElementAttributeData.cpp (126871 => 126872)
--- trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-08-28 13:02:52 UTC (rev 126871)
+++ trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-08-28 13:16:00 UTC (rev 126872)
@@ -363,9 +363,7 @@
}
if (targetElement.isStyledElement() && sourceData.m_inlineStyleDecl) {
- StylePropertySet* inlineStyle = ensureMutableInlineStyle(static_cast<StyledElement*>(&targetElement));
- inlineStyle->copyPropertiesFrom(*sourceData.m_inlineStyleDecl);
- inlineStyle->setCSSParserMode(sourceData.m_inlineStyleDecl->cssParserMode());
+ m_inlineStyleDecl = sourceData.m_inlineStyleDecl->copy();
targetElement.setIsStyleAttributeValid(sourceElement.isStyleAttributeValid());
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes