Index: Source/WebCore/editing/EditingStyle.cpp |
=================================================================== |
--- Source/WebCore/editing/EditingStyle.cpp (revision 99392) |
+++ Source/WebCore/editing/EditingStyle.cpp (working copy) |
@@ -1056,6 +1056,17 @@ |
m_mutableStyle->merge(fromComputedStyle.get()); |
} |
+static void removePropertiesInStyle(CSSMutableStyleDeclaration* styleToRemovePropertiesFrom, CSSMutableStyleDeclaration* style) |
+{ |
+ Vector<int> propertiesToRemove(style->length()); |
+ size_t i = 0; |
+ CSSMutableStyleDeclaration::const_iterator end = style->end(); |
+ for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it, ++i) |
+ propertiesToRemove[i] = it->id(); |
+ |
+ styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data(), propertiesToRemove.size()); |
+} |
+ |
void EditingStyle::removeStyleFromRulesAndContext(StyledElement* element, Node* context) |
{ |
ASSERT(element); |
@@ -1070,7 +1081,10 @@ |
// 2. Remove style present in context and not overriden by matched rules. |
RefPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingInheritablePropertiesAndBackgroundColorInEffect); |
if (computedStyle->m_mutableStyle) { |
- computedStyle->removePropertiesInElementDefaultStyle(element); |
+ if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor)) |
+ computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColor, CSSValueTransparent); |
+ |
+ removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMatchedRules.get()); |
m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle.get()); |
} |
@@ -1091,13 +1105,7 @@ |
RefPtr<CSSMutableStyleDeclaration> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules); |
- Vector<int> propertiesToRemove(defaultStyle->length()); |
- size_t i = 0; |
- CSSMutableStyleDeclaration::const_iterator end = defaultStyle->end(); |
- for (CSSMutableStyleDeclaration::const_iterator it = defaultStyle->begin(); it != end; ++it, ++i) |
- propertiesToRemove[i] = it->id(); |
- |
- m_mutableStyle->removePropertiesInSet(propertiesToRemove.data(), propertiesToRemove.size()); |
+ removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); |
} |
void EditingStyle::forceInline() |