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

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

Issue 22353004: background-color and text-decoration are not preserved when merging paragraphs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 4 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/EditingStyle.h ('k') | no next file » | 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 a343689ca1964a23c7a638076903e9c66816fe31..307757f9523121c590ac975cca0edaec861c916f 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -636,12 +636,6 @@ void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node)
m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id());
}
-void EditingStyle::removeNonEditingProperties()
-{
- if (m_mutableStyle)
- m_mutableStyle = copyEditingProperties(m_mutableStyle.get());
-}
-
void EditingStyle::collapseTextDecorationProperties()
{
if (!m_mutableStyle)
@@ -1000,11 +994,28 @@ static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLEle
&& (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsInStyle(style));
}
+static PassRefPtr<MutableStylePropertySet> extractEditingProperties(const StylePropertySet* style, EditingStyle::PropertiesToInclude propertiesToInclude)
+{
+ if (!style)
+ return 0;
+
+ switch (propertiesToInclude) {
+ case EditingStyle::AllProperties:
+ case EditingStyle::EditingPropertiesInEffect:
+ return copyEditingProperties(style, AllEditingProperties);
+ case EditingStyle::OnlyEditingInheritableProperties:
+ return copyEditingProperties(style, OnlyInheritableEditingProperties);
+ }
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPropertyOverrideMode mode, PropertiesToInclude propertiesToInclude)
{
RefPtr<EditingStyle> styleFromRules = EditingStyle::create();
styleFromRules->mergeStyleFromRulesForSerialization(element);
- styleFromRules->removeNonEditingProperties();
+ styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_mutableStyle.get(), propertiesToInclude);
mergeStyle(styleFromRules->m_mutableStyle.get(), mode);
mergeInlineStyleOfElement(element, mode, propertiesToInclude);
« no previous file with comments | « Source/core/editing/EditingStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698