Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Unified Diff: Source/core/editing/EditingStyle.cpp

Issue 15746004: Rename/tweak some StylePropertySet/CSSStyleDeclaration copying functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingStyle.cpp
diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp
index 03994cb70b38b3825e8d64a7af761d3c3fa806c9..0ae10ec2e1a33e22de8aeb472e257ff332c52608 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -108,7 +108,7 @@ static const Vector<CSSPropertyID>& inheritableEditingProperties()
}
template <class StyleDeclarationType>
-static PassRefPtr<StylePropertySet> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties)
+static PassRefPtr<MutableStylePropertySet> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties)
{
if (type == AllEditingProperties)
return style->copyPropertiesInSet(allEditingProperties());
@@ -120,10 +120,10 @@ static inline bool isEditingProperty(int id)
return allEditingProperties().contains(static_cast<CSSPropertyID>(id));
}
-static PassRefPtr<StylePropertySet> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties)
+static PassRefPtr<MutableStylePropertySet> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties)
{
if (!style)
- return StylePropertySet::create();
+ return static_pointer_cast<MutableStylePropertySet>(StylePropertySet::create());
return copyEditingProperties(style.get(), type);
}
@@ -335,7 +335,7 @@ EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert
}
EditingStyle::EditingStyle(const StylePropertySet* style)
- : m_mutableStyle(style ? style->copy() : 0)
+ : m_mutableStyle(style ? style->mutableCopy() : 0)
, m_shouldUseFixedDefaultFontSize(false)
, m_fontSizeDelta(NoFontDelta)
{
@@ -343,7 +343,7 @@ EditingStyle::EditingStyle(const StylePropertySet* style)
}
EditingStyle::EditingStyle(const CSSStyleDeclaration* style)
- : m_mutableStyle(style ? style->copy() : 0)
+ : m_mutableStyle(style ? style->copyProperties() : 0)
, m_shouldUseFixedDefaultFontSize(false)
, m_fontSizeDelta(NoFontDelta)
{
@@ -437,7 +437,7 @@ void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude)
node = node->parentNode();
RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = CSSComputedStyleDeclaration::create(node);
- m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosition ? computedStyleAtPosition->copy() : editingStyleFromComputedStyle(computedStyleAtPosition);
+ m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosition ? computedStyleAtPosition->copyProperties() : editingStyleFromComputedStyle(computedStyleAtPosition);
if (propertiesToInclude == EditingPropertiesInEffect) {
if (RefPtr<CSSValue> value = backgroundColorInEffect(node))
@@ -572,7 +572,7 @@ PassRefPtr<EditingStyle> EditingStyle::copy() const
{
RefPtr<EditingStyle> copy = EditingStyle::create();
if (m_mutableStyle)
- copy->m_mutableStyle = m_mutableStyle->copy();
+ copy->m_mutableStyle = m_mutableStyle->mutableCopy();
copy->m_shouldUseFixedDefaultFontSize = m_shouldUseFixedDefaultFontSize;
copy->m_fontSizeDelta = m_fontSizeDelta;
return copy;
@@ -1069,7 +1069,7 @@ void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
return;
if (!m_mutableStyle) {
- m_mutableStyle = style->copy();
+ m_mutableStyle = style->mutableCopy();
return;
}
@@ -1519,7 +1519,7 @@ PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedun
{
ASSERT(styleWithRedundantProperties);
ASSERT(baseStyle);
- RefPtr<StylePropertySet> result = styleWithRedundantProperties->copy();
+ RefPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutableCopy();
result->removeEquivalentProperties(baseStyle);
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698