+2009-02-12 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Dave Hyatt
+
+ https://bugs.webkit.org/show_bug.cgi?id=23908
+
+ Added test for parsing 3d functions in webkit-transform
+
+ * transforms/3d: Added.
+ * transforms/3d/cssmatrix-3d-interface-expected.txt: Added.
+ * transforms/3d/cssmatrix-3d-interface.xhtml: Added.
+
2009-02-12 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Darin Adler.
+2009-02-12 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Dave Hyatt
+
+ https://bugs.webkit.org/show_bug.cgi?id=23908
+
+ Added parsing of 3d transform functions and properties
+ (perspective, perspective-origin, transform-style-3d,
+ and backface-visibility).
+
+ Test: transforms/3d/cssmatrix-3d-interface.xhtml
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::):
+ (WebCore::computedTransform):
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * css/CSSMutableStyleDeclaration.cpp:
+ (WebCore::CSSMutableStyleDeclaration::getPropertyValue):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseFillProperty):
+ (WebCore::CSSParser::parseTransformOriginShorthand):
+ (WebCore::TransformOperationInfo::TransformOperationInfo):
+ (WebCore::CSSParser::parseTransform):
+ (WebCore::CSSParser::parseTransformOrigin):
+ (WebCore::CSSParser::parsePerspectiveOrigin):
+ * css/CSSParser.h:
+ * css/CSSPrimitiveValue.h:
+ (WebCore::CSSPrimitiveValue::isUnitTypeLength):
+ * css/CSSPropertyNames.in:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::adjustRenderStyle):
+ (WebCore::convertToLength):
+ (WebCore::CSSStyleSelector::applyProperty):
+ (WebCore::CSSStyleSelector::mapFillSize):
+ (WebCore::CSSStyleSelector::mapFillXPosition):
+ (WebCore::CSSStyleSelector::mapFillYPosition):
+ (WebCore::getTransformOperationType):
+ (WebCore::CSSStyleSelector::createTransformOperations):
+ * css/CSSValueKeywords.in:
+ * css/WebKitCSSTransformValue.cpp:
+ (WebCore::WebKitCSSTransformValue::cssText):
+ * css/WebKitCSSTransformValue.h:
+ (WebCore::WebKitCSSTransformValue::):
+ * css/WebKitCSSTransformValue.idl:
+ * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
+ * platform/graphics/transforms/Matrix3DTransformOperation.h:
+ * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
+ * platform/graphics/transforms/PerspectiveTransformOperation.h:
+ * platform/graphics/transforms/RotateTransformOperation.cpp:
+ (WebCore::RotateTransformOperation::blend):
+ * platform/graphics/transforms/RotateTransformOperation.h:
+ (WebCore::RotateTransformOperation::RotateTransformOperation):
+ * platform/graphics/transforms/ScaleTransformOperation.h:
+ (WebCore::ScaleTransformOperation::ScaleTransformOperation):
+ * platform/graphics/transforms/TransformOperation.h:
+ (WebCore::TransformOperation::is3DOperation):
+ * platform/graphics/transforms/TransformOperations.h:
+ (WebCore::TransformOperations::has3DOperation):
+ * platform/graphics/transforms/TranslateTransformOperation.h:
+ (WebCore::TranslateTransformOperation::TranslateTransformOperation):
+
2009-02-12 Kevin Ollivier <kevino@theolliviers.com>
wx build fix.
CSSPropertyWebkitAnimationName,
CSSPropertyWebkitAnimationTimingFunction,
CSSPropertyWebkitAppearance,
+ CSSPropertyWebkitBackfaceVisibility,
CSSPropertyWebkitBackgroundClip,
CSSPropertyWebkitBackgroundComposite,
CSSPropertyWebkitBackgroundOrigin,
CSSPropertyWebkitMaskOrigin,
CSSPropertyWebkitMaskSize,
CSSPropertyWebkitNbspMode,
+ CSSPropertyWebkitPerspective,
+ CSSPropertyWebkitPerspectiveOrigin,
CSSPropertyWebkitRtlOrdering,
CSSPropertyWebkitTextDecorationsInEffect,
CSSPropertyWebkitTextFillColor,
CSSPropertyWebkitTextStrokeWidth,
CSSPropertyWebkitTransform,
CSSPropertyWebkitTransformOrigin,
+ CSSPropertyWebkitTransformStyle,
CSSPropertyWebkitTransitionDelay,
CSSPropertyWebkitTransitionDuration,
CSSPropertyWebkitTransitionProperty,
TransformationMatrix transform;
style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
- RefPtr<WebKitCSSTransformValue> transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
+ RefPtr<WebKitCSSTransformValue> transformVal;
- transformVal->append(CSSPrimitiveValue::create(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.e(), CSSPrimitiveValue::CSS_NUMBER));
- transformVal->append(CSSPrimitiveValue::create(transform.f(), CSSPrimitiveValue::CSS_NUMBER));
+ // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
+ if (transform.isAffine()) {
+ transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
+
+ transformVal->append(CSSPrimitiveValue::create(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.e(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.f(), CSSPrimitiveValue::CSS_NUMBER));
+ } else {
+ transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
+
+ transformVal->append(CSSPrimitiveValue::create(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
+
+ transformVal->append(CSSPrimitiveValue::create(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
+
+ transformVal->append(CSSPrimitiveValue::create(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
+
+ transformVal->append(CSSPrimitiveValue::create(transform.m41(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m42(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m43(), CSSPrimitiveValue::CSS_NUMBER));
+ transformVal->append(CSSPrimitiveValue::create(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
+ }
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(transformVal);
return getTimingFunctionValue(style->animations());
case CSSPropertyWebkitAppearance:
return CSSPrimitiveValue::create(style->appearance());
+ case CSSPropertyWebkitBackfaceVisibility:
+ return CSSPrimitiveValue::createIdentifier((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
case CSSPropertyWebkitBorderImage:
return valueForNinePieceImage(style->borderImage());
case CSSPropertyWebkitMaskBoxImage:
return CSSPrimitiveValue::create(style->marginBottomCollapse());
case CSSPropertyWebkitMarginTopCollapse:
return CSSPrimitiveValue::create(style->marginTopCollapse());
+ case CSSPropertyWebkitPerspective:
+ if (style->perspective() == 0)
+ return CSSPrimitiveValue::createIdentifier(CSSValueNone);
+ return CSSPrimitiveValue::create(style->perspective(), CSSPrimitiveValue::CSS_NUMBER);
+ case CSSPropertyWebkitPerspectiveOrigin: {
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ if (renderer) {
+ IntRect box = sizingBox(renderer);
+ list->append(CSSPrimitiveValue::create(style->perspectiveOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX));
+ list->append(CSSPrimitiveValue::create(style->perspectiveOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX));
+ }
+ else {
+ list->append(CSSPrimitiveValue::create(style->perspectiveOriginX()));
+ list->append(CSSPrimitiveValue::create(style->perspectiveOriginY()));
+ }
+ return list.release();
+ }
case CSSPropertyWebkitRtlOrdering:
if (style->visuallyOrdered())
return CSSPrimitiveValue::createIdentifier(CSSValueVisual);
IntRect box = sizingBox(renderer);
list->append(CSSPrimitiveValue::create(style->transformOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX));
list->append(CSSPrimitiveValue::create(style->transformOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX));
+ if (style->transformOriginZ() != 0)
+ list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX));
} else {
list->append(CSSPrimitiveValue::create(style->transformOriginX()));
list->append(CSSPrimitiveValue::create(style->transformOriginY()));
+ if (style->transformOriginZ() != 0)
+ list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX));
}
return list.release();
}
+ case CSSPropertyWebkitTransformStyle:
+ return CSSPrimitiveValue::createIdentifier((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
case CSSPropertyWebkitTransitionDelay:
return getDelayValue(style->transitions());
case CSSPropertyWebkitTransitionDuration:
return getLayeredShorthandValue(properties, 6);
}
case CSSPropertyWebkitTransformOrigin: {
- const int properties[2] = { CSSPropertyWebkitTransformOriginX,
- CSSPropertyWebkitTransformOriginY };
- return getShorthandValue(properties, 2);
+ const int properties[3] = { CSSPropertyWebkitTransformOriginX,
+ CSSPropertyWebkitTransformOriginY,
+ CSSPropertyWebkitTransformOriginZ };
+ return getShorthandValue(properties, 3);
}
case CSSPropertyWebkitTransition: {
const int properties[4] = { CSSPropertyWebkitTransitionProperty, CSSPropertyWebkitTransitionDuration,
break;
case CSSPropertyWebkitTransformOrigin:
case CSSPropertyWebkitTransformOriginX:
- case CSSPropertyWebkitTransformOriginY: {
+ case CSSPropertyWebkitTransformOriginY:
+ case CSSPropertyWebkitTransformOriginZ: {
+ RefPtr<CSSValue> val1;
+ RefPtr<CSSValue> val2;
+ RefPtr<CSSValue> val3;
+ int propId1, propId2, propId3;
+ if (parseTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) {
+ addProperty(propId1, val1.release(), important);
+ if (val2)
+ addProperty(propId2, val2.release(), important);
+ if (val3)
+ addProperty(propId3, val3.release(), important);
+ return true;
+ }
+ return false;
+ }
+ case CSSPropertyWebkitTransformStyle:
+ if (value->id == CSSValueFlat || value->id == CSSValuePreserve3d)
+ valid_primitive = true;
+ break;
+ case CSSPropertyWebkitBackfaceVisibility:
+ if (value->id == CSSValueVisible || value->id == CSSValueHidden)
+ valid_primitive = true;
+ break;
+ case CSSPropertyWebkitPerspective:
+ if (id == CSSValueNone)
+ valid_primitive = true;
+ else {
+ if (validUnit(value, FNumber|FNonNeg, m_strict)) {
+ RefPtr<CSSValue> val = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
+ if (val) {
+ addProperty(propId, val.release(), important);
+ return true;
+ }
+ return false;
+ }
+ }
+ break;
+ case CSSPropertyWebkitPerspectiveOrigin:
+ case CSSPropertyWebkitPerspectiveOriginX:
+ case CSSPropertyWebkitPerspectiveOriginY: {
RefPtr<CSSValue> val1;
RefPtr<CSSValue> val2;
int propId1, propId2;
- if (parseTransformOrigin(propId, propId1, propId2, val1, val2)) {
+ if (parsePerspectiveOrigin(propId, propId1, propId2, val1, val2)) {
addProperty(propId1, val1.release(), important);
if (val2)
addProperty(propId2, val2.release(), important);
case CSSPropertyBackgroundPosition:
case CSSPropertyWebkitMaskPosition:
parseFillPosition(currValue, currValue2);
- // unlike the other functions, parseFillPosition advances the m_valueList pointer
+ // parseFillPosition advances the m_valueList pointer
break;
case CSSPropertyBackgroundPositionX:
case CSSPropertyWebkitMaskPositionX: {
return 0;
}
+void CSSParser::parseTransformOriginShorthand(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
+{
+ parseFillPosition(value1, value2);
+
+ // now get z
+ if (m_valueList->current() && validUnit(m_valueList->current(), FLength, m_strict))
+ value3 = CSSPrimitiveValue::create(m_valueList->current()->fValue,
+ (CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit);
+ if (value3)
+ m_valueList->next();
+}
+
bool CSSParser::parseTimingFunctionValue(CSSParserValueList*& args, double& result)
{
CSSParserValue* v = args->current();
, m_allowSingleArgument(false)
, m_unit(CSSParser::FUnknown)
{
- if (equalIgnoringCase(name, "scale(") || equalIgnoringCase(name, "scalex(") || equalIgnoringCase(name, "scaley(")) {
+ if (equalIgnoringCase(name, "scale(") || equalIgnoringCase(name, "scalex(") || equalIgnoringCase(name, "scaley(") || equalIgnoringCase(name, "scalez(")) {
m_unit = CSSParser::FNumber;
if (equalIgnoringCase(name, "scale("))
m_type = WebKitCSSTransformValue::ScaleTransformOperation;
else if (equalIgnoringCase(name, "scalex("))
m_type = WebKitCSSTransformValue::ScaleXTransformOperation;
- else
+ else if (equalIgnoringCase(name, "scaley("))
m_type = WebKitCSSTransformValue::ScaleYTransformOperation;
+ else
+ m_type = WebKitCSSTransformValue::ScaleZTransformOperation;
+ } else if (equalIgnoringCase(name, "scale3d(")) {
+ m_type = WebKitCSSTransformValue::Scale3DTransformOperation;
+ m_argCount = 5;
+ m_unit = CSSParser::FNumber;
} else if (equalIgnoringCase(name, "rotate(")) {
m_type = WebKitCSSTransformValue::RotateTransformOperation;
m_unit = CSSParser::FAngle;
+ } else if (equalIgnoringCase(name, "rotatex(") ||
+ equalIgnoringCase(name, "rotatey(") ||
+ equalIgnoringCase(name, "rotatez(")) {
+ m_unit = CSSParser::FAngle;
+ if (equalIgnoringCase(name, "rotatex("))
+ m_type = WebKitCSSTransformValue::RotateXTransformOperation;
+ else if (equalIgnoringCase(name, "rotatey("))
+ m_type = WebKitCSSTransformValue::RotateYTransformOperation;
+ else
+ m_type = WebKitCSSTransformValue::RotateZTransformOperation;
+ } else if (equalIgnoringCase(name, "rotate3d(")) {
+ m_type = WebKitCSSTransformValue::Rotate3DTransformOperation;
+ m_argCount = 7;
+ m_unit = CSSParser::FNumber;
} else if (equalIgnoringCase(name, "skew(") || equalIgnoringCase(name, "skewx(") || equalIgnoringCase(name, "skewy(")) {
m_unit = CSSParser::FAngle;
if (equalIgnoringCase(name, "skew("))
m_type = WebKitCSSTransformValue::SkewXTransformOperation;
else
m_type = WebKitCSSTransformValue::SkewYTransformOperation;
- } else if (equalIgnoringCase(name, "translate(") || equalIgnoringCase(name, "translatex(") || equalIgnoringCase(name, "translatey(")) {
+ } else if (equalIgnoringCase(name, "translate(") || equalIgnoringCase(name, "translatex(") || equalIgnoringCase(name, "translatey(") || equalIgnoringCase(name, "translatez(")) {
m_unit = CSSParser::FLength | CSSParser::FPercent;
if (equalIgnoringCase(name, "translate("))
m_type = WebKitCSSTransformValue::TranslateTransformOperation;
else if (equalIgnoringCase(name, "translatex("))
m_type = WebKitCSSTransformValue::TranslateXTransformOperation;
- else
+ else if (equalIgnoringCase(name, "translatey("))
m_type = WebKitCSSTransformValue::TranslateYTransformOperation;
+ else
+ m_type = WebKitCSSTransformValue::TranslateZTransformOperation;
+ } else if (equalIgnoringCase(name, "translate3d(")) {
+ m_type = WebKitCSSTransformValue::Translate3DTransformOperation;
+ m_argCount = 5;
+ m_unit = CSSParser::FLength | CSSParser::FPercent;
} else if (equalIgnoringCase(name, "matrix(")) {
m_type = WebKitCSSTransformValue::MatrixTransformOperation;
m_argCount = 11;
m_unit = CSSParser::FNumber;
+ } else if (equalIgnoringCase(name, "matrix3d(")) {
+ m_type = WebKitCSSTransformValue::Matrix3DTransformOperation;
+ m_argCount = 31;
+ m_unit = CSSParser::FNumber;
+ } else if (equalIgnoringCase(name, "perspective(")) {
+ m_type = WebKitCSSTransformValue::PerspectiveTransformOperation;
+ m_unit = CSSParser::FNumber;
}
-
+
if (equalIgnoringCase(name, "scale(") || equalIgnoringCase(name, "skew(") || equalIgnoringCase(name, "translate(")) {
m_allowSingleArgument = true;
m_argCount = 3;
while (a) {
CSSParser::Units unit = info.unit();
- if (!validUnit(a, unit, true))
+ // 4th param of rotate3d() is an angle rather than a bare number, validate it as such
+ if (info.type() == WebKitCSSTransformValue::Rotate3DTransformOperation && argNumber == 3) {
+ if (!validUnit(a, FAngle, true))
+ return 0;
+ } else if (!validUnit(a, unit, true))
return 0;
// Add the value to the current transform operation.
return list.release();
}
-bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2)
+bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
{
propId1 = propId;
propId2 = propId;
+ propId3 = propId;
if (propId == CSSPropertyWebkitTransformOrigin) {
propId1 = CSSPropertyWebkitTransformOriginX;
propId2 = CSSPropertyWebkitTransformOriginY;
+ propId3 = CSSPropertyWebkitTransformOriginZ;
}
switch (propId) {
case CSSPropertyWebkitTransformOrigin:
- parseFillPosition(value, value2);
- // Unlike the other functions, parseFillPosition advances the m_valueList pointer
+ parseTransformOriginShorthand(value, value2, value3);
+ // parseTransformOriginShorthand advances the m_valueList pointer
break;
case CSSPropertyWebkitTransformOriginX: {
bool xFound = false, yFound = true;
m_valueList->next();
break;
}
+ case CSSPropertyWebkitTransformOriginZ: {
+ if (validUnit(m_valueList->current(), FLength, m_strict))
+ value = CSSPrimitiveValue::create(m_valueList->current()->fValue, (CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit);
+ if (value)
+ m_valueList->next();
+ break;
+ }
+ }
+
+ return value;
+}
+
+bool CSSParser::parsePerspectiveOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2)
+{
+ propId1 = propId;
+ propId2 = propId;
+ if (propId == CSSPropertyWebkitPerspectiveOrigin) {
+ propId1 = CSSPropertyWebkitPerspectiveOriginX;
+ propId2 = CSSPropertyWebkitPerspectiveOriginY;
+ }
+
+ switch (propId) {
+ case CSSPropertyWebkitPerspectiveOrigin:
+ parseFillPosition(value, value2);
+ break;
+ case CSSPropertyWebkitPerspectiveOriginX: {
+ bool xFound = false, yFound = true;
+ value = parseFillPositionXY(xFound, yFound);
+ if (value)
+ m_valueList->next();
+ break;
+ }
+ case CSSPropertyWebkitPerspectiveOriginY: {
+ bool xFound = true, yFound = false;
+ value = parseFillPositionXY(xFound, yFound);
+ if (value)
+ m_valueList->next();
+ break;
+ }
}
return value;
PassRefPtr<CSSValue> parseAnimationProperty();
PassRefPtr<CSSValue> parseAnimationTimingFunction();
+ void parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
bool parseTimingFunctionValue(CSSParserValueList*& args, double& result);
bool parseAnimationProperty(int propId, RefPtr<CSSValue>&);
bool parseTransitionShorthand(bool important);
bool parseGradient(RefPtr<CSSValue>&);
PassRefPtr<CSSValueList> parseTransform();
- bool parseTransformOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-
+ bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parsePerspectiveOrigin(int propId, int& propId1, int& propId, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
bool parseVariable(CSSVariablesDeclaration*, const String& variableName, const String& variableValue);
void parsePropertyWithResolvedVariables(int propId, bool important, CSSMutableStyleDeclaration*, CSSParserValueList*);
// This unit is in CSS 3, but that isn't a finished standard yet
CSS_TURN = 108
};
+
+ static bool isUnitTypeLength(int type) { return type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG; }
static PassRefPtr<CSSPrimitiveValue> createIdentifier(int ident);
static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue);
-webkit-animation-name
-webkit-animation-timing-function
-webkit-appearance
+-webkit-backface-visibility
-webkit-background-clip
-webkit-background-composite
-webkit-background-origin
-webkit-match-nearest-mail-blockquote-color
-webkit-nbsp-mode
-webkit-padding-start
+-webkit-perspective
+-webkit-perspective-origin
+-webkit-perspective-origin-x
+-webkit-perspective-origin-y
-webkit-rtl-ordering
-webkit-text-decorations-in-effect
-webkit-text-fill-color
-webkit-transform-origin
-webkit-transform-origin-x
-webkit-transform-origin-y
+-webkit-transform-origin-z
+-webkit-transform-style
-webkit-transition
-webkit-transition-delay
-webkit-transition-duration
#include "HTMLTextAreaElement.h"
#include "LinkHash.h"
#include "MatrixTransformOperation.h"
+#include "Matrix3DTransformOperation.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "NodeRenderStyle.h"
#include "Page.h"
#include "PageGroup.h"
#include "Pair.h"
+#include "PerspectiveTransformOperation.h"
#include "Rect.h"
#include "RenderScrollbar.h"
#include "RenderScrollbarTheme.h"
+#include "RenderStyleConstants.h"
#include "RenderTheme.h"
#include "RotateTransformOperation.h"
#include "ScaleTransformOperation.h"
#include "StyleGeneratedImage.h"
#include "StyleSheetList.h"
#include "Text.h"
+#include "TransformationMatrix.h"
#include "TranslateTransformOperation.h"
#include "UserAgentStyleSheets.h"
#include "WebKitCSSKeyframeRule.h"
// cases where objects that should be blended as a single unit end up with a non-transparent
// object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f ||
- style->hasTransform() || style->hasMask() || style->boxReflect()))
+ style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect()))
style->setZIndex(0);
// Button, legend, input, select and textarea all consider width values of 'auto' to be 'intrinsic'.
if (!style && (type == CSSPrimitiveValue::CSS_EMS || type == CSSPrimitiveValue::CSS_EXS)) {
if (ok)
*ok = false;
- } else if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ } else if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
}
if (m_style->setFontDescription(fontDescription))
m_fontDirty = true;
- return;
+ return;
}
case CSSPropertyFontWeight:
if (primitiveValue && !apply) {
int type = primitiveValue->primitiveType();
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
// Handle our quirky margin units if we have them.
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed,
primitiveValue->isQuirkValue());
if (primitiveValue && !apply) {
unsigned short type = primitiveValue->primitiveType();
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
} else {
int type = primitiveValue->primitiveType();
Length l;
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
(type != CSSPrimitiveValue::CSS_PERCENTAGE &&
type != CSSPrimitiveValue::CSS_EMS &&
type != CSSPrimitiveValue::CSS_EXS));
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
size = primitiveValue->computeLengthFloat(m_parentStyle, true);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
size = (primitiveValue->getFloatValue() * oldSize) / 100.0f;
int type = primitiveValue->primitiveType();
if (primitiveValue->getIdent() == CSSValueNormal)
lineHeight = Length(-100.0, Percent);
- else if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
+ else if (CSSPrimitiveValue::isUnitTypeLength(type)) {
double multiplier = m_style->effectiveZoom();
if (m_style->textSizeAdjust() && m_checker.m_document->frame() && m_checker.m_document->frame()->shouldApplyTextZoom())
multiplier *= m_checker.m_document->frame()->textZoomFactor();
return;
case CSSPropertyUnicodeRange: // Only used in @font-face rules.
return;
+ case CSSPropertyWebkitBackfaceVisibility:
+ HANDLE_INHERIT_AND_INITIAL(backfaceVisibility, BackfaceVisibility)
+ if (primitiveValue)
+ m_style->setBackfaceVisibility((primitiveValue->getIdent() == CSSValueVisible) ? BackfaceVisibilityVisible : BackfaceVisibilityHidden);
+ return;
case CSSPropertyWebkitBoxDirection:
HANDLE_INHERIT_AND_INITIAL(boxDirection, BoxDirection)
if (primitiveValue)
m_style->setBoxDirection(*primitiveValue);
- return;
+ return;
case CSSPropertyWebkitBoxLines:
HANDLE_INHERIT_AND_INITIAL(boxLines, BoxLines)
if (primitiveValue)
m_style->setBoxLines(*primitiveValue);
- return;
+ return;
case CSSPropertyWebkitBoxOrient:
HANDLE_INHERIT_AND_INITIAL(boxOrient, BoxOrient)
if (primitiveValue)
m_style->setBoxOrient(*primitiveValue);
- return;
+ return;
case CSSPropertyWebkitBoxPack:
{
HANDLE_INHERIT_AND_INITIAL(boxPack, BoxPack)
if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
return; // Error case.
m_style->setBoxFlexGroup((unsigned int)(primitiveValue->getDoubleValue()));
- return;
+ return;
case CSSPropertyWebkitBoxOrdinalGroup:
HANDLE_INHERIT_AND_INITIAL(boxOrdinalGroup, BoxOrdinalGroup)
if (!primitiveValue || primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
case CSSPropertyWebkitTransformOrigin:
HANDLE_INHERIT_AND_INITIAL(transformOriginX, TransformOriginX)
HANDLE_INHERIT_AND_INITIAL(transformOriginY, TransformOriginY)
+ HANDLE_INHERIT_AND_INITIAL(transformOriginZ, TransformOriginZ)
return;
case CSSPropertyWebkitTransformOriginX: {
HANDLE_INHERIT_AND_INITIAL(transformOriginX, TransformOriginX)
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
Length l;
int type = primitiveValue->primitiveType();
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
Length l;
int type = primitiveValue->primitiveType();
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
m_style->setTransformOriginY(l);
break;
}
+ case CSSPropertyWebkitTransformOriginZ: {
+ HANDLE_INHERIT_AND_INITIAL(transformOriginZ, TransformOriginZ)
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ float f;
+ int type = primitiveValue->primitiveType();
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
+ f = static_cast<float>(primitiveValue->computeLengthIntForLength(style()));
+ else
+ return;
+ m_style->setTransformOriginZ(f);
+ break;
+ }
+ case CSSPropertyWebkitTransformStyle:
+ HANDLE_INHERIT_AND_INITIAL(transformStyle3D, TransformStyle3D)
+ if (primitiveValue)
+ m_style->setTransformStyle3D((primitiveValue->getIdent() == CSSValuePreserve3d) ? TransformStyle3DPreserve3D : TransformStyle3DFlat);
+ return;
+ case CSSPropertyWebkitPerspective: {
+ HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
+ if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
+ m_style->setPerspective(0);
+ return;
+ }
+
+ if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
+ return;
+ float perspectiveValue = static_cast<float>(primitiveValue->getDoubleValue());
+ if (perspectiveValue >= 0.0f)
+ m_style->setPerspective(perspectiveValue);
+ return;
+ }
+ case CSSPropertyWebkitPerspectiveOrigin:
+ HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
+ HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
+ return;
+ case CSSPropertyWebkitPerspectiveOriginX: {
+ HANDLE_INHERIT_AND_INITIAL(perspectiveOriginX, PerspectiveOriginX)
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ Length l;
+ int type = primitiveValue->primitiveType();
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
+ l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
+ else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
+ l = Length(primitiveValue->getDoubleValue(), Percent);
+ else
+ return;
+ m_style->setPerspectiveOriginX(l);
+ return;
+ }
+ case CSSPropertyWebkitPerspectiveOriginY: {
+ HANDLE_INHERIT_AND_INITIAL(perspectiveOriginY, PerspectiveOriginY)
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ Length l;
+ int type = primitiveValue->primitiveType();
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
+ l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
+ else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
+ l = Length(primitiveValue->getDoubleValue(), Percent);
+ else
+ return;
+ m_style->setPerspectiveOriginY(l);
+ return;
+ }
case CSSPropertyWebkitAnimation:
if (isInitial)
m_style->clearAnimations();
if (firstType == CSSPrimitiveValue::CSS_UNKNOWN)
firstLength = Length(Auto);
- else if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG)
+ else if (CSSPrimitiveValue::isUnitTypeLength(firstType))
firstLength = Length(first->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE)
firstLength = Length(first->getDoubleValue(), Percent);
if (secondType == CSSPrimitiveValue::CSS_UNKNOWN)
secondLength = Length(Auto);
- else if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG)
+ else if (CSSPrimitiveValue::isUnitTypeLength(secondType))
secondLength = Length(second->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE)
secondLength = Length(second->getDoubleValue(), Percent);
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
Length l;
int type = primitiveValue->primitiveType();
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
Length l;
int type = primitiveValue->primitiveType();
- if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
+ if (CSSPrimitiveValue::isUnitTypeLength(type))
l = Length(primitiveValue->computeLengthIntForLength(style(), zoomFactor), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
l = Length(primitiveValue->getDoubleValue(), Percent);
case WebKitCSSTransformValue::ScaleTransformOperation: return TransformOperation::SCALE;
case WebKitCSSTransformValue::ScaleXTransformOperation: return TransformOperation::SCALE_X;
case WebKitCSSTransformValue::ScaleYTransformOperation: return TransformOperation::SCALE_Y;
+ case WebKitCSSTransformValue::ScaleZTransformOperation: return TransformOperation::SCALE_Z;
+ case WebKitCSSTransformValue::Scale3DTransformOperation: return TransformOperation::SCALE_3D;
case WebKitCSSTransformValue::TranslateTransformOperation: return TransformOperation::TRANSLATE;
case WebKitCSSTransformValue::TranslateXTransformOperation: return TransformOperation::TRANSLATE_X;
case WebKitCSSTransformValue::TranslateYTransformOperation: return TransformOperation::TRANSLATE_Y;
+ case WebKitCSSTransformValue::TranslateZTransformOperation: return TransformOperation::TRANSLATE_Z;
+ case WebKitCSSTransformValue::Translate3DTransformOperation: return TransformOperation::TRANSLATE_3D;
case WebKitCSSTransformValue::RotateTransformOperation: return TransformOperation::ROTATE;
+ case WebKitCSSTransformValue::RotateXTransformOperation: return TransformOperation::ROTATE_X;
+ case WebKitCSSTransformValue::RotateYTransformOperation: return TransformOperation::ROTATE_Y;
+ case WebKitCSSTransformValue::RotateZTransformOperation: return TransformOperation::ROTATE_Z;
+ case WebKitCSSTransformValue::Rotate3DTransformOperation: return TransformOperation::ROTATE_3D;
case WebKitCSSTransformValue::SkewTransformOperation: return TransformOperation::SKEW;
case WebKitCSSTransformValue::SkewXTransformOperation: return TransformOperation::SKEW_X;
case WebKitCSSTransformValue::SkewYTransformOperation: return TransformOperation::SKEW_Y;
case WebKitCSSTransformValue::MatrixTransformOperation: return TransformOperation::MATRIX;
+ case WebKitCSSTransformValue::Matrix3DTransformOperation: return TransformOperation::MATRIX_3D;
+ case WebKitCSSTransformValue::PerspectiveTransformOperation: return TransformOperation::PERSPECTIVE;
case WebKitCSSTransformValue::UnknownTransformOperation: return TransformOperation::NONE;
}
return TransformOperation::NONE;
sy = sx;
}
}
- operations.operations().append(ScaleTransformOperation::create(sx, sy, getTransformOperationType(val->operationType())));
+ operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(val->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::ScaleZTransformOperation:
+ case WebKitCSSTransformValue::Scale3DTransformOperation: {
+ double sx = 1.0;
+ double sy = 1.0;
+ double sz = 1.0;
+ if (val->operationType() == WebKitCSSTransformValue::ScaleZTransformOperation)
+ sz = firstValue->getDoubleValue();
+ else if (val->operationType() == WebKitCSSTransformValue::ScaleYTransformOperation)
+ sy = firstValue->getDoubleValue();
+ else {
+ sx = firstValue->getDoubleValue();
+ if (val->operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) {
+ if (val->length() > 2) {
+ CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
+ sz = thirdValue->getDoubleValue();
+ }
+ if (val->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
+ sy = secondValue->getDoubleValue();
+ } else
+ sy = sx;
+ }
+ }
+ operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(val->operationType())));
break;
}
case WebKitCSSTransformValue::TranslateTransformOperation:
if (!ok)
return false;
- operations.operations().append(TranslateTransformOperation::create(tx, ty, getTransformOperationType(val->operationType())));
+ operations.operations().append(TranslateTransformOperation::create(tx, ty, Length(0, Fixed), getTransformOperationType(val->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::TranslateZTransformOperation:
+ case WebKitCSSTransformValue::Translate3DTransformOperation: {
+ bool ok = true;
+ Length tx = Length(0, Fixed);
+ Length ty = Length(0, Fixed);
+ Length tz = Length(0, Fixed);
+ if (val->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation)
+ tz = convertToLength(firstValue, inStyle, &ok);
+ else if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
+ ty = convertToLength(firstValue, inStyle, &ok);
+ else {
+ tx = convertToLength(firstValue, inStyle, &ok);
+ if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
+ if (val->length() > 2) {
+ CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
+ tz = convertToLength(thirdValue, inStyle, &ok);
+ }
+ if (val->length() > 1) {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
+ ty = convertToLength(secondValue, inStyle, &ok);
+ }
+ }
+ }
+
+ if (!ok)
+ return false;
+
+ operations.operations().append(TranslateTransformOperation::create(tx, ty, tz, getTransformOperationType(val->operationType())));
break;
}
case WebKitCSSTransformValue::RotateTransformOperation: {
else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_TURN)
angle = turn2deg(angle);
- operations.operations().append(RotateTransformOperation::create(angle, getTransformOperationType(val->operationType())));
+ operations.operations().append(RotateTransformOperation::create(0, 0, 1, angle, getTransformOperationType(val->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::RotateXTransformOperation:
+ case WebKitCSSTransformValue::RotateYTransformOperation:
+ case WebKitCSSTransformValue::RotateZTransformOperation: {
+ double x = 0;
+ double y = 0;
+ double z = 0;
+ double angle = firstValue->getDoubleValue();
+ if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angle = rad2deg(angle);
+ else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angle = grad2deg(angle);
+
+ if (val->operationType() == WebKitCSSTransformValue::RotateXTransformOperation)
+ x = 1;
+ else if (val->operationType() == WebKitCSSTransformValue::RotateYTransformOperation)
+ y = 1;
+ else
+ z = 1;
+ operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
+ break;
+ }
+ case WebKitCSSTransformValue::Rotate3DTransformOperation: {
+ CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
+ CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
+ CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3));
+ double x = firstValue->getDoubleValue();
+ double y = secondValue->getDoubleValue();
+ double z = thirdValue->getDoubleValue();
+ double angle = fourthValue->getDoubleValue();
+ if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_RAD)
+ angle = rad2deg(angle);
+ else if (fourthValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
+ angle = grad2deg(angle);
+ operations.operations().append(RotateTransformOperation::create(x, y, z, angle, getTransformOperationType(val->operationType())));
break;
}
case WebKitCSSTransformValue::SkewTransformOperation:
break;
}
case WebKitCSSTransformValue::MatrixTransformOperation: {
- float a = firstValue->getFloatValue();
- float b = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getFloatValue();
- float c = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getFloatValue();
- float d = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getFloatValue();
- float e = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getFloatValue();
- float f = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getFloatValue();
+ double a = firstValue->getDoubleValue();
+ double b = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getDoubleValue();
+ double c = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getDoubleValue();
+ double d = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getDoubleValue();
+ double e = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getDoubleValue();
+ double f = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getDoubleValue();
operations.operations().append(MatrixTransformOperation::create(a, b, c, d, e, f));
break;
}
+ case WebKitCSSTransformValue::Matrix3DTransformOperation: {
+ TransformationMatrix matrix(static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(0))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(3))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(4))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(5))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(6))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(7))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(8))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(9))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(10))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(11))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(12))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(13))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(14))->getDoubleValue(),
+ static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(15))->getDoubleValue());
+ operations.operations().append(Matrix3DTransformOperation::create(matrix));
+ break;
+ }
+ case WebKitCSSTransformValue::PerspectiveTransformOperation: {
+ double p = firstValue->getDoubleValue();
+ if (p < 0.0)
+ return false;
+ operations.operations().append(PerspectiveTransformOperation::create(p));
+ break;
+ }
case WebKitCSSTransformValue::UnknownTransformOperation:
ASSERT_NOT_REACHED();
break;
paused
#
+# CSS_PROP__WEBKIT_TRANSFORM_STYLE
+#
+flat
+preserve-3d
+
+#
# CSS_PROP__WEBKIT_TRANSITION_TIMING_FUNCTION
# CSS_PROP__WEBKIT_ANIMATION_TIMING_FUNCTION
#
fill
stroke
#all
-#none
\ No newline at end of file
+#none
case MatrixTransformOperation:
result += "matrix(";
break;
+ case TranslateZTransformOperation:
+ result += "translateZ(";
+ break;
+ case Translate3DTransformOperation:
+ result += "translate3d(";
+ break;
+ case RotateXTransformOperation:
+ result += "rotateX(";
+ break;
+ case RotateYTransformOperation:
+ result += "rotateY(";
+ break;
+ case RotateZTransformOperation:
+ result += "rotateZ(";
+ break;
+ case Rotate3DTransformOperation:
+ result += "rotate3d(";
+ break;
+ case ScaleZTransformOperation:
+ result += "scaleZ(";
+ break;
+ case Scale3DTransformOperation:
+ result += "scale3d(";
+ break;
+ case PerspectiveTransformOperation:
+ result += "perspective(";
+ break;
+ case Matrix3DTransformOperation:
+ result += "matrix3d(";
+ break;
default:
break;
}
SkewTransformOperation,
SkewXTransformOperation,
SkewYTransformOperation,
- MatrixTransformOperation
+ MatrixTransformOperation,
+ TranslateZTransformOperation,
+ Translate3DTransformOperation,
+ RotateXTransformOperation,
+ RotateYTransformOperation,
+ RotateZTransformOperation,
+ Rotate3DTransformOperation,
+ ScaleZTransformOperation,
+ Scale3DTransformOperation,
+ PerspectiveTransformOperation,
+ Matrix3DTransformOperation
};
static PassRefPtr<WebKitCSSTransformValue> create(TransformOperationType type)
const unsigned short CSS_SKEWX = 9;
const unsigned short CSS_SKEWY = 10;
const unsigned short CSS_MATRIX = 11;
+ const unsigned short CSS_TRANSLATEZ = 12;
+ const unsigned short CSS_TRANSLATE3D = 13;
+ const unsigned short CSS_ROTATEX = 14;
+ const unsigned short CSS_ROTATEY = 15;
+ const unsigned short CSS_ROTATEZ = 16;
+ const unsigned short CSS_ROTATE3D = 17;
+ const unsigned short CSS_SCALEZ = 18;
+ const unsigned short CSS_SCALE3D = 19;
+ const unsigned short CSS_PERSPECTIVE = 20;
+ const unsigned short CSS_MATRIX3D = 21;
readonly attribute unsigned short operationType;
};
#include "config.h"
#include "Matrix3DTransformOperation.h"
-#if ENABLE(3D_TRANSFORMS)
-
#include <algorithm>
using namespace std;
}
} // namespace WebCore
-
-#endif // ENABLE(3D_TRANSFORMS)
#include "TransformOperation.h"
-#if ENABLE(3D_TRANSFORMS)
-
namespace WebCore {
class Matrix3DTransformOperation : public TransformOperation {
} // namespace WebCore
-#endif // ENABLE(3D_TRANSFORMS)
-
#endif // Matrix3DTransformOperation_h
#include "config.h"
#include "PerspectiveTransformOperation.h"
-#if ENABLE(3D_TRANSFORMS)
-
#include <algorithm>
using namespace std;
}
} // namespace WebCore
-
-#endif // ENABLE(3D_TRANSFORMS)
#include "TransformOperation.h"
-#if ENABLE(3D_TRANSFORMS)
-
namespace WebCore {
class PerspectiveTransformOperation : public TransformOperation {
} // namespace WebCore
-#endif // ENABLE(3D_TRANSFORMS)
-
#endif // PerspectiveTransformOperation_h
y = 0.0f;
z = 1.0f;
}
-#if ENABLE(3D_TRANSFORMS)
return RotateTransformOperation::create(x, y, z, angle, ROTATE_3D);
-#else
- return RotateTransformOperation::create(0, 0, z, angle, ROTATE_Z);
-#endif
}
} // namespace WebCore
, m_angle(angle)
, m_type(type)
{
-#if ENABLE(3D_TRANSFORMS)
ASSERT(type == ROTATE_X || type == ROTATE_Y || type == ROTATE_Z || type == ROTATE_3D);
-#else
- ASSERT(type == ROTATE_Z);
- ASSERT(x == 0 && y == 0);
-#endif
}
double m_x;
, m_z(sz)
, m_type(type)
{
-#if ENABLE(3D_TRANSFORMS)
ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE_Z || type == SCALE || type == SCALE_3D);
-#else
- ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE);
- ASSERT(sz == 1);
-#endif
}
double m_x;
virtual OperationType getOperationType() const = 0;
virtual bool isSameType(const TransformOperation&) const { return false; }
-#if ENABLE(3D_TRANSFORMS)
bool is3DOperation() const
{
OperationType opType = getOperationType();
opType == MATRIX_3D ||
opType == PERSPECTIVE;
}
-#endif
};
} // namespace WebCore
m_operations[i]->apply(t, sz);
}
-#if ENABLE(3D_TRANSFORMS)
// Return true if any of the operation types are 3D operation types (even if the
// values describe affine transforms)
bool has3DOperation() const
return true;
return false;
}
-#endif
Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
, m_z(tz)
, m_type(type)
{
-#if ENABLE(3D_TRANSFORMS)
ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE_Z || type == TRANSLATE || type == TRANSLATE_3D);
-#else
- ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE);
-#endif
}
Length m_x;