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

Side by Side Diff: Source/core/style/ComputedStyle.h

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "platform/ThemeTypes.h" 68 #include "platform/ThemeTypes.h"
69 #include "platform/fonts/FontBaseline.h" 69 #include "platform/fonts/FontBaseline.h"
70 #include "platform/fonts/FontDescription.h" 70 #include "platform/fonts/FontDescription.h"
71 #include "platform/geometry/FloatRoundedRect.h" 71 #include "platform/geometry/FloatRoundedRect.h"
72 #include "platform/geometry/LayoutRectOutsets.h" 72 #include "platform/geometry/LayoutRectOutsets.h"
73 #include "platform/graphics/Color.h" 73 #include "platform/graphics/Color.h"
74 #include "platform/graphics/GraphicsTypes.h" 74 #include "platform/graphics/GraphicsTypes.h"
75 #include "platform/scroll/ScrollableArea.h" 75 #include "platform/scroll/ScrollableArea.h"
76 #include "platform/text/TextDirection.h" 76 #include "platform/text/TextDirection.h"
77 #include "platform/text/UnicodeBidi.h" 77 #include "platform/text/UnicodeBidi.h"
78 #include "platform/transforms/RotateTransformOperation.h"
79 #include "platform/transforms/ScaleTransformOperation.h"
78 #include "platform/transforms/TransformOperations.h" 80 #include "platform/transforms/TransformOperations.h"
81 #include "platform/transforms/TranslateTransformOperation.h"
79 #include "public/platform/WebScrollBlocksOn.h" 82 #include "public/platform/WebScrollBlocksOn.h"
80 #include "wtf/Forward.h" 83 #include "wtf/Forward.h"
81 #include "wtf/OwnPtr.h" 84 #include "wtf/OwnPtr.h"
82 #include "wtf/RefCounted.h" 85 #include "wtf/RefCounted.h"
83 #include "wtf/StdLibExtras.h" 86 #include "wtf/StdLibExtras.h"
84 #include "wtf/Vector.h" 87 #include "wtf/Vector.h"
85 88
86 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u ) { return t == static_cast<T>(u); } 89 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u ) { return t == static_cast<T>(u); }
87 90
88 #define SET_VAR(group, variable, value) \ 91 #define SET_VAR(group, variable, value) \
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheri tedData->m_multiCol->m_columnSpan); } 838 ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheri tedData->m_multiCol->m_columnSpan); }
836 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNo nInheritedData->m_multiCol->m_breakBefore); } 839 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNo nInheritedData->m_multiCol->m_breakBefore); }
837 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNo nInheritedData->m_multiCol->m_breakInside); } 840 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNo nInheritedData->m_multiCol->m_breakInside); }
838 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNon InheritedData->m_multiCol->m_breakAfter); } 841 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNon InheritedData->m_multiCol->m_breakAfter); }
839 bool hasInlineTransform() const { return rareNonInheritedData->m_hasInlineTr ansform; } 842 bool hasInlineTransform() const { return rareNonInheritedData->m_hasInlineTr ansform; }
840 bool hasCompositorProxy() const { return rareNonInheritedData->m_hasComposit orProxy; } 843 bool hasCompositorProxy() const { return rareNonInheritedData->m_hasComposit orProxy; }
841 const TransformOperations& transform() const { return rareNonInheritedData-> m_transform->m_operations; } 844 const TransformOperations& transform() const { return rareNonInheritedData-> m_transform->m_operations; }
842 const TransformOrigin& transformOrigin() const { return rareNonInheritedData ->m_transform->m_origin; } 845 const TransformOrigin& transformOrigin() const { return rareNonInheritedData ->m_transform->m_origin; }
843 const Length& transformOriginX() const { return transformOrigin().x(); } 846 const Length& transformOriginX() const { return transformOrigin().x(); }
844 const Length& transformOriginY() const { return transformOrigin().y(); } 847 const Length& transformOriginY() const { return transformOrigin().y(); }
848 const PassRefPtr<TranslateTransformOperation> translate() const { return rar eNonInheritedData->m_transform->m_translate; }
Timothy Loh 2015/06/05 00:55:59 Maybe just return TranslateTransformOperation*
soonm 2015/06/10 04:09:32 Done.
849 const PassRefPtr<RotateTransformOperation> rotate() const { return rareNonIn heritedData->m_transform->m_rotate; }
850 const PassRefPtr<ScaleTransformOperation> scale() const { return rareNonInhe ritedData->m_transform->m_scale; }
845 float transformOriginZ() const { return transformOrigin().z(); } 851 float transformOriginZ() const { return transformOrigin().z(); }
846 bool hasTransform() const { return hasTransformOperations() || hasMotionPath () || hasCurrentTransformAnimation(); } 852 bool hasTranslateProperty() const { return rareNonInheritedData->m_transform ->m_translate; }
853 bool hasRotateProperty() const { return rareNonInheritedData->m_transform->m _rotate; }
854 bool hasScaleProperty() const { return rareNonInheritedData->m_transform->m_ scale; }
855 bool has3DTransformProperties() const { return rareNonInheritedData->m_trans form->has3DTransformProperties(); }
856 bool hasTransformProperties() const { return hasTranslateProperty() || hasRo tateProperty() || hasScaleProperty(); }
857 bool hasTransform() const { return hasTransformOperations() || hasMotionPath () || hasCurrentTransformAnimation() || hasTransformProperties(); }
847 bool transformDataEquivalent(const ComputedStyle& otherStyle) const { return rareNonInheritedData->m_transform == otherStyle.rareNonInheritedData->m_transfo rm; } 858 bool transformDataEquivalent(const ComputedStyle& otherStyle) const { return rareNonInheritedData->m_transform == otherStyle.rareNonInheritedData->m_transfo rm; }
848 859
849 StyleMotionPath* motionPath() const { return rareNonInheritedData->m_transfo rm->m_motion.m_path.get(); } 860 StyleMotionPath* motionPath() const { return rareNonInheritedData->m_transfo rm->m_motion.m_path.get(); }
850 bool hasMotionPath() const { return rareNonInheritedData->m_transform->m_mot ion.m_path; } 861 bool hasMotionPath() const { return rareNonInheritedData->m_transform->m_mot ion.m_path; }
851 const Length& motionOffset() const { return rareNonInheritedData->m_transfor m->m_motion.m_offset; } 862 const Length& motionOffset() const { return rareNonInheritedData->m_transfor m->m_motion.m_offset; }
852 float motionRotation() const { return rareNonInheritedData->m_transform->m_m otion.m_rotation; } 863 float motionRotation() const { return rareNonInheritedData->m_transform->m_m otion.m_rotation; }
853 MotionRotationType motionRotationType() const { return rareNonInheritedData- >m_transform->m_motion.m_rotationType; } 864 MotionRotationType motionRotationType() const { return rareNonInheritedData- >m_transform->m_motion.m_rotationType; }
854 865
855 TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisF ill>(rareInheritedData->textEmphasisFill); } 866 TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisF ill>(rareInheritedData->textEmphasisFill); }
856 TextEmphasisMark textEmphasisMark() const; 867 TextEmphasisMark textEmphasisMark() const;
857 const AtomicString& textEmphasisCustomMark() const { return rareInheritedDat a->textEmphasisCustomMark; } 868 const AtomicString& textEmphasisCustomMark() const { return rareInheritedDat a->textEmphasisCustomMark; }
858 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextE mphasisPosition>(rareInheritedData->textEmphasisPosition); } 869 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextE mphasisPosition>(rareInheritedData->textEmphasisPosition); }
859 const AtomicString& textEmphasisMarkString() const; 870 const AtomicString& textEmphasisMarkString() const;
860 871
861 RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInh eritedData->m_rubyPosition); } 872 RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInh eritedData->m_rubyPosition); }
862 873
863 TextOrientation textOrientation() const { return static_cast<TextOrientation >(rareInheritedData->m_textOrientation); } 874 TextOrientation textOrientation() const { return static_cast<TextOrientation >(rareInheritedData->m_textOrientation); }
864 875
865 ObjectFit objectFit() const { return static_cast<ObjectFit>(rareNonInherited Data->m_objectFit); } 876 ObjectFit objectFit() const { return static_cast<ObjectFit>(rareNonInherited Data->m_objectFit); }
866 LengthPoint objectPosition() const { return rareNonInheritedData->m_objectPo sition; } 877 LengthPoint objectPosition() const { return rareNonInheritedData->m_objectPo sition; }
867 878
868 // Return true if any transform related property (currently transform/motion Path, transformStyle3D or perspective) 879 // Return true if any transform related property (currently transform/motion Path, transformStyle3D or perspective)
869 // indicates that we are transforming 880 // indicates that we are transforming
870 bool hasTransformRelatedProperty() const { return hasTransform() || preserve s3D() || hasPerspective(); } 881 bool hasTransformRelatedProperty() const { return hasTransform() || preserve s3D() || hasPerspective(); }
871 882
872 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin } ; 883 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin } ;
873 enum ApplyMotionPath { IncludeMotionPath, ExcludeMotionPath }; 884 enum ApplyMotionPath { IncludeMotionPath, ExcludeMotionPath };
874 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPa th) const; 885 enum ApplyTransformProperty { IncludeTransformProperty, ExcludeTransformProp erty };
875 void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, App lyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPath) const; 886 void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPa th, ApplyTransformProperty = IncludeTransformProperty) const;
887 void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, App lyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPath, ApplyTransformProperty = IncludeTransformProperty) const;
876 888
877 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rar eNonInheritedData->m_maskBoxImage.hasImage(); } 889 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rar eNonInheritedData->m_maskBoxImage.hasImage(); }
878 890
879 TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInh eritedData->m_textCombine); } 891 TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInh eritedData->m_textCombine); }
880 bool hasTextCombine() const { return textCombine() != TextCombineNone; } 892 bool hasTextCombine() const { return textCombine() != TextCombineNone; }
881 893
882 TabSize tabSize() const { return rareInheritedData->m_tabSize; } 894 TabSize tabSize() const { return rareInheritedData->m_tabSize; }
883 895
884 // End CSS3 Getters 896 // End CSS3 Getters
885 897
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID ); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); } 1320 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID ); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1309 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access ()->m_multiCol, m_breakAfter, p); } 1321 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access ()->m_multiCol, m_breakAfter, p); }
1310 void inheritColumnPropertiesFrom(const ComputedStyle& parent) { rareNonInher itedData.access()->m_multiCol = parent.rareNonInheritedData->m_multiCol; } 1322 void inheritColumnPropertiesFrom(const ComputedStyle& parent) { rareNonInher itedData.access()->m_multiCol = parent.rareNonInheritedData->m_multiCol; }
1311 void setHasInlineTransform(bool b) { SET_VAR(rareNonInheritedData, m_hasInli neTransform, b); } 1323 void setHasInlineTransform(bool b) { SET_VAR(rareNonInheritedData, m_hasInli neTransform, b); }
1312 void setHasCompositorProxy(bool b) { SET_VAR(rareNonInheritedData, m_hasComp ositorProxy, b); } 1324 void setHasCompositorProxy(bool b) { SET_VAR(rareNonInheritedData, m_hasComp ositorProxy, b); }
1313 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInherited Data.access()->m_transform, m_operations, ops); } 1325 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInherited Data.access()->m_transform, m_operations, ops); }
1314 void setTransformOriginX(const Length& v) { setTransformOrigin(TransformOrig in(v, transformOriginY(), transformOriginZ())); } 1326 void setTransformOriginX(const Length& v) { setTransformOrigin(TransformOrig in(v, transformOriginY(), transformOriginZ())); }
1315 void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrig in(transformOriginX(), v, transformOriginZ())); } 1327 void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrig in(transformOriginX(), v, transformOriginZ())); }
1316 void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(trans formOriginX(), transformOriginY(), f)); } 1328 void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(trans formOriginX(), transformOriginY(), f)); }
1317 void setTransformOrigin(const TransformOrigin& o) { SET_VAR(rareNonInherited Data.access()->m_transform, m_origin, o); } 1329 void setTransformOrigin(const TransformOrigin& o) { SET_VAR(rareNonInherited Data.access()->m_transform, m_origin, o); }
1330 void setTranslate(PassRefPtr<TranslateTransformOperation> v) { rareNonInheri tedData.access()->m_transform.access()->setTranslate(v); }
1331 void setTranslate(const Length& tx, const Length& ty, const double& tz) { ra reNonInheritedData.access()->m_transform.access()->setTranslate(tx, ty, tz); }
1332 void setRotate(PassRefPtr<RotateTransformOperation> v) { rareNonInheritedDat a.access()->m_transform.access()->setRotate(v); }
1333 void setRotate(const double& angle, const double& x, const double& y, const double& z) { rareNonInheritedData.access()->m_transform.access()->setRotate(angl e, x, y, z); }
1334 void setScale(PassRefPtr<ScaleTransformOperation> v) { rareNonInheritedData. access()->m_transform.access()->setScale(v); }
1335 void setScale(const double& sx, const double& sy, const double& sz) { rareNo nInheritedData.access()->m_transform.access()->setScale(sx, sy, sz); }
1336
1318 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); } 1337 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1319 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCom bine, v); } 1338 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCom bine, v); }
1320 void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedD ata, m_textDecorationColor, c); } 1339 void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedD ata, m_textDecorationColor, c); }
1321 void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInh eritedData, textEmphasisColor, setTextEmphasisColor, c); } 1340 void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInh eritedData, textEmphasisColor, setTextEmphasisColor, c); }
1322 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); } 1341 void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
1323 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); } 1342 void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
1324 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInher itedData, textEmphasisCustomMark, mark); } 1343 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInher itedData, textEmphasisCustomMark, mark); }
1325 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareIn heritedData, textEmphasisPosition, position); } 1344 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareIn heritedData, textEmphasisPosition, position); }
1326 bool setTextOrientation(TextOrientation); 1345 bool setTextOrientation(TextOrientation);
1327 1346
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 void appendContent(PassOwnPtr<ContentData>); 1788 void appendContent(PassOwnPtr<ContentData>);
1770 void addAppliedTextDecoration(const AppliedTextDecoration&); 1789 void addAppliedTextDecoration(const AppliedTextDecoration&);
1771 bool hasTransformOperations() const { return !rareNonInheritedData->m_transf orm->m_operations.operations().isEmpty(); } 1790 bool hasTransformOperations() const { return !rareNonInheritedData->m_transf orm->m_operations.operations().isEmpty(); }
1772 void applyMotionPathTransform(TransformationMatrix&) const; 1791 void applyMotionPathTransform(TransformationMatrix&) const;
1773 1792
1774 bool diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle& other) con st; 1793 bool diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle& other) con st;
1775 bool diffNeedsFullLayout(const ComputedStyle& other) const; 1794 bool diffNeedsFullLayout(const ComputedStyle& other) const;
1776 bool diffNeedsPaintInvalidationLayer(const ComputedStyle& other) const; 1795 bool diffNeedsPaintInvalidationLayer(const ComputedStyle& other) const;
1777 bool diffNeedsPaintInvalidationObject(const ComputedStyle& other) const; 1796 bool diffNeedsPaintInvalidationObject(const ComputedStyle& other) const;
1778 void updatePropertySpecificDifferences(const ComputedStyle& other, StyleDiff erence&) const; 1797 void updatePropertySpecificDifferences(const ComputedStyle& other, StyleDiff erence&) const;
1798
1799 bool requireTransformOrigin(ApplyTransformOrigin applyOrigin, ApplyMotionPat h) const;
1779 }; 1800 };
1780 1801
1781 // FIXME: Reduce/remove the dependency on zoom adjusted int values. 1802 // FIXME: Reduce/remove the dependency on zoom adjusted int values.
1782 // The float or LayoutUnit versions of layout values should be used. 1803 // The float or LayoutUnit versions of layout values should be used.
1783 inline int adjustForAbsoluteZoom(int value, float zoomFactor) 1804 inline int adjustForAbsoluteZoom(int value, float zoomFactor)
1784 { 1805 {
1785 if (zoomFactor == 1) 1806 if (zoomFactor == 1)
1786 return value; 1807 return value;
1787 // Needed because computeLengthInt truncates (rather than rounds) when scali ng up. 1808 // Needed because computeLengthInt truncates (rather than rounds) when scali ng up.
1788 float fvalue = value; 1809 float fvalue = value;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 } 1902 }
1882 1903
1883 inline bool ComputedStyle::hasPseudoElementStyle() const 1904 inline bool ComputedStyle::hasPseudoElementStyle() const
1884 { 1905 {
1885 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK; 1906 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK;
1886 } 1907 }
1887 1908
1888 } // namespace blink 1909 } // namespace blink
1889 1910
1890 #endif // ComputedStyle_h 1911 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698