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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 return scale() || rotate(); | 1091 return scale() || rotate(); |
1092 } | 1092 } |
1093 | 1093 |
1094 void ComputedStyle::applyTransform(TransformationMatrix& result, const LayoutSiz
e& borderBoxSize, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionP
ath, ApplyIndependentTransformProperties applyIndependentTransformProperties) co
nst | 1094 void ComputedStyle::applyTransform(TransformationMatrix& result, const LayoutSiz
e& borderBoxSize, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionP
ath, ApplyIndependentTransformProperties applyIndependentTransformProperties) co
nst |
1095 { | 1095 { |
1096 applyTransform(result, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), ap
plyOrigin, applyMotionPath, applyIndependentTransformProperties); | 1096 applyTransform(result, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), ap
plyOrigin, applyMotionPath, applyIndependentTransformProperties); |
1097 } | 1097 } |
1098 | 1098 |
1099 void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath
, ApplyIndependentTransformProperties applyIndependentTransformProperties) const | 1099 void ComputedStyle::applyTransform(TransformationMatrix& result, const FloatRect
& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionPath
, ApplyIndependentTransformProperties applyIndependentTransformProperties) const |
1100 { | 1100 { |
1101 if (!hasMotionPath()) | 1101 if (!hasOffsetPath()) |
1102 applyMotionPath = ExcludeMotionPath; | 1102 applyMotionPath = ExcludeMotionPath; |
1103 bool applyTransformOrigin = requireTransformOrigin(applyOrigin, applyMotionP
ath); | 1103 bool applyTransformOrigin = requireTransformOrigin(applyOrigin, applyMotionP
ath); |
1104 | 1104 |
1105 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; | 1105 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; |
1106 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; | 1106 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; |
1107 | 1107 |
1108 float originX = 0; | 1108 float originX = 0; |
1109 float originY = 0; | 1109 float originY = 0; |
1110 float originZ = 0; | 1110 float originZ = 0; |
1111 | 1111 |
(...skipping 27 matching lines...) Expand all Loading... |
1139 result.translate3d(-originX, -originY, -originZ); | 1139 result.translate3d(-originX, -originY, -originZ); |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
1143 void ComputedStyle::applyMotionPathTransform(float originX, float originY, Trans
formationMatrix& transform) const | 1143 void ComputedStyle::applyMotionPathTransform(float originX, float originY, Trans
formationMatrix& transform) const |
1144 { | 1144 { |
1145 const StyleMotionData& motionData = m_rareNonInheritedData->m_transform->m_m
otion; | 1145 const StyleMotionData& motionData = m_rareNonInheritedData->m_transform->m_m
otion; |
1146 ASSERT(motionData.m_path); | 1146 ASSERT(motionData.m_path); |
1147 const StylePath& motionPath = *motionData.m_path; | 1147 const StylePath& motionPath = *motionData.m_path; |
1148 float pathLength = motionPath.length(); | 1148 float pathLength = motionPath.length(); |
1149 float distance = floatValueForLength(motionData.m_offset, pathLength); | 1149 float distance = floatValueForLength(motionData.m_distance, pathLength); |
1150 float computedDistance; | 1150 float computedDistance; |
1151 if (motionPath.isClosed() && pathLength > 0) { | 1151 if (motionPath.isClosed() && pathLength > 0) { |
1152 computedDistance = fmod(distance, pathLength); | 1152 computedDistance = fmod(distance, pathLength); |
1153 if (computedDistance < 0) | 1153 if (computedDistance < 0) |
1154 computedDistance += pathLength; | 1154 computedDistance += pathLength; |
1155 } else { | 1155 } else { |
1156 computedDistance = clampTo<float>(distance, 0, pathLength); | 1156 computedDistance = clampTo<float>(distance, 0, pathLength); |
1157 } | 1157 } |
1158 | 1158 |
1159 FloatPoint point; | 1159 FloatPoint point; |
1160 float angle; | 1160 float angle; |
1161 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); | 1161 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); |
1162 | 1162 |
1163 if (motionData.m_rotation.type == MotionRotationFixed) | 1163 if (motionData.m_rotation.type == OffsetRotationFixed) |
1164 angle = 0; | 1164 angle = 0; |
1165 | 1165 |
1166 transform.translate(point.x() - originX, point.y() - originY); | 1166 transform.translate(point.x() - originX, point.y() - originY); |
1167 transform.rotate(angle + motionData.m_rotation.angle); | 1167 transform.rotate(angle + motionData.m_rotation.angle); |
1168 } | 1168 } |
1169 | 1169 |
1170 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) | 1170 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) |
1171 { | 1171 { |
1172 m_rareInheritedData.access()->textShadow = s; | 1172 m_rareInheritedData.access()->textShadow = s; |
1173 } | 1173 } |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 else | 1849 else |
1850 setMarginLeft(margin); | 1850 setMarginLeft(margin); |
1851 } else { | 1851 } else { |
1852 if (isLeftToRightDirection()) | 1852 if (isLeftToRightDirection()) |
1853 setMarginBottom(margin); | 1853 setMarginBottom(margin); |
1854 else | 1854 else |
1855 setMarginTop(margin); | 1855 setMarginTop(margin); |
1856 } | 1856 } |
1857 } | 1857 } |
1858 | 1858 |
1859 void ComputedStyle::setMotionPath(PassRefPtr<StylePath> path) | 1859 void ComputedStyle::setOffsetPath(PassRefPtr<StylePath> path) |
1860 { | 1860 { |
1861 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = pat
h; | 1861 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = pat
h; |
1862 } | 1862 } |
1863 | 1863 |
1864 int ComputedStyle::outlineOutsetExtent() const | 1864 int ComputedStyle::outlineOutsetExtent() const |
1865 { | 1865 { |
1866 if (!hasOutline()) | 1866 if (!hasOutline()) |
1867 return 0; | 1867 return 0; |
1868 if (outlineStyleIsAuto()) | 1868 if (outlineStyleIsAuto()) |
1869 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); | 1869 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 if (value < 0) | 2042 if (value < 0) |
2043 fvalue -= 0.5f; | 2043 fvalue -= 0.5f; |
2044 else | 2044 else |
2045 fvalue += 0.5f; | 2045 fvalue += 0.5f; |
2046 } | 2046 } |
2047 | 2047 |
2048 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2048 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
2049 } | 2049 } |
2050 | 2050 |
2051 } // namespace blink | 2051 } // namespace blink |
OLD | NEW |