Title: [160070] trunk/Source/WebCore
- Revision
- 160070
- Author
- [email protected]
- Date
- 2013-12-03 21:33:24 -0800 (Tue, 03 Dec 2013)
Log Message
Add a CSSProperty::isDirectionAwareProperty() helper.
<https://webkit.org/b/125202>
Move the block of case labels for checking whether a CSS property ID
is a directional property into a separate function. Also removed an
outdated comment about CSS variables.
Reviewed by Antti Koivisto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (160069 => 160070)
--- trunk/Source/WebCore/ChangeLog 2013-12-04 05:25:13 UTC (rev 160069)
+++ trunk/Source/WebCore/ChangeLog 2013-12-04 05:33:24 UTC (rev 160070)
@@ -1,3 +1,14 @@
+2013-12-03 Andreas Kling <[email protected]>
+
+ Add a CSSProperty::isDirectionAwareProperty() helper.
+ <https://webkit.org/b/125202>
+
+ Move the block of case labels for checking whether a CSS property ID
+ is a directional property into a separate function. Also removed an
+ outdated comment about CSS variables.
+
+ Reviewed by Antti Koivisto.
+
2013-12-03 Ryosuke Niwa <[email protected]>
Revert the inadvertently committed change.
Modified: trunk/Source/WebCore/css/CSSProperty.cpp (160069 => 160070)
--- trunk/Source/WebCore/css/CSSProperty.cpp 2013-12-04 05:25:13 UTC (rev 160069)
+++ trunk/Source/WebCore/css/CSSProperty.cpp 2013-12-04 05:33:24 UTC (rev 160070)
@@ -257,4 +257,39 @@
}
}
+bool CSSProperty::isDirectionAwareProperty(CSSPropertyID propertyID)
+{
+ switch (propertyID) {
+ case CSSPropertyWebkitBorderEndColor:
+ case CSSPropertyWebkitBorderEndStyle:
+ case CSSPropertyWebkitBorderEndWidth:
+ case CSSPropertyWebkitBorderStartColor:
+ case CSSPropertyWebkitBorderStartStyle:
+ case CSSPropertyWebkitBorderStartWidth:
+ case CSSPropertyWebkitBorderBeforeColor:
+ case CSSPropertyWebkitBorderBeforeStyle:
+ case CSSPropertyWebkitBorderBeforeWidth:
+ case CSSPropertyWebkitBorderAfterColor:
+ case CSSPropertyWebkitBorderAfterStyle:
+ case CSSPropertyWebkitBorderAfterWidth:
+ case CSSPropertyWebkitMarginEnd:
+ case CSSPropertyWebkitMarginStart:
+ case CSSPropertyWebkitMarginBefore:
+ case CSSPropertyWebkitMarginAfter:
+ case CSSPropertyWebkitPaddingEnd:
+ case CSSPropertyWebkitPaddingStart:
+ case CSSPropertyWebkitPaddingBefore:
+ case CSSPropertyWebkitPaddingAfter:
+ case CSSPropertyWebkitLogicalWidth:
+ case CSSPropertyWebkitLogicalHeight:
+ case CSSPropertyWebkitMinLogicalWidth:
+ case CSSPropertyWebkitMinLogicalHeight:
+ case CSSPropertyWebkitMaxLogicalWidth:
+ case CSSPropertyWebkitMaxLogicalHeight:
+ return true;
+ default:
+ return false;
+ }
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSProperty.h (160069 => 160070)
--- trunk/Source/WebCore/css/CSSProperty.h 2013-12-04 05:25:13 UTC (rev 160069)
+++ trunk/Source/WebCore/css/CSSProperty.h 2013-12-04 05:33:24 UTC (rev 160070)
@@ -79,6 +79,7 @@
static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirection, WritingMode);
static bool isInheritedProperty(CSSPropertyID);
+ static bool isDirectionAwareProperty(CSSPropertyID);
const StylePropertyMetadata& metadata() const { return m_metadata; }
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (160069 => 160070)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2013-12-04 05:25:13 UTC (rev 160069)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2013-12-04 05:33:24 UTC (rev 160070)
@@ -2027,10 +2027,16 @@
void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
{
- // CSS variables don't resolve shorthands at parsing time, so this should be *after* handling variables.
ASSERT_WITH_MESSAGE(!isExpandedShorthand(id), "Shorthand property id = %d wasn't expanded at parsing time", id);
State& state = m_state;
+
+ if (CSSProperty::isDirectionAwareProperty(id)) {
+ CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style()->direction(), state.style()->writingMode());
+ ASSERT(newId != id);
+ return applyProperty(newId, value);
+ }
+
bool isInherit = state.parentNode() && value->isInheritedValue();
bool isInitial = value->isInitialValue() || (!state.parentNode() && value->isInheritedValue());
@@ -2557,38 +2563,6 @@
#endif
case CSSPropertyInvalid:
return;
- // Directional properties are resolved by resolveDirectionAwareProperty() before the switch.
- case CSSPropertyWebkitBorderEndColor:
- case CSSPropertyWebkitBorderEndStyle:
- case CSSPropertyWebkitBorderEndWidth:
- case CSSPropertyWebkitBorderStartColor:
- case CSSPropertyWebkitBorderStartStyle:
- case CSSPropertyWebkitBorderStartWidth:
- case CSSPropertyWebkitBorderBeforeColor:
- case CSSPropertyWebkitBorderBeforeStyle:
- case CSSPropertyWebkitBorderBeforeWidth:
- case CSSPropertyWebkitBorderAfterColor:
- case CSSPropertyWebkitBorderAfterStyle:
- case CSSPropertyWebkitBorderAfterWidth:
- case CSSPropertyWebkitMarginEnd:
- case CSSPropertyWebkitMarginStart:
- case CSSPropertyWebkitMarginBefore:
- case CSSPropertyWebkitMarginAfter:
- case CSSPropertyWebkitPaddingEnd:
- case CSSPropertyWebkitPaddingStart:
- case CSSPropertyWebkitPaddingBefore:
- case CSSPropertyWebkitPaddingAfter:
- case CSSPropertyWebkitLogicalWidth:
- case CSSPropertyWebkitLogicalHeight:
- case CSSPropertyWebkitMinLogicalWidth:
- case CSSPropertyWebkitMinLogicalHeight:
- case CSSPropertyWebkitMaxLogicalWidth:
- case CSSPropertyWebkitMaxLogicalHeight:
- {
- CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, state.style()->direction(), state.style()->writingMode());
- ASSERT(newId != id);
- return applyProperty(newId, value);
- }
case CSSPropertyFontStretch:
case CSSPropertyPage:
case CSSPropertyTextLineThrough:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes