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

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: Correct equality operators and remove dependencies on size() in parser 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 bbd7a2ba3ef7fcb01c1c74aafa35fef19f19ef05..48ae005ac0689dcd44b73b8f9fb66aec8959250c 100644
--- a/Source/core/style/ComputedStyle.h
+++ b/Source/core/style/ComputedStyle.h
@@ -76,7 +76,10 @@
#include "platform/scroll/ScrollableArea.h"
#include "platform/text/TextDirection.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"
#include "public/platform/WebScrollBlocksOn.h"
#include "wtf/Forward.h"
#include "wtf/OwnPtr.h"
@@ -845,8 +848,16 @@ 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(); }
float transformOriginZ() const { return transformOrigin().z(); }
- bool hasTransform() const { return hasTransformOperations() || hasMotionPath() || hasCurrentTransformAnimation(); }
+ bool hasTranslateProperty() const { return rareNonInheritedData->m_transform->m_translate; }
+ bool hasRotateProperty() const { return rareNonInheritedData->m_transform->m_rotate; }
+ bool hasScaleProperty() const { return rareNonInheritedData->m_transform->m_scale; }
+ bool has3DTransformProperties() const { return rareNonInheritedData->m_transform->has3DTransformProperties(); }
+ bool hasTransformProperties() const { return hasTranslateProperty() || hasRotateProperty() || hasScaleProperty(); }
+ bool hasTransform() const { return hasTransformOperations() || hasMotionPath() || hasCurrentTransformAnimation() || hasTransformProperties(); }
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(); }
@@ -874,8 +885,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 ApplyTransformProperty { IncludeTransformProperty, ExcludeTransformProperty };
+ void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPath, ApplyTransformProperty = IncludeTransformProperty) const;
+ void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin, ApplyMotionPath = IncludeMotionPath, ApplyTransformProperty = IncludeTransformProperty) const;
bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
@@ -1340,6 +1352,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()->setTranslate(v); }
+ void setRotate(PassRefPtr<RotateTransformOperation> v) { rareNonInheritedData.access()->m_transform.access()->setRotate(v); }
+ void setScale(PassRefPtr<ScaleTransformOperation> v) { rareNonInheritedData.access()->m_transform.access()->setScale(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); }
@@ -1648,6 +1664,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::TranslateX); }
+ static const PassRefPtr<RotateTransformOperation> initialRotate() { return RotateTransformOperation::create(0, 0, 1, 0, TransformOperation::Rotate); }
+ static const PassRefPtr<ScaleTransformOperation> initialScale() { return ScaleTransformOperation::create(1, 1, 1, TransformOperation::ScaleX); }
static Length initialTransformOriginX() { return Length(50.0, Percent); }
static Length initialTransformOriginY() { return Length(50.0, Percent); }
static float initialTransformOriginZ() { return 0; }
@@ -1812,6 +1831,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