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

Unified Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 98663004: Add support for unprefixed CSS Transforms (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 9 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/resolver/StyleAdjuster.cpp ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleBuilderCustom.cpp
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index 4594e7069ae5addbf3e61c03fecacf1aecbae8fd..17e5730423600bdbcd9b7340444c8cdc1c2132e0 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -582,6 +582,121 @@ void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state.style()->setTextIndentLine(TextIndentFirstLine);
}
+void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolverState& state)
+{
+ applyInitialCSSPropertyWebkitTransformOriginX(state);
+ applyInitialCSSPropertyWebkitTransformOriginY(state);
+ applyInitialCSSPropertyWebkitTransformOriginZ(state);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyTransformOrigin(StyleResolverState& state)
+{
+ applyInheritCSSPropertyWebkitTransformOriginX(state);
+ applyInheritCSSPropertyWebkitTransformOriginY(state);
+ applyInheritCSSPropertyWebkitTransformOriginZ(state);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyTransformOrigin(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ ASSERT(list->length() == 3);
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
+ if (primitiveValue->isValueID()) {
+ switch (primitiveValue->getValueID()) {
+ case CSSValueLeft:
+ state.style()->setTransformOriginX(Length(0, Percent));
+ break;
+ case CSSValueRight:
+ state.style()->setTransformOriginX(Length(100, Percent));
+ break;
+ case CSSValueCenter:
+ state.style()->setTransformOriginX(Length(50, Percent));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ } else {
+ state.style()->setTransformOriginX(StyleBuilderConverter::convertLength(state, primitiveValue));
+ }
+
+ primitiveValue = toCSSPrimitiveValue(list->item(1));
+ if (primitiveValue->isValueID()) {
+ switch (primitiveValue->getValueID()) {
+ case CSSValueTop:
+ state.style()->setTransformOriginY(Length(0, Percent));
+ break;
+ case CSSValueBottom:
+ state.style()->setTransformOriginY(Length(100, Percent));
+ break;
+ case CSSValueCenter:
+ state.style()->setTransformOriginY(Length(50, Percent));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ } else {
+ state.style()->setTransformOriginY(StyleBuilderConverter::convertLength(state, primitiveValue));
+ }
+
+ primitiveValue = toCSSPrimitiveValue(list->item(2));
+ state.style()->setTransformOriginZ(StyleBuilderConverter::convertComputedLength<float>(state, primitiveValue));
+}
+
+void StyleBuilderFunctions::applyInitialCSSPropertyPerspectiveOrigin(StyleResolverState& state)
+{
+ applyInitialCSSPropertyWebkitPerspectiveOriginX(state);
+ applyInitialCSSPropertyWebkitPerspectiveOriginY(state);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyPerspectiveOrigin(StyleResolverState& state)
+{
+ applyInheritCSSPropertyWebkitPerspectiveOriginX(state);
+ applyInheritCSSPropertyWebkitPerspectiveOriginY(state);
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyPerspectiveOrigin(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ ASSERT(list->length() == 2);
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
+ if (primitiveValue->isValueID()) {
+ switch (primitiveValue->getValueID()) {
+ case CSSValueLeft:
+ state.style()->setPerspectiveOriginX(Length(0, Percent));
+ break;
+ case CSSValueRight:
+ state.style()->setPerspectiveOriginX(Length(100, Percent));
+ break;
+ case CSSValueCenter:
+ state.style()->setPerspectiveOriginX(Length(50, Percent));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ } else {
+ state.style()->setPerspectiveOriginX(StyleBuilderConverter::convertLength(state, primitiveValue));
+ }
+
+ primitiveValue = toCSSPrimitiveValue(list->item(1));
+ if (primitiveValue->isValueID()) {
+ switch (primitiveValue->getValueID()) {
+ case CSSValueTop:
+ state.style()->setPerspectiveOriginY(Length(0, Percent));
+ break;
+ case CSSValueBottom:
+ state.style()->setPerspectiveOriginY(Length(100, Percent));
+ break;
+ case CSSValueCenter:
+ state.style()->setPerspectiveOriginY(Length(50, Percent));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ } else {
+ state.style()->setPerspectiveOriginY(StyleBuilderConverter::convertLength(state, primitiveValue));
+ }
+}
+
void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverState& state, CSSValue* value)
{
if (!value->isPrimitiveValue())
@@ -1422,6 +1537,7 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state,
state.style()->setTextStrokeWidth(width);
return;
}
+ case CSSPropertyTransform:
case CSSPropertyWebkitTransform: {
HANDLE_INHERIT_AND_INITIAL(transform, Transform);
TransformOperations operations;
@@ -1429,6 +1545,7 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state,
state.style()->setTransform(operations);
return;
}
+ case CSSPropertyPerspective:
case CSSPropertyWebkitPerspective: {
HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
@@ -1443,8 +1560,8 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state,
float perspectiveValue;
if (primitiveValue->isLength()) {
perspectiveValue = primitiveValue->computeLength<float>(state.cssToLengthConversionData());
- } else if (primitiveValue->isNumber()) {
- // For backward compatibility, treat valueless numbers as px.
+ } else if (id == CSSPropertyWebkitPerspective && primitiveValue->isNumber()) {
+ // Prefixed version treates unitless numbers as px.
perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.cssToLengthConversionData());
} else {
return;
@@ -1880,6 +1997,7 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state,
case CSSPropertyWebkitAnimationTimingFunction:
case CSSPropertyWebkitAppearance:
case CSSPropertyWebkitAspectRatio:
+ case CSSPropertyBackfaceVisibility:
case CSSPropertyWebkitBackfaceVisibility:
case CSSPropertyWebkitBackgroundClip:
case CSSPropertyWebkitBackgroundComposite:
@@ -1945,6 +2063,7 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state,
case CSSPropertyWebkitMaskRepeatX:
case CSSPropertyWebkitMaskRepeatY:
case CSSPropertyWebkitMaskSize:
+ case CSSPropertyPerspectiveOrigin:
case CSSPropertyWebkitPerspectiveOrigin:
case CSSPropertyWebkitPerspectiveOriginX:
case CSSPropertyWebkitPerspectiveOriginY:
@@ -1962,6 +2081,8 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state,
case CSSPropertyWebkitTransformOriginX:
case CSSPropertyWebkitTransformOriginY:
case CSSPropertyWebkitTransformOriginZ:
+ case CSSPropertyTransformOrigin:
+ case CSSPropertyTransformStyle:
case CSSPropertyWebkitTransformStyle:
case CSSPropertyWebkitTransitionDelay:
case CSSPropertyWebkitTransitionDuration:
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.cpp ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698