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

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

Issue 22378004: Replace error-prone value with check from CSSProperty (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase after text-decoration patch revert 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 | « no previous file | 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 4de2caaff33eec502b53a0dafe9fff794b724418..614038c2de9597891c66cd616b64410bf9c9d821 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -58,16 +58,10 @@ namespace WebCore {
// Editing style properties must be preserved during editing operation.
// e.g. when a user inserts a new paragraph, all properties listed here must be copied to the new paragraph.
-// NOTE: Use editingProperties() to respect runtime enabling of properties.
-static const unsigned nonInheritedStaticPropertiesCount = 2;
-
+// NOTE: Use either allEditingProperties() or inheritableEditingProperties() to
+// respect runtime enabling of properties.
static const CSSPropertyID staticEditingProperties[] = {
- // NOTE: inheritableEditingProperties depends on these two properties being first.
- // If you change this list, make sure to update nonInheritedPropertyCount.
CSSPropertyBackgroundColor,
- CSSPropertyTextDecoration,
-
- // CSS inheritable properties
CSSPropertyColor,
CSSPropertyFontFamily,
CSSPropertyFontSize,
@@ -78,6 +72,7 @@ static const CSSPropertyID staticEditingProperties[] = {
CSSPropertyLineHeight,
CSSPropertyOrphans,
CSSPropertyTextAlign,
+ CSSPropertyTextDecoration,
CSSPropertyTextIndent,
CSSPropertyTextTransform,
CSSPropertyWhiteSpace,
@@ -102,8 +97,16 @@ static const Vector<CSSPropertyID>& allEditingProperties()
static const Vector<CSSPropertyID>& inheritableEditingProperties()
{
DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
- if (properties.isEmpty())
- RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingProperties + nonInheritedStaticPropertiesCount, WTF_ARRAY_LENGTH(staticEditingProperties) - nonInheritedStaticPropertiesCount, properties);
+ if (properties.isEmpty()) {
+ RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingProperties, WTF_ARRAY_LENGTH(staticEditingProperties), properties);
+ for (size_t index = 0; index < properties.size();) {
+ if (!CSSProperty::isInheritedProperty(properties[index])) {
+ properties.remove(index);
+ continue;
+ }
+ ++index;
+ }
+ }
return properties;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698