Changeset 127375 in webkit
- Timestamp:
- Sep 1, 2012 10:47:39 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127371 r127375 1 2012-09-01 Andreas Kling <kling@webkit.org> 2 3 Share inline style between cloned Nodes (copy on write.) 4 <http://webkit.org/b/95451> 5 6 Reviewed by Antti Koivisto. 7 8 When cloning a Node, use an immutable StylePropertySet for the new Node's inline style. 9 If the old Node already had an immutable inline style, we now reuse that, avoiding a copy. 10 Copying is deferred until mutation (either via CSSOM or setting of the style attribute.) 11 12 * dom/ElementAttributeData.cpp: 13 (WebCore::ElementAttributeData::cloneDataFrom): 14 * css/StylePropertySet.h: 15 * css/StylePropertySet.cpp: 16 (WebCore::StylePropertySet::immutableCopyIfNeeded): 17 18 Added. Simply returns 'this' if the object is already immutable, otherwise creates a new one. 19 1 20 2012-09-01 Dirk Schulze <krit@webkit.org> 2 21 -
trunk/Source/WebCore/css/StylePropertySet.cpp
r127318 r127375 60 60 void* slot = WTF::fastMalloc(immutableStylePropertySetSize(count)); 61 61 return adoptRef(new (slot) StylePropertySet(properties, count, cssParserMode, /* makeMutable */ false)); 62 } 63 64 PassRefPtr<StylePropertySet> StylePropertySet::immutableCopyIfNeeded() const 65 { 66 if (!isMutable()) 67 return const_cast<StylePropertySet*>(this); 68 return createImmutable(m_mutablePropertyVector->data(), m_mutablePropertyVector->size(), cssParserMode()); 62 69 } 63 70 -
trunk/Source/WebCore/css/StylePropertySet.h
r126872 r127375 92 92 93 93 PassRefPtr<StylePropertySet> copy() const; 94 PassRefPtr<StylePropertySet> immutableCopyIfNeeded() const; 94 95 95 96 void removeEquivalentProperties(const StylePropertySet*); -
trunk/Source/WebCore/dom/ElementAttributeData.cpp
r127126 r127375 364 364 365 365 if (targetElement.isStyledElement() && sourceData.m_inlineStyleDecl) { 366 m_inlineStyleDecl = sourceData.m_inlineStyleDecl-> copy();366 m_inlineStyleDecl = sourceData.m_inlineStyleDecl->immutableCopyIfNeeded(); 367 367 targetElement.setIsStyleAttributeValid(sourceElement.isStyleAttributeValid()); 368 368 }
Note: See TracChangeset
for help on using the changeset viewer.