| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 920 |
| 921 void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath
, ApplyIndependentTransformProperties applyIndependentTransformProperties) const | 921 void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath
, ApplyIndependentTransformProperties applyIndependentTransformProperties) const |
| 922 { | 922 { |
| 923 if (!hasMotionPath()) | 923 if (!hasMotionPath()) |
| 924 applyMotionPath = ExcludeMotionPath; | 924 applyMotionPath = ExcludeMotionPath; |
| 925 bool applyTransformOrigin = requireTransformOrigin(applyOrigin, applyMotionP
ath); | 925 bool applyTransformOrigin = requireTransformOrigin(applyOrigin, applyMotionP
ath); |
| 926 | 926 |
| 927 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; | 927 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; |
| 928 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; | 928 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; |
| 929 | 929 |
| 930 float originX = 0; |
| 931 float originY = 0; |
| 932 float originZ = 0; |
| 933 |
| 930 if (applyTransformOrigin) { | 934 if (applyTransformOrigin) { |
| 931 result.translate3d(floatValueForLength(transformOriginX(), boundingBox.w
idth()) + offsetX, | 935 originX = floatValueForLength(transformOriginX(), boundingBox.width()) +
offsetX; |
| 932 floatValueForLength(transformOriginY(), boundingBox.height()) + offs
etY, | 936 originY = floatValueForLength(transformOriginY(), boundingBox.height())
+ offsetY; |
| 933 transformOriginZ()); | 937 originZ = transformOriginZ(); |
| 938 result.translate3d(originX, originY, originZ); |
| 934 } | 939 } |
| 935 | 940 |
| 936 if (applyIndependentTransformProperties == IncludeIndependentTransformProper
ties) { | 941 if (applyIndependentTransformProperties == IncludeIndependentTransformProper
ties) { |
| 937 if (translate()) | 942 if (translate()) |
| 938 translate()->apply(result, boundingBox.size()); | 943 translate()->apply(result, boundingBox.size()); |
| 939 | 944 |
| 940 if (rotate()) | 945 if (rotate()) |
| 941 rotate()->apply(result, boundingBox.size()); | 946 rotate()->apply(result, boundingBox.size()); |
| 942 | 947 |
| 943 if (scale()) | 948 if (scale()) |
| 944 scale()->apply(result, boundingBox.size()); | 949 scale()->apply(result, boundingBox.size()); |
| 945 } | 950 } |
| 946 | 951 |
| 947 if (applyMotionPath == ComputedStyle::IncludeMotionPath) | 952 if (applyMotionPath == ComputedStyle::IncludeMotionPath) |
| 948 applyMotionPathTransform(result); | 953 applyMotionPathTransform(originX, originY, result); |
| 949 | 954 |
| 950 const Vector<RefPtr<TransformOperation>>& transformOperations = transform().
operations(); | 955 const Vector<RefPtr<TransformOperation>>& transformOperations = transform().
operations(); |
| 951 unsigned size = transformOperations.size(); | 956 unsigned size = transformOperations.size(); |
| 952 for (unsigned i = 0; i < size; ++i) | 957 for (unsigned i = 0; i < size; ++i) |
| 953 transformOperations[i]->apply(result, boundingBox.size()); | 958 transformOperations[i]->apply(result, boundingBox.size()); |
| 954 | 959 |
| 955 if (applyTransformOrigin) { | 960 if (applyTransformOrigin) { |
| 956 result.translate3d(-floatValueForLength(transformOriginX(), boundingBox.
width()) - offsetX, | 961 result.translate3d(-originX, -originY, -originZ); |
| 957 -floatValueForLength(transformOriginY(), boundingBox.height()) - off
setY, | |
| 958 -transformOriginZ()); | |
| 959 } | 962 } |
| 960 } | 963 } |
| 961 | 964 |
| 962 void ComputedStyle::applyMotionPathTransform(TransformationMatrix& transform) co
nst | 965 void ComputedStyle::applyMotionPathTransform(float originX, float originY, Trans
formationMatrix& transform) const |
| 963 { | 966 { |
| 964 const StyleMotionData& motionData = rareNonInheritedData->m_transform->m_mot
ion; | 967 const StyleMotionData& motionData = rareNonInheritedData->m_transform->m_mot
ion; |
| 965 ASSERT(motionData.m_path && motionData.m_path->isPathStyleMotionPath()); | 968 ASSERT(motionData.m_path && motionData.m_path->isPathStyleMotionPath()); |
| 966 const PathStyleMotionPath& motionPath = toPathStyleMotionPath(*motionData.m_
path); | 969 const PathStyleMotionPath& motionPath = toPathStyleMotionPath(*motionData.m_
path); |
| 967 float pathLength = motionPath.length(); | 970 float pathLength = motionPath.length(); |
| 968 float distance = floatValueForLength(motionData.m_offset, pathLength); | 971 float distance = floatValueForLength(motionData.m_offset, pathLength); |
| 969 float computedDistance; | 972 float computedDistance; |
| 970 if (motionPath.isClosed() && pathLength > 0) { | 973 if (motionPath.isClosed() && pathLength > 0) { |
| 971 computedDistance = fmod(distance, pathLength); | 974 computedDistance = fmod(distance, pathLength); |
| 972 if (computedDistance < 0) | 975 if (computedDistance < 0) |
| 973 computedDistance += pathLength; | 976 computedDistance += pathLength; |
| 974 } else { | 977 } else { |
| 975 computedDistance = clampTo<float>(distance, 0, pathLength); | 978 computedDistance = clampTo<float>(distance, 0, pathLength); |
| 976 } | 979 } |
| 977 | 980 |
| 978 FloatPoint point; | 981 FloatPoint point; |
| 979 float angle; | 982 float angle; |
| 980 if (!motionPath.path().pointAndNormalAtLength(computedDistance, point, angle
)) | 983 if (!motionPath.path().pointAndNormalAtLength(computedDistance, point, angle
)) |
| 981 return; | 984 return; |
| 982 if (motionData.m_rotationType == MotionRotationFixed) | 985 if (motionData.m_rotationType == MotionRotationFixed) |
| 983 angle = 0; | 986 angle = 0; |
| 984 | 987 |
| 985 transform.translate(point.x(), point.y()); | 988 transform.translate(point.x() - originX, point.y() - originY); |
| 986 transform.rotate(angle + motionData.m_rotation); | 989 transform.rotate(angle + motionData.m_rotation); |
| 987 } | 990 } |
| 988 | 991 |
| 989 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) | 992 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) |
| 990 { | 993 { |
| 991 rareInheritedData.access()->textShadow = s; | 994 rareInheritedData.access()->textShadow = s; |
| 992 } | 995 } |
| 993 | 996 |
| 994 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) | 997 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) |
| 995 { | 998 { |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 } | 1763 } |
| 1761 | 1764 |
| 1762 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) | 1765 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) |
| 1763 { | 1766 { |
| 1764 setEmptyState(other.emptyState()); | 1767 setEmptyState(other.emptyState()); |
| 1765 if (other.hasExplicitlyInheritedProperties()) | 1768 if (other.hasExplicitlyInheritedProperties()) |
| 1766 setHasExplicitlyInheritedProperties(); | 1769 setHasExplicitlyInheritedProperties(); |
| 1767 } | 1770 } |
| 1768 | 1771 |
| 1769 } // namespace blink | 1772 } // namespace blink |
| OLD | NEW |