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

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

Issue 1183023003: Move (copy/remove)BlockProperties out of MutableStylePropertySet (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/css/StylePropertySet.cpp ('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 053be543ff09367a2ec05f1721bdd8da099aa9ba..52a3c39c96301892632d7f7bacee2d4b5bc6184c 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -594,14 +594,45 @@ PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::copy() const
return copy;
}
+// This is the list of CSS properties that apply specially to block-level elements.
+static const CSSPropertyID staticBlockProperties[] = {
+ CSSPropertyOrphans,
+ CSSPropertyOverflow, // This can be also be applied to replaced elements
+ CSSPropertyWebkitColumnCount,
+ CSSPropertyWebkitColumnGap,
+ CSSPropertyWebkitColumnRuleColor,
+ CSSPropertyWebkitColumnRuleStyle,
+ CSSPropertyWebkitColumnRuleWidth,
+ CSSPropertyWebkitColumnBreakBefore,
+ CSSPropertyWebkitColumnBreakAfter,
+ CSSPropertyWebkitColumnBreakInside,
+ CSSPropertyWebkitColumnWidth,
+ CSSPropertyPageBreakAfter,
+ CSSPropertyPageBreakBefore,
+ CSSPropertyPageBreakInside,
+ CSSPropertyTextAlign,
+ CSSPropertyTextAlignLast,
+ CSSPropertyTextIndent,
+ CSSPropertyTextJustify,
+ CSSPropertyWidows
+};
+
+static const Vector<CSSPropertyID>& blockPropertiesVector()
+{
+ DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
+ if (properties.isEmpty())
+ CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(staticBlockProperties, WTF_ARRAY_LENGTH(staticBlockProperties), properties);
+ return properties;
+}
+
PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperties()
{
RefPtrWillBeRawPtr<EditingStyle> blockProperties = EditingStyle::create();
if (!m_mutableStyle)
return blockProperties;
- blockProperties->m_mutableStyle = m_mutableStyle->copyBlockProperties();
- m_mutableStyle->removeBlockProperties();
+ blockProperties->m_mutableStyle = m_mutableStyle->copyPropertiesInSet(blockPropertiesVector());
+ removeBlockProperties();
return blockProperties;
}
@@ -625,7 +656,7 @@ void EditingStyle::removeBlockProperties()
if (!m_mutableStyle)
return;
- m_mutableStyle->removeBlockProperties();
+ m_mutableStyle->removePropertiesInSet(blockPropertiesVector().data(), blockPropertiesVector().size());
rune 2015/06/16 06:46:59 I thought removePropertiesFromSet sounded better.
Timothy Loh 2015/06/17 01:31:43 I didn't really look at the names since I was just
}
void EditingStyle::removeStyleAddedByElement(Element* element)
« no previous file with comments | « Source/core/css/StylePropertySet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698