 Chromium Code Reviews
 Chromium Code Reviews Issue 1158603003:
  CSS Independent Transform Properties  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1158603003:
  CSS Independent Transform Properties  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 876 case CSSPropertyBottom: | 876 case CSSPropertyBottom: | 
| 877 case CSSPropertyRight: | 877 case CSSPropertyRight: | 
| 878 return true; | 878 return true; | 
| 879 default: | 879 default: | 
| 880 break; | 880 break; | 
| 881 } | 881 } | 
| 882 } | 882 } | 
| 883 return false; | 883 return false; | 
| 884 } | 884 } | 
| 885 | 885 | 
| 886 inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& tra nsformOperations, ComputedStyle::ApplyTransformOrigin applyOrigin, ComputedStyle ::ApplyMotionPath applyMotionPath) | 886 bool ComputedStyle::requireTransformOrigin(ApplyTransformOrigin applyOrigin, App lyMotionPath applyMotionPath) const | 
| 887 { | 887 { | 
| 888 const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInher itedData->m_transform->m_operations.operations(); | |
| 
alancutter (OOO until 2018)
2015/06/17 07:38:33
This can just call transform().
 
soonm
2015/06/17 23:56:53
Done.
 | |
| 889 | |
| 888 // transform-origin brackets the transform with translate operations. | 890 // transform-origin brackets the transform with translate operations. | 
| 889 // Optimize for the case where the only transform is a translation, since th e transform-origin is irrelevant | 891 // Optimize for the case where the only transform is a translation, since th e transform-origin is irrelevant | 
| 890 // in that case. | 892 // in that case. | 
| 891 if (applyOrigin != ComputedStyle::IncludeTransformOrigin) | 893 if (applyOrigin != IncludeTransformOrigin) | 
| 892 return false; | 894 return false; | 
| 893 | 895 | 
| 894 if (applyMotionPath == ComputedStyle::IncludeMotionPath) | 896 if (applyMotionPath == IncludeMotionPath) | 
| 895 return true; | 897 return true; | 
| 896 | 898 | 
| 897 unsigned size = transformOperations.size(); | 899 unsigned size = transformOperations.size(); | 
| 898 for (unsigned i = 0; i < size; ++i) { | 900 for (unsigned i = 0; i < size; ++i) { | 
| 899 TransformOperation::OperationType type = transformOperations[i]->type(); | 901 TransformOperation::OperationType type = transformOperations[i]->type(); | 
| 900 if (type != TransformOperation::TranslateX | 902 if (type != TransformOperation::TranslateX | 
| 901 && type != TransformOperation::TranslateY | 903 && type != TransformOperation::TranslateY | 
| 902 && type != TransformOperation::Translate | 904 && type != TransformOperation::Translate | 
| 903 && type != TransformOperation::TranslateZ | 905 && type != TransformOperation::TranslateZ | 
| 904 && type != TransformOperation::Translate3D) | 906 && type != TransformOperation::Translate3D) | 
| 905 return true; | 907 return true; | 
| 906 } | 908 } | 
| 907 | 909 | 
| 908 return false; | 910 return hasScale() || hasRotate(); | 
| 909 } | 911 } | 
| 910 | 912 | 
| 911 void ComputedStyle::applyTransform(TransformationMatrix& transform, const Layout Size& borderBoxSize, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMoti onPath) const | 913 void ComputedStyle::applyTransform(TransformationMatrix& transform, const Layout Size& borderBoxSize, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMoti onPath, ApplyTransformL2 applyTransformL2) const | 
| 912 { | 914 { | 
| 913 applyTransform(transform, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), applyOrigin, applyMotionPath); | 915 applyTransform(transform, FloatRect(FloatPoint(), FloatSize(borderBoxSize)), applyOrigin, applyMotionPath, applyTransformL2); | 
| 914 } | 916 } | 
| 915 | 917 | 
| 916 void ComputedStyle::applyTransform(TransformationMatrix& transform, const FloatR ect& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionP ath) const | 918 void ComputedStyle::applyTransform(TransformationMatrix& transform, const FloatR ect& boundingBox, ApplyTransformOrigin applyOrigin, ApplyMotionPath applyMotionP ath, ApplyTransformL2 applyTransformL2) const | 
| 917 { | 919 { | 
| 918 if (!hasMotionPath()) | 920 if (!hasMotionPath()) | 
| 919 applyMotionPath = ExcludeMotionPath; | 921 applyMotionPath = ExcludeMotionPath; | 
| 920 const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInher itedData->m_transform->m_operations.operations(); | 922 const Vector<RefPtr<TransformOperation>>& transformOperations = rareNonInher itedData->m_transform->m_operations.operations(); | 
| 
alancutter (OOO until 2018)
2015/06/17 07:38:33
This can just call transform() and be moved down t
 
soonm
2015/06/17 23:56:53
Done.
 | |
| 921 bool applyTransformOrigin = requireTransformOrigin(transformOperations, appl yOrigin, applyMotionPath); | 923 bool applyTransformOrigin = requireTransformOrigin(applyOrigin, applyMotionP ath); | 
| 922 | 924 | 
| 923 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; | 925 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; | 
| 924 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; | 926 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; | 
| 925 | 927 | 
| 926 if (applyTransformOrigin) { | 928 if (applyTransformOrigin) { | 
| 927 transform.translate3d(floatValueForLength(transformOriginX(), boundingBo x.width()) + offsetX, | 929 transform.translate3d(floatValueForLength(transformOriginX(), boundingBo x.width()) + offsetX, | 
| 928 floatValueForLength(transformOriginY(), boundingBox.height()) + offs etY, | 930 floatValueForLength(transformOriginY(), boundingBox.height()) + offs etY, | 
| 929 transformOriginZ()); | 931 transformOriginZ()); | 
| 930 } | 932 } | 
| 931 | 933 | 
| 934 if (applyTransformL2 == IncludeTransformL2) { | |
| 935 if (hasTranslate()) | |
| 936 translate()->apply(transform, boundingBox.size()); | |
| 937 | |
| 938 if (hasRotate()) | |
| 939 rotate()->apply(transform, boundingBox.size()); | |
| 940 | |
| 941 if (hasScale()) | |
| 942 scale()->apply(transform, boundingBox.size()); | |
| 943 } | |
| 944 | |
| 932 if (applyMotionPath == ComputedStyle::IncludeMotionPath) | 945 if (applyMotionPath == ComputedStyle::IncludeMotionPath) | 
| 933 applyMotionPathTransform(transform); | 946 applyMotionPathTransform(transform); | 
| 934 | 947 | 
| 935 unsigned size = transformOperations.size(); | 948 unsigned size = transformOperations.size(); | 
| 936 for (unsigned i = 0; i < size; ++i) | 949 for (unsigned i = 0; i < size; ++i) | 
| 937 transformOperations[i]->apply(transform, boundingBox.size()); | 950 transformOperations[i]->apply(transform, boundingBox.size()); | 
| 938 | 951 | 
| 939 if (applyTransformOrigin) { | 952 if (applyTransformOrigin) { | 
| 940 transform.translate3d(-floatValueForLength(transformOriginX(), boundingB ox.width()) - offsetX, | 953 transform.translate3d(-floatValueForLength(transformOriginX(), boundingB ox.width()) - offsetX, | 
| 941 -floatValueForLength(transformOriginY(), boundingBox.height()) - off setY, | 954 -floatValueForLength(transformOriginY(), boundingBox.height()) - off setY, | 
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1744 } | 1757 } | 
| 1745 | 1758 | 
| 1746 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) | 1759 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) | 
| 1747 { | 1760 { | 
| 1748 setEmptyState(other.emptyState()); | 1761 setEmptyState(other.emptyState()); | 
| 1749 if (other.hasExplicitlyInheritedProperties()) | 1762 if (other.hasExplicitlyInheritedProperties()) | 
| 1750 setHasExplicitlyInheritedProperties(); | 1763 setHasExplicitlyInheritedProperties(); | 
| 1751 } | 1764 } | 
| 1752 | 1765 | 
| 1753 } // namespace blink | 1766 } // namespace blink | 
| OLD | NEW |