summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/style/RenderStyle.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/style/RenderStyle.h')
-rw-r--r--WebCore/rendering/style/RenderStyle.h92
1 files changed, 53 insertions, 39 deletions
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 32c0cf4..5062596 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -108,6 +108,45 @@ class RenderStyle: public RefCounted<RenderStyle> {
friend class CSSStyleSelector;
protected:
+ // The following bitfield is 32-bits long, which optimizes padding with the
+ // int refCount in the base class. Beware when adding more bits.
+ unsigned m_pseudoState : 3; // PseudoState
+ bool m_affectedByAttributeSelectors : 1;
+ bool m_unique : 1;
+
+ // Bits for dynamic child matching.
+ bool m_affectedByEmpty : 1;
+ bool m_emptyState : 1;
+
+ // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
+ // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
+ bool m_childrenAffectedByFirstChildRules : 1;
+ bool m_childrenAffectedByLastChildRules : 1;
+ bool m_childrenAffectedByDirectAdjacentRules : 1;
+ bool m_childrenAffectedByForwardPositionalRules : 1;
+ bool m_childrenAffectedByBackwardPositionalRules : 1;
+ bool m_firstChildState : 1;
+ bool m_lastChildState : 1;
+ unsigned m_childIndex : 18; // Plenty of bits to cache an index.
+
+ // non-inherited attributes
+ DataRef<StyleBoxData> box;
+ DataRef<StyleVisualData> visual;
+ DataRef<StyleBackgroundData> background;
+ DataRef<StyleSurroundData> surround;
+ DataRef<StyleRareNonInheritedData> rareNonInheritedData;
+
+ // inherited attributes
+ DataRef<StyleRareInheritedData> rareInheritedData;
+ DataRef<StyleInheritedData> inherited;
+
+ // list of associated pseudo styles
+ RefPtr<RenderStyle> m_cachedPseudoStyle;
+
+#if ENABLE(SVG)
+ DataRef<SVGRenderStyle> m_svgStyle;
+#endif
+
// !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp
// inherit
@@ -149,12 +188,14 @@ protected:
bool _border_collapse : 1 ;
unsigned _white_space : 3; // EWhiteSpace
unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
-
+ // 32 bits
+
// non CSS2 inherited
bool _visuallyOrdered : 1;
- bool _htmlHacks :1;
+ bool _htmlHacks : 1;
bool _force_backgrounds_to_white : 1;
unsigned _pointerEvents : 4; // EPointerEvents
+ // 39 bits
} inherited_flags;
// don't inherit
@@ -201,45 +242,9 @@ protected:
bool _affectedByDrag : 1;
unsigned _pseudoBits : 7;
unsigned _unicodeBidi : 2; // EUnicodeBidi
+ // 48 bits
} noninherited_flags;
- // non-inherited attributes
- DataRef<StyleBoxData> box;
- DataRef<StyleVisualData> visual;
- DataRef<StyleBackgroundData> background;
- DataRef<StyleSurroundData> surround;
- DataRef<StyleRareNonInheritedData> rareNonInheritedData;
-
- // inherited attributes
- DataRef<StyleRareInheritedData> rareInheritedData;
- DataRef<StyleInheritedData> inherited;
-
- // list of associated pseudo styles
- RefPtr<RenderStyle> m_cachedPseudoStyle;
-
- unsigned m_pseudoState : 3; // PseudoState
- bool m_affectedByAttributeSelectors : 1;
- bool m_unique : 1;
-
- // Bits for dynamic child matching.
- bool m_affectedByEmpty : 1;
- bool m_emptyState : 1;
-
- // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
- // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
- bool m_childrenAffectedByFirstChildRules : 1;
- bool m_childrenAffectedByLastChildRules : 1;
- bool m_childrenAffectedByDirectAdjacentRules : 1;
- bool m_childrenAffectedByForwardPositionalRules : 1;
- bool m_childrenAffectedByBackwardPositionalRules : 1;
- bool m_firstChildState : 1;
- bool m_lastChildState : 1;
- unsigned m_childIndex : 18; // Plenty of bits to cache an index.
-
-#if ENABLE(SVG)
- DataRef<SVGRenderStyle> m_svgStyle;
-#endif
-
// !END SYNC!
protected:
@@ -740,6 +745,10 @@ public:
void setBackgroundColor(const Color& v) { SET_VAR(background, m_color, v) }
+ void setBackgroundXPosition(Length l) { SET_VAR(background, m_background.m_xPosition, l) }
+ void setBackgroundYPosition(Length l) { SET_VAR(background, m_background.m_yPosition, l) }
+ void setBackgroundSize(LengthSize l) { SET_VAR(background, m_background.m_size, l) }
+
void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.image, b) }
void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.topLeft, s) }
@@ -754,6 +763,8 @@ public:
setBorderBottomLeftRadius(s);
setBorderBottomRightRadius(s);
}
+
+ void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const;
void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.left.width, v) }
void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.left.m_style, v) }
@@ -847,6 +858,9 @@ public:
}
void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b) }
+ void setMaskXPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, l) }
+ void setMaskYPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, l) }
+ void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_size, l) }
void setBorderCollapse(bool collapse) { inherited_flags._border_collapse = collapse; }
void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }