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

Unified 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: Rebase master and explicit applyTransform parameters 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/style/ComputedStyle.h
diff --git a/Source/core/style/ComputedStyle.h b/Source/core/style/ComputedStyle.h
index 982502938f71f49bee2f31cab509e4042343bdd5..1daf8074ee65225a229629096d86d1c94e009a60 100644
--- a/Source/core/style/ComputedStyle.h
+++ b/Source/core/style/ComputedStyle.h
@@ -77,7 +77,10 @@
#include "platform/text/TextDirection.h"
#include "platform/text/TextRun.h"
#include "platform/text/UnicodeBidi.h"
+#include "platform/transforms/RotateTransformOperation.h"
+#include "platform/transforms/ScaleTransformOperation.h"
#include "platform/transforms/TransformOperations.h"
+#include "platform/transforms/TranslateTransformOperation.h"
alancutter (OOO until 2018) 2015/06/18 13:03:24 Can these be forward declared?
#include "public/platform/WebScrollBlocksOn.h"
#include "wtf/Forward.h"
#include "wtf/OwnPtr.h"
@@ -843,8 +846,12 @@ public:
const TransformOrigin& transformOrigin() const { return rareNonInheritedData->m_transform->m_origin; }
const Length& transformOriginX() const { return transformOrigin().x(); }
const Length& transformOriginY() const { return transformOrigin().y(); }
+ TranslateTransformOperation* translate() const { return rareNonInheritedData->m_transform->m_translate.get(); }
+ RotateTransformOperation* rotate() const { return rareNonInheritedData->m_transform->m_rotate.get(); }
+ ScaleTransformOperation* scale() const { return rareNonInheritedData->m_transform->m_scale.get(); }
alancutter (OOO until 2018) 2015/06/18 13:03:24 The returned pointer should be const.
soonm 2015/06/19 04:39:52 As discussed, there is a use case for non-const ra
float transformOriginZ() const { return transformOrigin().z(); }
- bool hasTransform() const { return hasTransformOperations() || hasMotionPath() || hasCurrentTransformAnimation(); }
+ bool has3DTransform() const { return rareNonInheritedData->m_transform->has3DTransform(); }
+ bool hasTransform() const { return hasTransformOperations() || hasMotionPath() || hasCurrentTransformAnimation() || translate() || rotate() || scale(); }
bool transformDataEquivalent(const ComputedStyle& otherStyle) const { return rareNonInheritedData->m_transform == otherStyle.rareNonInheritedData->m_transform; }
StyleMotionPath* motionPath() const { return rareNonInheritedData->m_transform->m_motion.m_path.get(); }
@@ -872,9 +879,9 @@ public:
enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
enum ApplyMotionPath { IncludeMotionPath, ExcludeMotionPath };
- void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPath) const;
- void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPath) const;
-
+ enum ApplyIndependentTransformProperties { IncludeIndependentTransformProperties , ExcludeIndependentTransformProperties };
+ void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin, ApplyMotionPath, ApplyIndependentTransformProperties) const;
+ void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin, ApplyMotionPath, ApplyIndependentTransformProperties) const;
bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); }
@@ -1338,6 +1345,10 @@ public:
void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrigin(transformOriginX(), v, transformOriginZ())); }
void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(transformOriginX(), transformOriginY(), f)); }
void setTransformOrigin(const TransformOrigin& o) { SET_VAR(rareNonInheritedData.access()->m_transform, m_origin, o); }
+ void setTranslate(PassRefPtr<TranslateTransformOperation> v) { rareNonInheritedData.access()->m_transform.access()->m_translate = v; }
+ void setRotate(PassRefPtr<RotateTransformOperation> v) { rareNonInheritedData.access()->m_transform.access()->m_rotate = v; }
+ void setScale(PassRefPtr<ScaleTransformOperation> v) { rareNonInheritedData.access()->m_transform.access()->m_scale = v; }
+
void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); }
@@ -1646,6 +1657,9 @@ public:
static ColumnFill initialColumnFill() { return ColumnFillBalance; }
static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
+ static const PassRefPtr<TranslateTransformOperation> initialTranslate() { return TranslateTransformOperation::create(Length(0, Fixed), Length(0, Fixed), 0, TransformOperation::Translate3D); }
Timothy Loh 2015/06/19 01:16:45 returning const values is... weird. I'm pretty sur
soonm 2015/06/19 04:39:52 Done - Yep no need to be const here
+ static const PassRefPtr<RotateTransformOperation> initialRotate() { return RotateTransformOperation::create(0, 0, 1, 0, TransformOperation::Rotate3D); }
+ static const PassRefPtr<ScaleTransformOperation> initialScale() { return ScaleTransformOperation::create(1, 1, 1, TransformOperation::Scale3D); }
static Length initialTransformOriginX() { return Length(50.0, Percent); }
static Length initialTransformOriginY() { return Length(50.0, Percent); }
static float initialTransformOriginZ() { return 0; }
@@ -1810,6 +1824,8 @@ private:
bool diffNeedsPaintInvalidationLayer(const ComputedStyle& other) const;
bool diffNeedsPaintInvalidationObject(const ComputedStyle& other) const;
void updatePropertySpecificDifferences(const ComputedStyle& other, StyleDifference&) const;
+
+ bool requireTransformOrigin(ApplyTransformOrigin applyOrigin, ApplyMotionPath) const;
};
// FIXME: Reduce/remove the dependency on zoom adjusted int values.

Powered by Google App Engine
This is Rietveld 408576698