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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2476923002: [RFC] Move StyleTransformData to ComputedStyle top-level (Closed)
Patch Set: Add export for StyleTransformData Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/style/ComputedStyle.h
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index b72f5ac2cdecab92c4c883c4eefc9e887840fc82..845e4d385935e74077739dc1bd803b273c663d81 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -181,6 +181,8 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
DataRef<StyleVisualData> m_visual;
DataRef<StyleBackgroundData> m_background;
DataRef<StyleSurroundData> m_surround;
+ DataRef<StyleTransformData>
+ m_transform; // Transform properties (rotate, scale, skew, etc.)
DataRef<StyleRareNonInheritedData> m_rareNonInheritedData;
// inherited attributes
@@ -326,6 +328,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
// 64 bits
unsigned m_isLink : 1;
+ unsigned m_isStackingContext : 1;
mutable unsigned m_hasRemUnits : 1;
@@ -351,7 +354,9 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
unsigned m_isWhiteSpaceInherited : 1;
// If you add more style bits here, you will also need to update
- // ComputedStyle::copyNonInheritedFromCached() 68 bits
+ // ComputedStyle::copyNonInheritedFromCached()
+
+ // 69 bits
} m_nonInheritedData;
// !END SYNC!
@@ -402,6 +407,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
m_nonInheritedData.m_affectedByActive = false;
m_nonInheritedData.m_affectedByDrag = false;
m_nonInheritedData.m_isLink = false;
+ m_nonInheritedData.m_isStackingContext = false;
m_nonInheritedData.m_hasRemUnits = false;
// All independently inherited properties default to being inherited.
@@ -623,11 +629,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return BackfaceVisibilityVisible;
}
EBackfaceVisibility backfaceVisibility() const {
- return static_cast<EBackfaceVisibility>(
- m_rareNonInheritedData->m_backfaceVisibility);
+ return static_cast<EBackfaceVisibility>(m_transform->m_backfaceVisibility);
}
void setBackfaceVisibility(EBackfaceVisibility b) {
- SET_VAR(m_rareNonInheritedData, m_backfaceVisibility, b);
+ SET_VAR(m_transform, m_backfaceVisibility, b);
}
// Background properties.
@@ -1431,28 +1436,24 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return LengthPoint(Length(50.0, Percent), Length(50.0, Percent));
}
const LengthPoint& offsetAnchor() const {
- return m_rareNonInheritedData->m_transform->m_motion.m_anchor;
+ return m_transform->m_motion.m_anchor;
}
void setOffsetAnchor(const LengthPoint& offsetAnchor) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_anchor,
- offsetAnchor);
+ SET_VAR(m_transform, m_motion.m_anchor, offsetAnchor);
}
// offset-distance
static Length initialOffsetDistance() { return Length(0, Fixed); }
const Length& offsetDistance() const {
- return m_rareNonInheritedData->m_transform->m_motion.m_distance;
+ return m_transform->m_motion.m_distance;
}
void setOffsetDistance(const Length& offsetDistance) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_distance,
- offsetDistance);
+ SET_VAR(m_transform, m_motion.m_distance, offsetDistance);
}
// offset-path
static StylePath* initialOffsetPath() { return nullptr; }
- StylePath* offsetPath() const {
- return m_rareNonInheritedData->m_transform->m_motion.m_path.get();
- }
+ StylePath* offsetPath() const { return m_transform->m_motion.m_path.get(); }
void setOffsetPath(PassRefPtr<StylePath>);
// offset-position
@@ -1460,11 +1461,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return LengthPoint(Length(Auto), Length(Auto));
}
const LengthPoint& offsetPosition() const {
- return m_rareNonInheritedData->m_transform->m_motion.m_position;
+ return m_transform->m_motion.m_position;
}
void setOffsetPosition(const LengthPoint& offsetPosition) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_position,
- offsetPosition);
+ SET_VAR(m_transform, m_motion.m_position, offsetPosition);
}
// offset-rotation
@@ -1472,11 +1472,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return StyleOffsetRotation(0, OffsetRotationAuto);
}
const StyleOffsetRotation& offsetRotation() const {
- return m_rareNonInheritedData->m_transform->m_motion.m_rotation;
+ return m_transform->m_motion.m_rotation;
}
void setOffsetRotation(const StyleOffsetRotation& offsetRotation) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_motion.m_rotation,
- offsetRotation);
+ SET_VAR(m_transform, m_motion.m_rotation, offsetRotation);
}
// opacity (aka -webkit-opacity)
@@ -1592,20 +1591,18 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
// perspective (aka -webkit-perspective)
static float initialPerspective() { return 0; }
- float perspective() const { return m_rareNonInheritedData->m_perspective; }
- void setPerspective(float p) {
- SET_VAR(m_rareNonInheritedData, m_perspective, p);
- }
+ float perspective() const { return m_transform->m_perspective; }
+ void setPerspective(float p) { SET_VAR(m_transform, m_perspective, p); }
// perspective-origin (aka -webkit-perspective-origin)
static LengthPoint initialPerspectiveOrigin() {
return LengthPoint(Length(50.0, Percent), Length(50.0, Percent));
}
const LengthPoint& perspectiveOrigin() const {
- return m_rareNonInheritedData->m_perspectiveOrigin;
+ return m_transform->m_perspectiveOrigin;
}
void setPerspectiveOrigin(const LengthPoint& p) {
- SET_VAR(m_rareNonInheritedData, m_perspectiveOrigin, p);
+ SET_VAR(m_transform, m_perspectiveOrigin, p);
}
// -webkit-perspective-origin-x
@@ -1642,10 +1639,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return EmptyTransformOperations();
}
const TransformOperations& transform() const {
- return m_rareNonInheritedData->m_transform->m_operations;
+ return m_transform->m_operations;
}
void setTransform(const TransformOperations& ops) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_operations, ops);
+ SET_VAR(m_transform, m_operations, ops);
}
// transform-origin (aka -webkit-transform-origin)
@@ -1653,10 +1650,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return TransformOrigin(Length(50.0, Percent), Length(50.0, Percent), 0);
}
const TransformOrigin& transformOrigin() const {
- return m_rareNonInheritedData->m_transform->m_origin;
+ return m_transform->m_origin;
}
void setTransformOrigin(const TransformOrigin& o) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_transform, m_origin, o);
+ SET_VAR(m_transform, m_origin, o);
}
// transform-style (aka -webkit-transform-style)
@@ -1664,11 +1661,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return TransformStyle3DFlat;
}
ETransformStyle3D transformStyle3D() const {
- return static_cast<ETransformStyle3D>(
- m_rareNonInheritedData->m_transformStyle3D);
+ return static_cast<ETransformStyle3D>(m_transform->m_transformStyle3D);
}
void setTransformStyle3D(ETransformStyle3D b) {
- SET_VAR(m_rareNonInheritedData, m_transformStyle3D, b);
+ SET_VAR(m_transform, m_transformStyle3D, b);
}
// -webkit-transform-origin-x
@@ -1701,10 +1697,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return nullptr;
}
TranslateTransformOperation* translate() const {
- return m_rareNonInheritedData->m_transform->m_translate.get();
+ return m_transform->m_translate.get();
}
void setTranslate(PassRefPtr<TranslateTransformOperation> v) {
- m_rareNonInheritedData.access()->m_transform.access()->m_translate = v;
+ m_transform.access()->m_translate = v;
}
// rotate
@@ -1712,19 +1708,17 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return nullptr;
}
RotateTransformOperation* rotate() const {
- return m_rareNonInheritedData->m_transform->m_rotate.get();
+ return m_transform->m_rotate.get();
}
void setRotate(PassRefPtr<RotateTransformOperation> v) {
- m_rareNonInheritedData.access()->m_transform.access()->m_rotate = v;
+ m_transform.access()->m_rotate = v;
}
// scale
static PassRefPtr<ScaleTransformOperation> initialScale() { return nullptr; }
- ScaleTransformOperation* scale() const {
- return m_rareNonInheritedData->m_transform->m_scale.get();
- }
+ ScaleTransformOperation* scale() const { return m_transform->m_scale.get(); }
void setScale(PassRefPtr<ScaleTransformOperation> v) {
- m_rareNonInheritedData.access()->m_transform.access()->m_scale = v;
+ m_transform.access()->m_scale = v;
}
// Scroll properties.
@@ -2739,11 +2733,9 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
m_nonInheritedData.m_emptyState = b;
}
- bool hasInlineTransform() const {
- return m_rareNonInheritedData->m_hasInlineTransform;
- }
+ bool hasInlineTransform() const { return m_transform->m_hasInlineTransform; }
void setHasInlineTransform(bool b) {
- SET_VAR(m_rareNonInheritedData, m_hasInlineTransform, b);
+ SET_VAR(m_transform, m_hasInlineTransform, b);
}
bool hasCompositorProxy() const {
@@ -2799,10 +2791,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
// See CSS 2.1, Appendix E (https://www.w3.org/TR/CSS21/zindex.html) for more
// details.
bool isStackingContext() const {
- return m_rareNonInheritedData->m_isStackingContext;
+ return m_nonInheritedData.m_isStackingContext;
}
void setIsStackingContext(bool b) {
- SET_VAR(m_rareNonInheritedData, m_isStackingContext, b);
+ m_nonInheritedData.m_isStackingContext = b;
}
// A unique style is one that has matches something that makes it impossible
@@ -3432,9 +3424,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
bool isLeftToRightDirection() const { return direction() == LTR; }
// Perspective utility functions.
- bool hasPerspective() const {
- return m_rareNonInheritedData->m_perspective > 0;
- }
+ bool hasPerspective() const { return m_transform->m_perspective > 0; }
// Page size utility functions.
void resetPageSizeType() {
@@ -3596,23 +3586,20 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
}
// Filter/transform utility functions.
- bool has3DTransform() const {
- return m_rareNonInheritedData->m_transform->has3DTransform();
- }
+ bool has3DTransform() const { return m_transform->has3DTransform(); }
bool hasTransform() const {
return hasTransformOperations() || hasOffset() ||
hasCurrentTransformAnimation() || translate() || rotate() || scale();
}
bool hasTransformOperations() const {
- return !m_rareNonInheritedData->m_transform->m_operations.operations()
- .isEmpty();
+ return !m_transform->m_operations.operations().isEmpty();
}
ETransformStyle3D usedTransformStyle3D() const {
return hasGroupingProperty() ? TransformStyle3DFlat : transformStyle3D();
}
bool transformDataEquivalent(const ComputedStyle& otherStyle) const {
- return m_rareNonInheritedData->m_transform ==
- otherStyle.m_rareNonInheritedData->m_transform;
+ return m_transform.get() == otherStyle.m_transform.get() ||
+ m_transform->transformDataEquivalent(*otherStyle.m_transform);
}
bool preserves3D() const {
return usedTransformStyle3D() != TransformStyle3DFlat;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698