summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/style
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/rendering/style
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/rendering/style')
-rw-r--r--WebCore/rendering/style/BorderData.h70
-rw-r--r--WebCore/rendering/style/BorderValue.h24
-rw-r--r--WebCore/rendering/style/CollapsedBorderValue.h44
-rw-r--r--WebCore/rendering/style/CursorData.h18
-rw-r--r--WebCore/rendering/style/FillLayer.h6
-rw-r--r--WebCore/rendering/style/NinePieceImage.h10
-rw-r--r--WebCore/rendering/style/OutlineValue.h15
-rw-r--r--WebCore/rendering/style/RenderStyle.cpp231
-rw-r--r--WebCore/rendering/style/RenderStyle.h281
-rw-r--r--WebCore/rendering/style/RenderStyleConstants.h12
-rw-r--r--WebCore/rendering/style/SVGRenderStyle.cpp61
-rw-r--r--WebCore/rendering/style/SVGRenderStyle.h29
-rw-r--r--WebCore/rendering/style/SVGRenderStyleDefs.cpp184
-rw-r--r--WebCore/rendering/style/SVGRenderStyleDefs.h118
-rw-r--r--WebCore/rendering/style/ShadowData.cpp20
-rw-r--r--WebCore/rendering/style/ShadowData.h57
-rw-r--r--WebCore/rendering/style/StyleBackgroundData.h14
-rw-r--r--WebCore/rendering/style/StyleBoxData.cpp49
-rw-r--r--WebCore/rendering/style/StyleBoxData.h47
-rw-r--r--WebCore/rendering/style/StyleMultiColData.h2
20 files changed, 732 insertions, 560 deletions
diff --git a/WebCore/rendering/style/BorderData.h b/WebCore/rendering/style/BorderData.h
index 8ca0d65..96caf97 100644
--- a/WebCore/rendering/style/BorderData.h
+++ b/WebCore/rendering/style/BorderData.h
@@ -32,76 +32,90 @@
namespace WebCore {
class BorderData {
+friend class RenderStyle;
public:
- BorderValue left;
- BorderValue right;
- BorderValue top;
- BorderValue bottom;
-
- NinePieceImage image;
-
- IntSize topLeft;
- IntSize topRight;
- IntSize bottomLeft;
- IntSize bottomRight;
-
bool hasBorder() const
{
- bool haveImage = image.hasImage();
- return left.nonZero(!haveImage) || right.nonZero(!haveImage) || top.nonZero(!haveImage) || bottom.nonZero(!haveImage);
+ bool haveImage = m_image.hasImage();
+ return m_left.nonZero(!haveImage) || m_right.nonZero(!haveImage) || m_top.nonZero(!haveImage) || m_bottom.nonZero(!haveImage);
}
bool hasBorderRadius() const
{
- if (topLeft.width() > 0)
+ if (m_topLeft.width() > 0)
return true;
- if (topRight.width() > 0)
+ if (m_topRight.width() > 0)
return true;
- if (bottomLeft.width() > 0)
+ if (m_bottomLeft.width() > 0)
return true;
- if (bottomRight.width() > 0)
+ if (m_bottomRight.width() > 0)
return true;
return false;
}
unsigned short borderLeftWidth() const
{
- if (!image.hasImage() && (left.style() == BNONE || left.style() == BHIDDEN))
+ if (!m_image.hasImage() && (m_left.style() == BNONE || m_left.style() == BHIDDEN))
return 0;
- return left.width;
+ return m_left.width();
}
unsigned short borderRightWidth() const
{
- if (!image.hasImage() && (right.style() == BNONE || right.style() == BHIDDEN))
+ if (!m_image.hasImage() && (m_right.style() == BNONE || m_right.style() == BHIDDEN))
return 0;
- return right.width;
+ return m_right.width();
}
unsigned short borderTopWidth() const
{
- if (!image.hasImage() && (top.style() == BNONE || top.style() == BHIDDEN))
+ if (!m_image.hasImage() && (m_top.style() == BNONE || m_top.style() == BHIDDEN))
return 0;
- return top.width;
+ return m_top.width();
}
unsigned short borderBottomWidth() const
{
- if (!image.hasImage() && (bottom.style() == BNONE || bottom.style() == BHIDDEN))
+ if (!m_image.hasImage() && (m_bottom.style() == BNONE || m_bottom.style() == BHIDDEN))
return 0;
- return bottom.width;
+ return m_bottom.width();
}
bool operator==(const BorderData& o) const
{
- return left == o.left && right == o.right && top == o.top && bottom == o.bottom && image == o.image &&
- topLeft == o.topLeft && topRight == o.topRight && bottomLeft == o.bottomLeft && bottomRight == o.bottomRight;
+ return m_left == o.m_left && m_right == o.m_right && m_top == o.m_top && m_bottom == o.m_bottom && m_image == o.m_image
+ && m_topLeft == o.m_topLeft && m_topRight == o.m_topRight && m_bottomLeft == o.m_bottomLeft && m_bottomRight == o.m_bottomRight;
}
bool operator!=(const BorderData& o) const
{
return !(*this == o);
}
+
+ const BorderValue& left() const { return m_left; }
+ const BorderValue& right() const { return m_right; }
+ const BorderValue& top() const { return m_top; }
+ const BorderValue& bottom() const { return m_bottom; }
+
+ const NinePieceImage& image() const { return m_image; }
+
+ const IntSize& topLeft() const { return m_topLeft; }
+ const IntSize& topRight() const { return m_topRight; }
+ const IntSize& bottomLeft() const { return m_bottomLeft; }
+ const IntSize& bottomRight() const { return m_bottomRight; }
+
+private:
+ BorderValue m_left;
+ BorderValue m_right;
+ BorderValue m_top;
+ BorderValue m_bottom;
+
+ NinePieceImage m_image;
+
+ IntSize m_topLeft;
+ IntSize m_topRight;
+ IntSize m_bottomLeft;
+ IntSize m_bottomRight;
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/BorderValue.h b/WebCore/rendering/style/BorderValue.h
index e61e708..3e6fd5d 100644
--- a/WebCore/rendering/style/BorderValue.h
+++ b/WebCore/rendering/style/BorderValue.h
@@ -31,27 +31,22 @@
namespace WebCore {
class BorderValue {
+friend class RenderStyle;
public:
BorderValue()
- : width(3)
+ : m_width(3)
, m_style(BNONE)
{
}
- Color color;
- unsigned width : 12;
- unsigned m_style : 4; // EBorderStyle
-
- EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
-
bool nonZero(bool checkStyle = true) const
{
- return width != 0 && (!checkStyle || m_style != BNONE);
+ return width() && (!checkStyle || m_style != BNONE);
}
bool isTransparent() const
{
- return color.isValid() && color.alpha() == 0;
+ return m_color.isValid() && !m_color.alpha();
}
bool isVisible(bool checkStyle = true) const
@@ -61,13 +56,22 @@ public:
bool operator==(const BorderValue& o) const
{
- return width == o.width && m_style == o.m_style && color == o.color;
+ return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color;
}
bool operator!=(const BorderValue& o) const
{
return !(*this == o);
}
+
+ const Color& color() const { return m_color; }
+ unsigned short width() const { return m_width; }
+ EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
+
+protected:
+ Color m_color;
+ unsigned m_width : 12;
+ unsigned m_style : 4; // EBorderStyle
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/CollapsedBorderValue.h b/WebCore/rendering/style/CollapsedBorderValue.h
index 805f474..6207231 100644
--- a/WebCore/rendering/style/CollapsedBorderValue.h
+++ b/WebCore/rendering/style/CollapsedBorderValue.h
@@ -29,36 +29,42 @@
namespace WebCore {
-struct CollapsedBorderValue {
+class CollapsedBorderValue {
+friend class RenderStyle;
+public:
CollapsedBorderValue()
- : border(0)
- , precedence(BOFF)
+ : m_border(0)
+ , m_precedence(BOFF)
{
}
- CollapsedBorderValue(const BorderValue* b, EBorderPrecedence p)
- : border(b)
- , precedence(p)
+ CollapsedBorderValue(const BorderValue* b, Color c, EBorderPrecedence p)
+ : m_border(b)
+ , m_borderColor(c)
+ , m_precedence(p)
{
}
- int width() const { return border && border->nonZero() ? border->width : 0; }
- EBorderStyle style() const { return border ? border->style() : BHIDDEN; }
- bool exists() const { return border; }
- Color color() const { return border ? border->color : Color(); }
- bool isTransparent() const { return border ? border->isTransparent() : true; }
-
+ int width() const { return m_border && m_border->nonZero() ? m_border->width() : 0; }
+ EBorderStyle style() const { return m_border ? m_border->style() : BHIDDEN; }
+ bool exists() const { return m_border; }
+ const Color& color() const { return m_borderColor; }
+ bool isTransparent() const { return m_border ? m_border->isTransparent() : true; }
+ EBorderPrecedence precedence() const { return m_precedence; }
+
bool operator==(const CollapsedBorderValue& o) const
{
- if (!border)
- return !o.border;
- if (!o.border)
+ if (!m_border)
+ return !o.m_border;
+ if (!o.m_border)
return false;
- return *border == *o.border && precedence == o.precedence;
+ return *m_border == *o.m_border && m_borderColor == o.m_borderColor && m_precedence == o.m_precedence;
}
-
- const BorderValue* border;
- EBorderPrecedence precedence;
+
+private:
+ const BorderValue* m_border;
+ Color m_borderColor;
+ EBorderPrecedence m_precedence;
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/CursorData.h b/WebCore/rendering/style/CursorData.h
index 7c6b31d..2341e71 100644
--- a/WebCore/rendering/style/CursorData.h
+++ b/WebCore/rendering/style/CursorData.h
@@ -31,15 +31,17 @@
namespace WebCore {
-struct CursorData {
- CursorData()
- : cursorImage(0)
+class CursorData {
+public:
+ CursorData(CachedImage* image, const IntPoint& hotSpot)
+ : m_image(image)
+ , m_hotSpot(hotSpot)
{
}
bool operator==(const CursorData& o) const
{
- return hotSpot == o.hotSpot && cursorImage == o.cursorImage;
+ return m_hotSpot == o.m_hotSpot && m_image == o.m_image;
}
bool operator!=(const CursorData& o) const
@@ -47,8 +49,12 @@ struct CursorData {
return !(*this == o);
}
- IntPoint hotSpot; // for CSS3 support
- CachedResourceHandle<CachedImage> cursorImage;
+ const CachedImage* image() const { return m_image.get(); }
+ const IntPoint& hotSpot() const { return m_hotSpot; }
+
+private:
+ CachedResourceHandle<CachedImage> m_image;
+ IntPoint m_hotSpot; // for CSS3 support
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h
index cef6b19..eb21ec3 100644
--- a/WebCore/rendering/style/FillLayer.h
+++ b/WebCore/rendering/style/FillLayer.h
@@ -59,7 +59,7 @@ struct FillSize {
LengthSize size;
};
-struct FillLayer : FastAllocBase {
+class FillLayer : public FastAllocBase {
public:
FillLayer(EFillLayerType);
~FillLayer();
@@ -74,6 +74,7 @@ public:
EFillRepeat repeatY() const { return static_cast<EFillRepeat>(m_repeatY); }
CompositeOperator composite() const { return static_cast<CompositeOperator>(m_composite); }
LengthSize sizeLength() const { return m_sizeLength; }
+ EFillSizeType sizeType() const { return static_cast<EFillSizeType>(m_sizeType); }
FillSize size() const { return FillSize(static_cast<EFillSizeType>(m_sizeType), m_sizeLength); }
const FillLayer* next() const { return m_next; }
@@ -161,9 +162,10 @@ public:
static StyleImage* initialFillImage(EFillLayerType) { return 0; }
private:
+ friend class RenderStyle;
+
FillLayer() { }
-public:
RefPtr<StyleImage> m_image;
Length m_xPosition;
diff --git a/WebCore/rendering/style/NinePieceImage.h b/WebCore/rendering/style/NinePieceImage.h
index bf47ce6..c400551 100644
--- a/WebCore/rendering/style/NinePieceImage.h
+++ b/WebCore/rendering/style/NinePieceImage.h
@@ -55,10 +55,18 @@ public:
bool hasImage() const { return m_image != 0; }
StyleImage* image() const { return m_image.get(); }
+ void setImage(StyleImage* image) { m_image = image; }
+ const LengthBox& slices() const { return m_slices; }
+ void setSlices(const LengthBox& l) { m_slices = l; }
+
ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_horizontalRule); }
- ENinePieceImageRule verticalRule() const { return static_cast<ENinePieceImageRule>(m_verticalRule); }
+ void setHorizontalRule(ENinePieceImageRule rule) { m_horizontalRule = rule; }
+ ENinePieceImageRule verticalRule() const { return static_cast<ENinePieceImageRule>(m_verticalRule); }
+ void setVerticalRule(ENinePieceImageRule rule) { m_verticalRule = rule; }
+
+private:
RefPtr<StyleImage> m_image;
LengthBox m_slices;
unsigned m_horizontalRule : 2; // ENinePieceImageRule
diff --git a/WebCore/rendering/style/OutlineValue.h b/WebCore/rendering/style/OutlineValue.h
index 2628b7f..19c17a7 100644
--- a/WebCore/rendering/style/OutlineValue.h
+++ b/WebCore/rendering/style/OutlineValue.h
@@ -30,16 +30,17 @@
namespace WebCore {
class OutlineValue : public BorderValue {
+friend class RenderStyle;
public:
OutlineValue()
- : _offset(0)
- , _auto(false)
+ : m_offset(0)
+ , m_isAuto(false)
{
}
bool operator==(const OutlineValue& o) const
{
- return width == o.width && m_style == o.m_style && color == o.color && _offset == o._offset && _auto == o._auto;
+ return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_offset == o.m_offset && m_isAuto == o.m_isAuto;
}
bool operator!=(const OutlineValue& o) const
@@ -47,8 +48,12 @@ public:
return !(*this == o);
}
- int _offset;
- bool _auto;
+ int offset() const { return m_offset; }
+ bool isAuto() const { return m_isAuto; }
+
+private:
+ int m_offset;
+ bool m_isAuto;
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 712344f..f1cf0bc 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -22,6 +22,7 @@
#include "config.h"
#include "RenderStyle.h"
+#include "CSSPropertyNames.h"
#include "CSSStyleSelector.h"
#include "CachedImage.h"
#include "CounterContent.h"
@@ -58,8 +59,7 @@ PassRefPtr<RenderStyle> RenderStyle::clone(const RenderStyle* other)
}
RenderStyle::RenderStyle()
- : m_pseudoState(PseudoUnknown)
- , m_affectedByAttributeSelectors(false)
+ : m_affectedByAttributeSelectors(false)
, m_unique(false)
, m_affectedByEmpty(false)
, m_emptyState(false)
@@ -71,9 +71,9 @@ RenderStyle::RenderStyle()
, m_firstChildState(false)
, m_lastChildState(false)
, m_childIndex(0)
- , box(defaultStyle()->box)
+ , m_box(defaultStyle()->m_box)
, visual(defaultStyle()->visual)
- , background(defaultStyle()->background)
+ , m_background(defaultStyle()->m_background)
, surround(defaultStyle()->surround)
, rareNonInheritedData(defaultStyle()->rareNonInheritedData)
, rareInheritedData(defaultStyle()->rareInheritedData)
@@ -86,8 +86,7 @@ RenderStyle::RenderStyle()
}
RenderStyle::RenderStyle(bool)
- : m_pseudoState(PseudoUnknown)
- , m_affectedByAttributeSelectors(false)
+ : m_affectedByAttributeSelectors(false)
, m_unique(false)
, m_affectedByEmpty(false)
, m_emptyState(false)
@@ -102,9 +101,9 @@ RenderStyle::RenderStyle(bool)
{
setBitDefaults();
- box.init();
+ m_box.init();
visual.init();
- background.init();
+ m_background.init();
surround.init();
rareNonInheritedData.init();
rareNonInheritedData.access()->flexibleBox.init();
@@ -121,7 +120,6 @@ RenderStyle::RenderStyle(bool)
RenderStyle::RenderStyle(const RenderStyle& o)
: RefCounted<RenderStyle>()
- , m_pseudoState(o.m_pseudoState)
, m_affectedByAttributeSelectors(false)
, m_unique(false)
, m_affectedByEmpty(false)
@@ -134,9 +132,9 @@ RenderStyle::RenderStyle(const RenderStyle& o)
, m_firstChildState(false)
, m_lastChildState(false)
, m_childIndex(0)
- , box(o.box)
+ , m_box(o.m_box)
, visual(o.visual)
- , background(o.background)
+ , m_background(o.m_background)
, surround(o.surround)
, rareNonInheritedData(o.rareNonInheritedData)
, rareInheritedData(o.rareInheritedData)
@@ -169,9 +167,9 @@ bool RenderStyle::operator==(const RenderStyle& o) const
// compare everything except the pseudoStyle pointer
return inherited_flags == o.inherited_flags &&
noninherited_flags == o.noninherited_flags &&
- box == o.box &&
+ m_box == o.m_box &&
visual == o.visual &&
- background == o.background &&
+ m_background == o.m_background &&
surround == o.surround &&
rareNonInheritedData == o.rareNonInheritedData &&
rareInheritedData == o.rareInheritedData &&
@@ -213,28 +211,39 @@ void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
RenderStyle* RenderStyle::getCachedPseudoStyle(PseudoId pid) const
{
- if (!m_cachedPseudoStyle || styleType() != NOPSEUDO)
+ ASSERT(styleType() != VISITED_LINK);
+
+ if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
+ return 0;
+
+ if (styleType() != NOPSEUDO) {
+ if (pid == VISITED_LINK)
+ return m_cachedPseudoStyles->at(0)->styleType() == VISITED_LINK ? m_cachedPseudoStyles->at(0).get() : 0;
return 0;
- RenderStyle* ps = m_cachedPseudoStyle.get();
- while (ps && ps->styleType() != pid)
- ps = ps->m_cachedPseudoStyle.get();
- return ps;
+ }
+
+ for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
+ RenderStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get();
+ if (pseudoStyle->styleType() == pid)
+ return pseudoStyle;
+ }
+
+ return 0;
}
RenderStyle* RenderStyle::addCachedPseudoStyle(PassRefPtr<RenderStyle> pseudo)
{
if (!pseudo)
return 0;
- pseudo->m_cachedPseudoStyle = m_cachedPseudoStyle;
- m_cachedPseudoStyle = pseudo;
- return m_cachedPseudoStyle.get();
-}
+
+ RenderStyle* result = pseudo.get();
-void RenderStyle::getPseudoStyleCache(PseudoStyleCache& cache) const
-{
- ASSERT(cache.isEmpty());
- for (RenderStyle* pseudoStyle = m_cachedPseudoStyle.get(); pseudoStyle; pseudoStyle = pseudoStyle->m_cachedPseudoStyle.get())
- cache.append(pseudoStyle);
+ if (!m_cachedPseudoStyles)
+ m_cachedPseudoStyles.set(new PseudoStyleCache);
+
+ m_cachedPseudoStyles->append(pseudo);
+
+ return result;
}
bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const
@@ -297,18 +306,18 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
return StyleDifferenceLayout;
#endif
- if (box->width != other->box->width ||
- box->min_width != other->box->min_width ||
- box->max_width != other->box->max_width ||
- box->height != other->box->height ||
- box->min_height != other->box->min_height ||
- box->max_height != other->box->max_height)
+ if (m_box->width() != other->m_box->width() ||
+ m_box->minWidth() != other->m_box->minWidth() ||
+ m_box->maxWidth() != other->m_box->maxWidth() ||
+ m_box->height() != other->m_box->height() ||
+ m_box->minHeight() != other->m_box->minHeight() ||
+ m_box->maxHeight() != other->m_box->maxHeight())
return StyleDifferenceLayout;
- if (box->vertical_align != other->box->vertical_align || noninherited_flags._vertical_align != other->noninherited_flags._vertical_align)
+ if (m_box->verticalAlign() != other->m_box->verticalAlign() || noninherited_flags._vertical_align != other->noninherited_flags._vertical_align)
return StyleDifferenceLayout;
- if (box->boxSizing != other->box->boxSizing)
+ if (m_box->boxSizing() != other->m_box->boxSizing())
return StyleDifferenceLayout;
if (surround->margin != other->surround->margin)
@@ -480,7 +489,7 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
// return RepaintLayer;
//else
return StyleDifferenceLayout;
- } else if (box->z_index != other->box->z_index || box->z_auto != other->box->z_auto ||
+ } else if (m_box->zIndex() != other->m_box->zIndex() || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex() ||
visual->clip != other->visual->clip || visual->hasClip != other->visual->hasClip)
return StyleDifferenceRepaintLayer;
}
@@ -502,8 +511,9 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
inherited_flags._visibility != other->inherited_flags._visibility ||
inherited_flags._text_decorations != other->inherited_flags._text_decorations ||
inherited_flags._force_backgrounds_to_white != other->inherited_flags._force_backgrounds_to_white ||
+ inherited_flags._insideLink != other->inherited_flags._insideLink ||
surround->border != other->surround->border ||
- *background.get() != *other->background.get() ||
+ *m_background.get() != *other->m_background.get() ||
visual->textDecoration != other->visual->textDecoration ||
rareInheritedData->userModify != other->rareInheritedData->userModify ||
rareInheritedData->userSelect != other->rareInheritedData->userSelect ||
@@ -543,12 +553,9 @@ void RenderStyle::setClip(Length top, Length right, Length bottom, Length left)
void RenderStyle::addCursor(CachedImage* image, const IntPoint& hotSpot)
{
- CursorData data;
- data.cursorImage = image;
- data.hotSpot = hotSpot;
if (!inherited.access()->cursorData)
inherited.access()->cursorData = CursorList::create();
- inherited.access()->cursorData->append(data);
+ inherited.access()->cursorData->append(CursorData(image, hotSpot));
}
void RenderStyle::setCursorList(PassRefPtr<CursorList> other)
@@ -707,7 +714,7 @@ void RenderStyle::addBindingURI(StringImpl* uri)
void RenderStyle::setTextShadow(ShadowData* val, bool add)
{
- ASSERT(!val || (!val->spread && val->style == Normal));
+ ASSERT(!val || (!val->spread() && val->style() == Normal));
StyleRareInheritedData* rareData = rareInheritedData.access();
if (!add) {
@@ -716,7 +723,7 @@ void RenderStyle::setTextShadow(ShadowData* val, bool add)
return;
}
- val->next = rareData->textShadow;
+ val->setNext(rareData->textShadow);
rareData->textShadow = val;
}
@@ -728,17 +735,17 @@ void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add)
return;
}
- shadowData->next = rareData->m_boxShadow.release();
+ shadowData->setNext(rareData->m_boxShadow.release());
rareData->m_boxShadow.set(shadowData);
}
void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const
{
- topLeft = surround->border.topLeft;
- topRight = surround->border.topRight;
+ topLeft = surround->border.topLeft();
+ topRight = surround->border.topRight();
- bottomLeft = surround->border.bottomLeft;
- bottomRight = surround->border.bottomRight;
+ bottomLeft = surround->border.bottomLeft();
+ bottomRight = surround->border.bottomRight();
// Constrain corner radii using CSS3 rules:
// http://www.w3.org/TR/css3-background/#the-border-radius
@@ -925,15 +932,15 @@ void RenderStyle::getBoxShadowExtent(int &top, int &right, int &bottom, int &lef
bottom = 0;
left = 0;
- for (ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
- if (boxShadow->style == Inset)
+ for (const ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next()) {
+ if (boxShadow->style() == Inset)
continue;
- int blurAndSpread = boxShadow->blur + boxShadow->spread;
+ int blurAndSpread = boxShadow->blur() + boxShadow->spread();
- top = min(top, boxShadow->y - blurAndSpread);
- right = max(right, boxShadow->x + blurAndSpread);
- bottom = max(bottom, boxShadow->y + blurAndSpread);
- left = min(left, boxShadow->x - blurAndSpread);
+ top = min(top, boxShadow->y() - blurAndSpread);
+ right = max(right, boxShadow->x() + blurAndSpread);
+ bottom = max(bottom, boxShadow->y() + blurAndSpread);
+ left = min(left, boxShadow->x() - blurAndSpread);
}
}
@@ -942,13 +949,13 @@ void RenderStyle::getBoxShadowHorizontalExtent(int &left, int &right) const
left = 0;
right = 0;
- for (ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
- if (boxShadow->style == Inset)
+ for (const ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next()) {
+ if (boxShadow->style() == Inset)
continue;
- int blurAndSpread = boxShadow->blur + boxShadow->spread;
+ int blurAndSpread = boxShadow->blur() + boxShadow->spread();
- left = min(left, boxShadow->x - blurAndSpread);
- right = max(right, boxShadow->x + blurAndSpread);
+ left = min(left, boxShadow->x() - blurAndSpread);
+ right = max(right, boxShadow->x() + blurAndSpread);
}
}
@@ -957,14 +964,108 @@ void RenderStyle::getBoxShadowVerticalExtent(int &top, int &bottom) const
top = 0;
bottom = 0;
- for (ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next) {
- if (boxShadow->style == Inset)
+ for (const ShadowData* boxShadow = this->boxShadow(); boxShadow; boxShadow = boxShadow->next()) {
+ if (boxShadow->style() == Inset)
continue;
- int blurAndSpread = boxShadow->blur + boxShadow->spread;
+ int blurAndSpread = boxShadow->blur() + boxShadow->spread();
- top = min(top, boxShadow->y - blurAndSpread);
- bottom = max(bottom, boxShadow->y + blurAndSpread);
+ top = min(top, boxShadow->y() - blurAndSpread);
+ bottom = max(bottom, boxShadow->y() + blurAndSpread);
}
}
+static EBorderStyle borderStyleForColorProperty(const RenderStyle* style, int colorProperty)
+{
+ EBorderStyle borderStyle;
+ switch (colorProperty) {
+ case CSSPropertyBorderLeftColor:
+ borderStyle = style->borderLeftStyle();
+ break;
+ case CSSPropertyBorderRightColor:
+ borderStyle = style->borderRightStyle();
+ break;
+ case CSSPropertyBorderTopColor:
+ borderStyle = style->borderTopStyle();
+ break;
+ case CSSPropertyBorderBottomColor:
+ borderStyle = style->borderBottomStyle();
+ break;
+ default:
+ borderStyle = BNONE;
+ break;
+ }
+ return borderStyle;
+}
+
+static Color colorIncludingFallback(const RenderStyle* style, int colorProperty, EBorderStyle borderStyle)
+{
+ Color result;
+ switch (colorProperty) {
+ case CSSPropertyBackgroundColor:
+ return style->backgroundColor(); // Background color doesn't fall back.
+ case CSSPropertyBorderLeftColor:
+ result = style->borderLeftColor();
+ borderStyle = style->borderLeftStyle();
+ break;
+ case CSSPropertyBorderRightColor:
+ result = style->borderRightColor();
+ borderStyle = style->borderRightStyle();
+ break;
+ case CSSPropertyBorderTopColor:
+ result = style->borderTopColor();
+ borderStyle = style->borderTopStyle();
+ break;
+ case CSSPropertyBorderBottomColor:
+ result = style->borderBottomColor();
+ borderStyle = style->borderBottomStyle();
+ break;
+ case CSSPropertyColor:
+ result = style->color();
+ break;
+ case CSSPropertyOutlineColor:
+ result = style->outlineColor();
+ break;
+ case CSSPropertyWebkitColumnRuleColor:
+ result = style->columnRuleColor();
+ break;
+ case CSSPropertyWebkitTextFillColor:
+ result = style->textFillColor();
+ break;
+ case CSSPropertyWebkitTextStrokeColor:
+ result = style->textStrokeColor();
+ break;
+ default:
+ // FIXME: Add SVG fill and stroke.
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ if (!result.isValid()) {
+ if ((colorProperty == CSSPropertyBorderLeftColor || colorProperty == CSSPropertyBorderRightColor
+ || colorProperty == CSSPropertyBorderTopColor || colorProperty == CSSPropertyBorderBottomColor)
+ && (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE))
+ result.setRGB(238, 238, 238);
+ else
+ result = style->color();
+ }
+
+ return result;
+}
+
+Color RenderStyle::visitedDependentColor(int colorProperty) const
+{
+ EBorderStyle borderStyle = borderStyleForColorProperty(this, colorProperty);
+ Color unvisitedColor = colorIncludingFallback(this, colorProperty, borderStyle);
+ if (insideLink() != InsideVisitedLink)
+ return unvisitedColor;
+
+ RenderStyle* visitedStyle = getCachedPseudoStyle(VISITED_LINK);
+ if (!visitedStyle)
+ return unvisitedColor;
+ Color visitedColor = colorIncludingFallback(visitedStyle, colorProperty, borderStyle);
+
+ // Take the alpha from the unvisited color, but get the RGB values from the visited color.
+ return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), unvisitedColor.alpha());
+}
+
} // namespace WebCore
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index c7db254..fe42339 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -110,13 +110,14 @@ class Pair;
class StringImpl;
class StyleImage;
+typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
+
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;
@@ -133,12 +134,12 @@ protected:
bool m_childrenAffectedByBackwardPositionalRules : 1;
bool m_firstChildState : 1;
bool m_lastChildState : 1;
- unsigned m_childIndex : 18; // Plenty of bits to cache an index.
+ unsigned m_childIndex : 21; // Plenty of bits to cache an index.
// non-inherited attributes
- DataRef<StyleBoxData> box;
+ DataRef<StyleBoxData> m_box;
DataRef<StyleVisualData> visual;
- DataRef<StyleBackgroundData> background;
+ DataRef<StyleBackgroundData> m_background;
DataRef<StyleSurroundData> surround;
DataRef<StyleRareNonInheritedData> rareNonInheritedData;
@@ -147,7 +148,7 @@ protected:
DataRef<StyleInheritedData> inherited;
// list of associated pseudo styles
- RefPtr<RenderStyle> m_cachedPseudoStyle;
+ OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
#if ENABLE(SVG)
DataRef<SVGRenderStyle> m_svgStyle;
@@ -176,7 +177,8 @@ protected:
(_visuallyOrdered == other._visuallyOrdered) &&
(_htmlHacks == other._htmlHacks) &&
(_force_backgrounds_to_white == other._force_backgrounds_to_white) &&
- (_pointerEvents == other._pointerEvents);
+ (_pointerEvents == other._pointerEvents) &&
+ (_insideLink == other._insideLink);
}
bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
@@ -201,7 +203,8 @@ protected:
bool _htmlHacks : 1;
bool _force_backgrounds_to_white : 1;
unsigned _pointerEvents : 4; // EPointerEvents
- // 41 bits
+ unsigned _insideLink : 2; // EInsideLink
+ // 43 bits
} inherited_flags;
// don't inherit
@@ -225,7 +228,8 @@ protected:
&& _affectedByActive == other._affectedByActive
&& _affectedByDrag == other._affectedByDrag
&& _pseudoBits == other._pseudoBits
- && _unicodeBidi == other._unicodeBidi;
+ && _unicodeBidi == other._unicodeBidi
+ && _isLink == other._isLink;
}
bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
@@ -244,12 +248,13 @@ protected:
unsigned _page_break_after : 2; // EPageBreak
unsigned _page_break_inside : 2; // EPageBreak
- unsigned _styleType : 5; // PseudoId
+ unsigned _styleType : 6; // PseudoId
bool _affectedByHover : 1;
bool _affectedByActive : 1;
bool _affectedByDrag : 1;
unsigned _pseudoBits : 7;
unsigned _unicodeBidi : 2; // EUnicodeBidi
+ bool _isLink : 1;
// 50 bits
} noninherited_flags;
@@ -275,6 +280,7 @@ protected:
inherited_flags._box_direction = initialBoxDirection();
inherited_flags._force_backgrounds_to_white = false;
inherited_flags._pointerEvents = initialPointerEvents();
+ inherited_flags._insideLink = NotInsideLink;
noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
noninherited_flags._overflowX = initialOverflowX();
@@ -293,6 +299,7 @@ protected:
noninherited_flags._affectedByDrag = false;
noninherited_flags._pseudoBits = 0;
noninherited_flags._unicodeBidi = initialUnicodeBidi();
+ noninherited_flags._isLink = false;
}
protected:
@@ -316,8 +323,7 @@ public:
RenderStyle* getCachedPseudoStyle(PseudoId) const;
RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
- typedef Vector<RenderStyle*, 10> PseudoStyleCache;
- void getPseudoStyleCache(PseudoStyleCache&) const;
+ const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
bool affectedByActiveRules() const { return noninherited_flags._affectedByActive; }
@@ -339,10 +345,10 @@ public:
{
if (backgroundColor().isValid() && backgroundColor().alpha() > 0)
return true;
- return background->m_background.hasImage();
+ return m_background->background().hasImage();
}
- bool hasBackgroundImage() const { return background->m_background.hasImage(); }
- bool hasFixedBackgroundImage() const { return background->m_background.hasFixedImage(); }
+ bool hasBackgroundImage() const { return m_background->background().hasImage(); }
+ bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
bool hasAppearance() const { return appearance() != NoControlPart; }
bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
@@ -372,62 +378,62 @@ public:
EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
- Length width() const { return box->width; }
- Length height() const { return box->height; }
- Length minWidth() const { return box->min_width; }
- Length maxWidth() const { return box->max_width; }
- Length minHeight() const { return box->min_height; }
- Length maxHeight() const { return box->max_height; }
+ Length width() const { return m_box->width(); }
+ Length height() const { return m_box->height(); }
+ Length minWidth() const { return m_box->minWidth(); }
+ Length maxWidth() const { return m_box->maxWidth(); }
+ Length minHeight() const { return m_box->minHeight(); }
+ Length maxHeight() const { return m_box->maxHeight(); }
const BorderData& border() const { return surround->border; }
- const BorderValue& borderLeft() const { return surround->border.left; }
- const BorderValue& borderRight() const { return surround->border.right; }
- const BorderValue& borderTop() const { return surround->border.top; }
- const BorderValue& borderBottom() const { return surround->border.bottom; }
+ const BorderValue& borderLeft() const { return surround->border.left(); }
+ const BorderValue& borderRight() const { return surround->border.right(); }
+ const BorderValue& borderTop() const { return surround->border.top(); }
+ const BorderValue& borderBottom() const { return surround->border.bottom(); }
- const NinePieceImage& borderImage() const { return surround->border.image; }
+ const NinePieceImage& borderImage() const { return surround->border.image(); }
- const IntSize& borderTopLeftRadius() const { return surround->border.topLeft; }
- const IntSize& borderTopRightRadius() const { return surround->border.topRight; }
- const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft; }
- const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight; }
+ const IntSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
+ const IntSize& borderTopRightRadius() const { return surround->border.topRight(); }
+ const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
+ const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
- EBorderStyle borderLeftStyle() const { return surround->border.left.style(); }
- const Color& borderLeftColor() const { return surround->border.left.color; }
- bool borderLeftIsTransparent() const { return surround->border.left.isTransparent(); }
+ EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
+ const Color& borderLeftColor() const { return surround->border.left().color(); }
+ bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
- EBorderStyle borderRightStyle() const { return surround->border.right.style(); }
- const Color& borderRightColor() const { return surround->border.right.color; }
- bool borderRightIsTransparent() const { return surround->border.right.isTransparent(); }
+ EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
+ const Color& borderRightColor() const { return surround->border.right().color(); }
+ bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
- EBorderStyle borderTopStyle() const { return surround->border.top.style(); }
- const Color& borderTopColor() const { return surround->border.top.color; }
- bool borderTopIsTransparent() const { return surround->border.top.isTransparent(); }
+ EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
+ const Color& borderTopColor() const { return surround->border.top().color(); }
+ bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
- EBorderStyle borderBottomStyle() const { return surround->border.bottom.style(); }
- const Color& borderBottomColor() const { return surround->border.bottom.color; }
- bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }
+ EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
+ const Color& borderBottomColor() const { return surround->border.bottom().color(); }
+ bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
unsigned short outlineWidth() const
{
- if (background->m_outline.style() == BNONE)
+ if (m_background->outline().style() == BNONE)
return 0;
- return background->m_outline.width;
+ return m_background->outline().width();
}
bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
- EBorderStyle outlineStyle() const { return background->m_outline.style(); }
- bool outlineStyleIsAuto() const { return background->m_outline._auto; }
- const Color& outlineColor() const { return background->m_outline.color; }
+ EBorderStyle outlineStyle() const { return m_background->outline().style(); }
+ bool outlineStyleIsAuto() const { return m_background->outline().isAuto(); }
+ const Color& outlineColor() const { return m_background->outline().color(); }
EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
- Length verticalAlignLength() const { return box->vertical_align; }
+ Length verticalAlignLength() const { return m_box->verticalAlign(); }
Length clipLeft() const { return visual->clip.left(); }
Length clipRight() const { return visual->clip.right(); }
@@ -529,31 +535,32 @@ public:
return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
}
- const Color& backgroundColor() const { return background->m_color; }
- StyleImage* backgroundImage() const { return background->m_background.m_image.get(); }
- EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(background->m_background.m_repeatX); }
- EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(background->m_background.m_repeatY); }
- CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(background->m_background.m_composite); }
- EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(background->m_background.m_attachment); }
- EFillBox backgroundClip() const { return static_cast<EFillBox>(background->m_background.m_clip); }
- EFillBox backgroundOrigin() const { return static_cast<EFillBox>(background->m_background.m_origin); }
- Length backgroundXPosition() const { return background->m_background.m_xPosition; }
- Length backgroundYPosition() const { return background->m_background.m_yPosition; }
- EFillSizeType backgroundSizeType() const { return static_cast<EFillSizeType>(background->m_background.m_sizeType); }
- LengthSize backgroundSizeLength() const { return background->m_background.m_sizeLength; }
- FillLayer* accessBackgroundLayers() { return &(background.access()->m_background); }
- const FillLayer* backgroundLayers() const { return &(background->m_background); }
-
- StyleImage* maskImage() const { return rareNonInheritedData->m_mask.m_image.get(); }
- EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.m_repeatX); }
- EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.m_repeatY); }
- CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.m_composite); }
- EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.m_attachment); }
- EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.m_clip); }
- EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.m_origin); }
- Length maskXPosition() const { return rareNonInheritedData->m_mask.m_xPosition; }
- Length maskYPosition() const { return rareNonInheritedData->m_mask.m_yPosition; }
- LengthSize maskSize() const { return rareNonInheritedData->m_mask.m_sizeLength; }
+ const Color& backgroundColor() const { return m_background->color(); }
+ StyleImage* backgroundImage() const { return m_background->background().image(); }
+ EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
+ EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
+ CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
+ EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
+ EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
+ EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
+ Length backgroundXPosition() const { return m_background->background().xPosition(); }
+ Length backgroundYPosition() const { return m_background->background().yPosition(); }
+ EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
+ LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
+ FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
+ const FillLayer* backgroundLayers() const { return &(m_background->background()); }
+
+ StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
+ EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
+ EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
+ CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
+ EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.attachment()); }
+ EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
+ EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
+ Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
+ Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
+ EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
+ LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
@@ -587,6 +594,9 @@ public:
CursorList* cursors() const { return inherited->cursorData.get(); }
+ EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
+ bool isLink() const { return noninherited_flags._isLink; }
+
short widows() const { return inherited->widows; }
short orphans() const { return inherited->orphans; }
EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
@@ -600,12 +610,12 @@ public:
int outlineOffset() const
{
- if (background->m_outline.style() == BNONE)
+ if (m_background->outline().style() == BNONE)
return 0;
- return background->m_outline._offset;
+ return m_background->outline().offset();
}
- ShadowData* textShadow() const { return rareInheritedData->textShadow; }
+ const ShadowData* textShadow() const { return rareInheritedData->textShadow; }
const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
const Color& textFillColor() const { return rareInheritedData->textFillColor; }
@@ -621,13 +631,13 @@ public:
EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->flexibleBox->orient); }
EBoxAlignment boxPack() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->pack); }
- ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
+ const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
void getBoxShadowExtent(int &top, int &right, int &bottom, int &left) const;
void getBoxShadowHorizontalExtent(int &left, int &right) const;
void getBoxShadowVerticalExtent(int &top, int &bottom) const;
StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
- EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(box->boxSizing); }
+ EBoxSizing boxSizing() const { return m_box->boxSizing(); }
Length marqueeIncrement() const { return rareNonInheritedData->marquee->increment; }
int marqueeSpeed() const { return rareNonInheritedData->marquee->speed; }
int marqueeLoopCount() const { return rareNonInheritedData->marquee->loops; }
@@ -653,7 +663,7 @@ public:
bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
- const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color; }
+ const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
@@ -724,13 +734,13 @@ public:
void setTop(Length v) { SET_VAR(surround, offset.m_top, v) }
void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v) }
- void setWidth(Length v) { SET_VAR(box, width, v) }
- void setHeight(Length v) { SET_VAR(box, height, v) }
+ void setWidth(Length v) { SET_VAR(m_box, m_width, v) }
+ void setHeight(Length v) { SET_VAR(m_box, m_height, v) }
- void setMinWidth(Length v) { SET_VAR(box, min_width, v) }
- void setMaxWidth(Length v) { SET_VAR(box, max_width, v) }
- void setMinHeight(Length v) { SET_VAR(box, min_height, v) }
- void setMaxHeight(Length v) { SET_VAR(box, max_height, v) }
+ void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v) }
+ void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v) }
+ void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v) }
+ void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v) }
#if ENABLE(DASHBOARD_SUPPORT)
Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
@@ -752,32 +762,32 @@ public:
#endif
void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
- void resetBorderTop() { SET_VAR(surround, border.top, BorderValue()) }
- void resetBorderRight() { SET_VAR(surround, border.right, BorderValue()) }
- void resetBorderBottom() { SET_VAR(surround, border.bottom, BorderValue()) }
- void resetBorderLeft() { SET_VAR(surround, border.left, BorderValue()) }
- void resetBorderImage() { SET_VAR(surround, border.image, NinePieceImage()) }
+ void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()) }
+ void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()) }
+ void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()) }
+ void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()) }
+ void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()) }
void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
- void resetBorderTopLeftRadius() { SET_VAR(surround, border.topLeft, initialBorderRadius()) }
- void resetBorderTopRightRadius() { SET_VAR(surround, border.topRight, initialBorderRadius()) }
- void resetBorderBottomLeftRadius() { SET_VAR(surround, border.bottomLeft, initialBorderRadius()) }
- void resetBorderBottomRightRadius() { SET_VAR(surround, border.bottomRight, initialBorderRadius()) }
+ void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()) }
+ void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()) }
+ void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()) }
+ void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()) }
- void resetOutline() { SET_VAR(background, m_outline, OutlineValue()) }
+ void resetOutline() { SET_VAR(m_background, m_outline, OutlineValue()) }
- void setBackgroundColor(const Color& v) { SET_VAR(background, m_color, v) }
+ void setBackgroundColor(const Color& v) { SET_VAR(m_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(EFillSizeType b) { SET_VAR(background, m_background.m_sizeType, b) }
- void setBackgroundSizeLength(LengthSize l) { SET_VAR(background, m_background.m_sizeLength, l) }
+ void setBackgroundXPosition(Length l) { SET_VAR(m_background, m_background.m_xPosition, l) }
+ void setBackgroundYPosition(Length l) { SET_VAR(m_background, m_background.m_yPosition, l) }
+ void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b) }
+ void setBackgroundSizeLength(LengthSize l) { SET_VAR(m_background, m_background.m_sizeLength, l) }
- void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.image, b) }
+ void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
- void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.topLeft, s) }
- void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.topRight, s) }
- void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.bottomLeft, s) }
- void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.bottomRight, s) }
+ void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_topLeft, s) }
+ void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.m_topRight, s) }
+ void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomLeft, s) }
+ void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomRight, s) }
void setBorderRadius(const IntSize& s)
{
@@ -789,33 +799,33 @@ public:
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) }
- void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.left.color, v) }
- void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.right.width, v) }
- void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.right.m_style, v) }
- void setBorderRightColor(const Color& v) { SET_VAR(surround, border.right.color, v) }
- void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.top.width, v) }
- void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.top.m_style, v) }
- void setBorderTopColor(const Color& v) { SET_VAR(surround, border.top.color, v) }
- void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.bottom.width, v) }
- void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.bottom.m_style, v) }
- void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.bottom.color, v) }
- void setOutlineWidth(unsigned short v) { SET_VAR(background, m_outline.width, v) }
+ void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
+ void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) }
+ void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.m_left.m_color, v) }
+ void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.m_right.m_width, v) }
+ void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v) }
+ void setBorderRightColor(const Color& v) { SET_VAR(surround, border.m_right.m_color, v) }
+ void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.m_top.m_width, v) }
+ void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v) }
+ void setBorderTopColor(const Color& v) { SET_VAR(surround, border.m_top.m_color, v) }
+ void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.m_bottom.m_width, v) }
+ void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) }
+ void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) }
+ void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v) }
void setOutlineStyle(EBorderStyle v, bool isAuto = false)
{
- SET_VAR(background, m_outline.m_style, v)
- SET_VAR(background, m_outline._auto, isAuto)
+ SET_VAR(m_background, m_outline.m_style, v)
+ SET_VAR(m_background, m_outline.m_isAuto, isAuto)
}
- void setOutlineColor(const Color& v) { SET_VAR(background, m_outline.color, v) }
+ void setOutlineColor(const Color& v) { SET_VAR(m_background, m_outline.m_color, v) }
void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
- void setVerticalAlignLength(Length l) { SET_VAR(box, vertical_align, l) }
+ void setVerticalAlignLength(Length l) { SET_VAR(m_box, m_verticalAlign, l) }
void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
@@ -858,8 +868,8 @@ public:
void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
void setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
- void clearBackgroundLayers() { background.access()->m_background = FillLayer(BackgroundFillLayer); }
- void inheritBackgroundLayers(const FillLayer& parent) { background.access()->m_background = parent; }
+ void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
+ void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
void adjustBackgroundLayers()
{
@@ -916,16 +926,19 @@ public:
void setCursorList(PassRefPtr<CursorList>);
void clearCursorList();
+ void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
+ void setIsLink(bool b) { noninherited_flags._isLink = b; }
+
bool forceBackgroundsToWhite() const { return inherited_flags._force_backgrounds_to_white; }
void setForceBackgroundsToWhite(bool b=true) { inherited_flags._force_backgrounds_to_white = b; }
bool htmlHacks() const { return inherited_flags._htmlHacks; }
void setHtmlHacks(bool b=true) { inherited_flags._htmlHacks = b; }
- bool hasAutoZIndex() const { return box->z_auto; }
- void setHasAutoZIndex() { SET_VAR(box, z_auto, true); SET_VAR(box, z_index, 0) }
- int zIndex() const { return box->z_index; }
- void setZIndex(int v) { SET_VAR(box, z_auto, false); SET_VAR(box, z_index, v) }
+ bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
+ void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0) }
+ int zIndex() const { return m_box->zIndex(); }
+ void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) }
void setWidows(short w) { SET_VAR(inherited, widows, w); }
void setOrphans(short o) { SET_VAR(inherited, orphans, o); }
@@ -940,7 +953,7 @@ public:
void addBindingURI(StringImpl* uri);
#endif
- void setOutlineOffset(int v) { SET_VAR(background, m_outline._offset, v) }
+ void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
void setTextShadow(ShadowData* val, bool add=false);
void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
@@ -958,7 +971,7 @@ public:
void setBoxPack(EBoxAlignment p) { SET_VAR(rareNonInheritedData.access()->flexibleBox, pack, p); }
void setBoxShadow(ShadowData* val, bool add=false);
void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
- void setBoxSizing(EBoxSizing s) { SET_VAR(box, boxSizing, s); }
+ void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->marquee, increment, f); }
void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->marquee, speed, f); }
void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->marquee, direction, d); }
@@ -984,9 +997,9 @@ public:
void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
- void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.color, c); }
+ void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_color, c); }
void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
- void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.width, w); }
+ void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
void setColumnBreakInside(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
@@ -1077,10 +1090,6 @@ public:
originalDisplay() == INLINE_BOX || originalDisplay() == INLINE_TABLE;
}
- // To obtain at any time the pseudo state for a given link.
- PseudoState pseudoState() const { return static_cast<PseudoState>(m_pseudoState); }
- void setPseudoState(PseudoState s) { m_pseudoState = s; }
-
// To tell if this style matched attribute selectors. This makes it impossible to share.
bool affectedByAttributeSelectors() const { return m_affectedByAttributeSelectors; }
void setAffectedByAttributeSelectors() { m_affectedByAttributeSelectors = true; }
@@ -1110,6 +1119,8 @@ public:
unsigned childIndex() const { return m_childIndex; }
void setChildIndex(unsigned index) { m_childIndex = index; }
+ Color visitedDependentColor(int colorProperty) const;
+
// Initial values for all the properties
static bool initialBorderCollapse() { return false; }
static EBorderStyle initialBorderStyle() { return BNONE; }
diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h
index 4abbc1c..b899d57 100644
--- a/WebCore/rendering/style/RenderStyleConstants.h
+++ b/WebCore/rendering/style/RenderStyleConstants.h
@@ -74,8 +74,9 @@ enum PseudoId {
MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON,
MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON,
MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
- INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON,
+ INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK,
+ AFTER_LAST_INTERNAL_PSEUDOID,
FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON,
PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
@@ -87,8 +88,6 @@ enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, RIDGE, OUTSET, DOTTED, DASHED
enum EBorderPrecedence { BOFF, BTABLE, BCOLGROUP, BCOL, BROWGROUP, BROW, BCELL };
-enum PseudoState { PseudoUnknown, PseudoNone, PseudoAnyLink, PseudoLink, PseudoVisited};
-
enum EPosition {
StaticPosition, RelativePosition, AbsolutePosition, FixedPosition
};
@@ -97,7 +96,6 @@ enum EFloat {
FNONE = 0, FLEFT, FRIGHT
};
-
enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD };
// Box attributes. Not inherited.
@@ -293,6 +291,8 @@ enum StyleContentType {
enum EBorderFit { BorderFitBorder, BorderFitLines };
+enum EAnimationFillMode { AnimationFillModeNone, AnimationFillModeForwards, AnimationFillModeBackwards, AnimationFillModeBoth };
+
enum EAnimPlayState {
AnimPlayStatePlaying = 0x0,
AnimPlayStatePaused = 0x1
@@ -386,6 +386,10 @@ enum EDisplay {
NONE
};
+enum EInsideLink {
+ NotInsideLink, InsideUnvisitedLink, InsideVisitedLink
+};
+
enum EPointerEvents {
PE_NONE, PE_AUTO, PE_STROKE, PE_FILL, PE_PAINTED, PE_VISIBLE,
PE_VISIBLE_STROKE, PE_VISIBLE_FILL, PE_VISIBLE_PAINTED, PE_ALL
diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp
index 7958088..042b8f7 100644
--- a/WebCore/rendering/style/SVGRenderStyle.cpp
+++ b/WebCore/rendering/style/SVGRenderStyle.cpp
@@ -1,6 +1,7 @@
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
+ Copyright (C) Research In Motion Limited 2010. All rights reserved.
Based on khtml code by:
Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
@@ -25,6 +26,7 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGRenderStyle.h"
@@ -32,8 +34,6 @@
#include "CSSValueList.h"
#include "IntRect.h"
#include "NodeRenderStyle.h"
-#include "RenderObject.h"
-#include "RenderStyle.h"
#include "SVGStyledElement.h"
using namespace std;
@@ -48,11 +48,10 @@ SVGRenderStyle::SVGRenderStyle()
stroke = defaultStyle->stroke;
text = defaultStyle->text;
stops = defaultStyle->stops;
- clip = defaultStyle->clip;
- mask = defaultStyle->mask;
misc = defaultStyle->misc;
- markers = defaultStyle->markers;
shadowSVG = defaultStyle->shadowSVG;
+ inheritedResources = defaultStyle->inheritedResources;
+ resources = defaultStyle->resources;
setBitDefaults();
}
@@ -65,11 +64,10 @@ SVGRenderStyle::SVGRenderStyle(CreateDefaultType)
stroke.init();
text.init();
stops.init();
- clip.init();
- mask.init();
misc.init();
- markers.init();
shadowSVG.init();
+ inheritedResources.init();
+ resources.init();
}
SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other)
@@ -79,11 +77,10 @@ SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other)
stroke = other.stroke;
text = other.text;
stops = other.stops;
- clip = other.clip;
- mask = other.mask;
misc = other.misc;
- markers = other.markers;
shadowSVG = other.shadowSVG;
+ inheritedResources = other.inheritedResources;
+ resources = other.resources;
svg_inherited_flags = other.svg_inherited_flags;
svg_noninherited_flags = other.svg_noninherited_flags;
@@ -93,22 +90,27 @@ SVGRenderStyle::~SVGRenderStyle()
{
}
-bool SVGRenderStyle::operator==(const SVGRenderStyle& o) const
+bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const
{
- return (fill == o.fill && stroke == o.stroke && text == o.text &&
- stops == o.stops && clip == o.clip && mask == o.mask &&
- misc == o.misc && markers == o.markers && shadowSVG == o.shadowSVG &&
- svg_inherited_flags == o.svg_inherited_flags &&
- svg_noninherited_flags == o.svg_noninherited_flags);
+ return fill == other.fill
+ && stroke == other.stroke
+ && text == other.text
+ && stops == other.stops
+ && misc == other.misc
+ && shadowSVG == other.shadowSVG
+ && inheritedResources == other.inheritedResources
+ && resources == other.resources
+ && svg_inherited_flags == other.svg_inherited_flags
+ && svg_noninherited_flags == other.svg_noninherited_flags;
}
bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle* other) const
{
- return (fill != other->fill
- || stroke != other->stroke
- || markers != other->markers
- || text != other->text
- || svg_inherited_flags != other->svg_inherited_flags);
+ return fill != other->fill
+ || stroke != other->stroke
+ || text != other->text
+ || inheritedResources != other->inheritedResources
+ || svg_inherited_flags != other->svg_inherited_flags;
}
void SVGRenderStyle::inheritFrom(const SVGRenderStyle* svgInheritParent)
@@ -118,8 +120,8 @@ void SVGRenderStyle::inheritFrom(const SVGRenderStyle* svgInheritParent)
fill = svgInheritParent->fill;
stroke = svgInheritParent->stroke;
- markers = svgInheritParent->markers;
text = svgInheritParent->text;
+ inheritedResources = svgInheritParent->inheritedResources;
svg_inherited_flags = svgInheritParent->svg_inherited_flags;
}
@@ -144,7 +146,6 @@ float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* v
return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle());
}
-
static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bottom, int& left)
{
top = 0;
@@ -152,12 +153,12 @@ static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bo
bottom = 0;
left = 0;
- int blurAndSpread = shadow->blur + shadow->spread;
+ int blurAndSpread = shadow->blur() + shadow->spread();
- top = min(top, shadow->y - blurAndSpread);
- right = max(right, shadow->x + blurAndSpread);
- bottom = max(bottom, shadow->y + blurAndSpread);
- left = min(left, shadow->x - blurAndSpread);
+ top = min(top, shadow->y() - blurAndSpread);
+ right = max(right, shadow->x() + blurAndSpread);
+ bottom = max(bottom, shadow->y() + blurAndSpread);
+ left = min(left, shadow->x() - blurAndSpread);
}
void SVGRenderStyle::inflateForShadow(IntRect& repaintRect) const
@@ -197,5 +198,3 @@ void SVGRenderStyle::inflateForShadow(FloatRect& repaintRect) const
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h
index c7f85db..c6d5022 100644
--- a/WebCore/rendering/style/SVGRenderStyle.h
+++ b/WebCore/rendering/style/SVGRenderStyle.h
@@ -2,6 +2,7 @@
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
Copyright (C) 2005, 2006 Apple Computer, Inc.
+ Copyright (C) Research In Motion Limited 2010. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -26,11 +27,9 @@
#include "CSSValueList.h"
#include "DataRef.h"
#include "GraphicsTypes.h"
+#include "Path.h"
#include "SVGPaint.h"
#include "SVGRenderStyleDefs.h"
-#include "ShadowData.h"
-
-#include <wtf/Platform.h>
namespace WebCore {
@@ -91,13 +90,6 @@ public:
SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stops, opacity, StopOpacity, stopOpacity, 1.0f)
SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, stops, color, StopColor, stopColor, Color(0, 0, 0))
- SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, clip, clipPath, ClipPath, clipPath, String())
- SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, mask, maskElement, MaskElement, maskElement, String())
- SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, startMarker, StartMarker, startMarker, String())
- SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, midMarker, MidMarker, midMarker, String())
- SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, endMarker, EndMarker, endMarker, String())
-
- SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, misc, filter, Filter, filter, String())
SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, misc, floodOpacity, FloodOpacity, floodOpacity, 1.0f)
SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, floodColor, FloodColor, floodColor, Color(0, 0, 0))
SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255))
@@ -105,6 +97,16 @@ public:
SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0)
+ // Non-inherited resources
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, clipper, ClipperResource, clipperResource, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, filter, FilterResource, filterResource, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, masker, MaskerResource, maskerResource, String())
+
+ // Inherited resources
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerStart, MarkerStartResource, markerStartResource, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerMid, MarkerMidResource, markerMidResource, String())
+ SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerEnd, MarkerEndResource, markerEndResource, String())
+
// convenience
bool hasStroke() const { return (strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); }
bool hasFill() const { return (fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); }
@@ -171,15 +173,14 @@ protected:
// inherited attributes
DataRef<StyleFillData> fill;
DataRef<StyleStrokeData> stroke;
- DataRef<StyleMarkerData> markers;
DataRef<StyleTextData> text;
+ DataRef<StyleInheritedResourceData> inheritedResources;
// non-inherited attributes
DataRef<StyleStopData> stops;
- DataRef<StyleClipData> clip;
- DataRef<StyleMaskData> mask;
DataRef<StyleMiscData> misc;
DataRef<StyleShadowSVGData> shadowSVG;
+ DataRef<StyleResourceData> resources;
private:
enum CreateDefaultType { CreateDefault };
@@ -215,5 +216,3 @@ private:
#endif // ENABLE(SVG)
#endif // SVGRenderStyle_h
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/WebCore/rendering/style/SVGRenderStyleDefs.cpp
index 093f1f1..bf7624f 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.cpp
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.cpp
@@ -1,6 +1,7 @@
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
+ Copyright (C) Research In Motion Limited 2010. All rights reserved.
Based on khtml code by:
Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
@@ -25,28 +26,29 @@
*/
#include "config.h"
+
#if ENABLE(SVG)
#include "SVGRenderStyleDefs.h"
#include "RenderStyle.h"
#include "SVGRenderStyle.h"
-using namespace WebCore;
+namespace WebCore {
StyleFillData::StyleFillData()
+ : opacity(SVGRenderStyle::initialFillOpacity())
+ , paint(SVGRenderStyle::initialFillPaint())
{
- paint = SVGRenderStyle::initialFillPaint();
- opacity = SVGRenderStyle::initialFillOpacity();
}
StyleFillData::StyleFillData(const StyleFillData& other)
: RefCounted<StyleFillData>()
+ , opacity(other.opacity)
+ , paint(other.paint)
{
- paint = other.paint;
- opacity = other.opacity;
}
-bool StyleFillData::operator==(const StyleFillData &other) const
+bool StyleFillData::operator==(const StyleFillData& other) const
{
if (opacity != other.opacity)
return false;
@@ -67,64 +69,64 @@ bool StyleFillData::operator==(const StyleFillData &other) const
}
StyleStrokeData::StyleStrokeData()
+ : opacity(SVGRenderStyle::initialStrokeOpacity())
+ , miterLimit(SVGRenderStyle::initialStrokeMiterLimit())
+ , width(SVGRenderStyle::initialStrokeWidth())
+ , dashOffset(SVGRenderStyle::initialStrokeDashOffset())
+ , paint(SVGRenderStyle::initialStrokePaint())
+ , dashArray(SVGRenderStyle::initialStrokeDashArray())
{
- width = SVGRenderStyle::initialStrokeWidth();
- paint = SVGRenderStyle::initialStrokePaint();
- opacity = SVGRenderStyle::initialStrokeOpacity();
- miterLimit = SVGRenderStyle::initialStrokeMiterLimit();
- dashOffset = SVGRenderStyle::initialStrokeDashOffset();
- dashArray = SVGRenderStyle::initialStrokeDashArray();
}
StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
: RefCounted<StyleStrokeData>()
+ , opacity(other.opacity)
+ , miterLimit(other.miterLimit)
+ , width(other.width)
+ , dashOffset(other.dashOffset)
+ , paint(other.paint)
+ , dashArray(other.dashArray)
{
- width = other.width;
- paint = other.paint;
- opacity = other.opacity;
- miterLimit = other.miterLimit;
- dashOffset = other.dashOffset;
- dashArray = other.dashArray;
}
-bool StyleStrokeData::operator==(const StyleStrokeData &other) const
+bool StyleStrokeData::operator==(const StyleStrokeData& other) const
{
- return (paint == other.paint) &&
- (width == other.width) &&
- (opacity == other.opacity) &&
- (miterLimit == other.miterLimit) &&
- (dashOffset == other.dashOffset) &&
- (dashArray == other.dashArray);
+ return paint == other.paint
+ && width == other.width
+ && opacity == other.opacity
+ && miterLimit == other.miterLimit
+ && dashOffset == other.dashOffset
+ && dashArray == other.dashArray;
}
StyleStopData::StyleStopData()
+ : opacity(SVGRenderStyle::initialStopOpacity())
+ , color(SVGRenderStyle::initialStopColor())
{
- color = SVGRenderStyle::initialStopColor();
- opacity = SVGRenderStyle::initialStopOpacity();
}
StyleStopData::StyleStopData(const StyleStopData& other)
: RefCounted<StyleStopData>()
+ , opacity(other.opacity)
+ , color(other.color)
{
- color = other.color;
- opacity = other.opacity;
}
-bool StyleStopData::operator==(const StyleStopData &other) const
+bool StyleStopData::operator==(const StyleStopData& other) const
{
- return (color == other.color) &&
- (opacity == other.opacity);
+ return color == other.color
+ && opacity == other.opacity;
}
StyleTextData::StyleTextData()
+ : kerning(SVGRenderStyle::initialKerning())
{
- kerning = SVGRenderStyle::initialKerning();
}
StyleTextData::StyleTextData(const StyleTextData& other)
: RefCounted<StyleTextData>()
+ , kerning(other.kerning)
{
- kerning = other.kerning;
}
bool StyleTextData::operator==(const StyleTextData& other) const
@@ -132,104 +134,94 @@ bool StyleTextData::operator==(const StyleTextData& other) const
return kerning == other.kerning;
}
-StyleClipData::StyleClipData()
-{
- clipPath = SVGRenderStyle::initialClipPath();
-}
-
-StyleClipData::StyleClipData(const StyleClipData& other)
- : RefCounted<StyleClipData>()
-{
- clipPath = other.clipPath;
-}
-
-bool StyleClipData::operator==(const StyleClipData &other) const
+StyleMiscData::StyleMiscData()
+ : floodColor(SVGRenderStyle::initialFloodColor())
+ , floodOpacity(SVGRenderStyle::initialFloodOpacity())
+ , lightingColor(SVGRenderStyle::initialLightingColor())
+ , baselineShiftValue(SVGRenderStyle::initialBaselineShiftValue())
{
- return (clipPath == other.clipPath);
}
-StyleMaskData::StyleMaskData()
+StyleMiscData::StyleMiscData(const StyleMiscData& other)
+ : RefCounted<StyleMiscData>()
+ , floodColor(other.floodColor)
+ , floodOpacity(other.floodOpacity)
+ , lightingColor(other.lightingColor)
+ , baselineShiftValue(other.baselineShiftValue)
{
- maskElement = SVGRenderStyle::initialMaskElement();
}
-StyleMaskData::StyleMaskData(const StyleMaskData& other)
- : RefCounted<StyleMaskData>()
+bool StyleMiscData::operator==(const StyleMiscData& other) const
{
- maskElement = other.maskElement;
+ return floodOpacity == other.floodOpacity
+ && floodColor == other.floodColor
+ && lightingColor == other.lightingColor
+ && baselineShiftValue == other.baselineShiftValue;
}
-bool StyleMaskData::operator==(const StyleMaskData &other) const
+StyleShadowSVGData::StyleShadowSVGData()
{
- return (maskElement == other.maskElement);
}
-StyleMarkerData::StyleMarkerData()
+StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other)
+ : RefCounted<StyleShadowSVGData>()
+ , shadow(other.shadow ? new ShadowData(*other.shadow) : 0)
{
- startMarker = SVGRenderStyle::initialStartMarker();
- midMarker = SVGRenderStyle::initialMidMarker();
- endMarker = SVGRenderStyle::initialEndMarker();
}
-StyleMarkerData::StyleMarkerData(const StyleMarkerData& other)
- : RefCounted<StyleMarkerData>()
+bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const
{
- startMarker = other.startMarker;
- midMarker = other.midMarker;
- endMarker = other.endMarker;
+ if ((!shadow && other.shadow) || (shadow && !other.shadow))
+ return false;
+ if (shadow && other.shadow && (*shadow != *other.shadow))
+ return false;
+ return true;
}
-bool StyleMarkerData::operator==(const StyleMarkerData &other) const
+StyleResourceData::StyleResourceData()
+ : clipper(SVGRenderStyle::initialClipperResource())
+ , filter(SVGRenderStyle::initialFilterResource())
+ , masker(SVGRenderStyle::initialMaskerResource())
{
- return (startMarker == other.startMarker && midMarker == other.midMarker && endMarker == other.endMarker);
}
-StyleMiscData::StyleMiscData()
+StyleResourceData::StyleResourceData(const StyleResourceData& other)
+ : RefCounted<StyleResourceData>()
+ , clipper(other.clipper)
+ , filter(other.filter)
+ , masker(other.masker)
{
- floodColor = SVGRenderStyle::initialFloodColor();
- floodOpacity = SVGRenderStyle::initialFloodOpacity();
- lightingColor = SVGRenderStyle::initialLightingColor();
- baselineShiftValue = SVGRenderStyle::initialBaselineShiftValue();
}
-StyleMiscData::StyleMiscData(const StyleMiscData& other)
- : RefCounted<StyleMiscData>()
+bool StyleResourceData::operator==(const StyleResourceData& other) const
{
- filter = other.filter;
- floodColor = other.floodColor;
- floodOpacity = other.floodOpacity;
- lightingColor = other.lightingColor;
- baselineShiftValue = other.baselineShiftValue;
+ return clipper == other.clipper
+ && filter == other.filter
+ && masker == other.masker;
}
-bool StyleMiscData::operator==(const StyleMiscData &other) const
+StyleInheritedResourceData::StyleInheritedResourceData()
+ : markerStart(SVGRenderStyle::initialMarkerStartResource())
+ , markerMid(SVGRenderStyle::initialMarkerMidResource())
+ , markerEnd(SVGRenderStyle::initialMarkerEndResource())
{
- return filter == other.filter
- && floodOpacity == other.floodOpacity
- && floodColor == other.floodColor
- && lightingColor == other.lightingColor
- && baselineShiftValue == other.baselineShiftValue;
}
-StyleShadowSVGData::StyleShadowSVGData()
+StyleInheritedResourceData::StyleInheritedResourceData(const StyleInheritedResourceData& other)
+ : RefCounted<StyleInheritedResourceData>()
+ , markerStart(other.markerStart)
+ , markerMid(other.markerMid)
+ , markerEnd(other.markerEnd)
{
}
-StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other)
- : RefCounted<StyleShadowSVGData>()
- , shadow(other.shadow ? new ShadowData(*other.shadow) : 0)
+bool StyleInheritedResourceData::operator==(const StyleInheritedResourceData& other) const
{
+ return markerStart == other.markerStart
+ && markerMid == other.markerMid
+ && markerEnd == other.markerEnd;
}
-bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const
-{
- if ((!shadow && other.shadow) || (shadow && !other.shadow))
- return false;
- if (shadow && other.shadow && (*shadow != *other.shadow))
- return false;
- return true;
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h
index 8f01d9f..e0354e6 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.h
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.h
@@ -1,6 +1,7 @@
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
+ Copyright (C) Research In Motion Limited 2010. All rights reserved.
Based on khtml code by:
Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org)
@@ -29,11 +30,9 @@
#if ENABLE(SVG)
#include "Color.h"
-#include "Path.h"
#include "PlatformString.h"
#include "ShadowData.h"
#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -133,8 +132,8 @@ namespace WebCore {
static PassRefPtr<StyleFillData> create() { return adoptRef(new StyleFillData); }
PassRefPtr<StyleFillData> copy() const { return adoptRef(new StyleFillData(*this)); }
- bool operator==(const StyleFillData &other) const;
- bool operator!=(const StyleFillData &other) const
+ bool operator==(const StyleFillData&) const;
+ bool operator!=(const StyleFillData& other) const
{
return !(*this == other);
}
@@ -177,8 +176,8 @@ namespace WebCore {
static PassRefPtr<StyleStopData> create() { return adoptRef(new StyleStopData); }
PassRefPtr<StyleStopData> copy() const { return adoptRef(new StyleStopData(*this)); }
- bool operator==(const StyleStopData &other) const;
- bool operator!=(const StyleStopData &other) const
+ bool operator==(const StyleStopData&) const;
+ bool operator!=(const StyleStopData& other) const
{
return !(*this == other);
}
@@ -206,109 +205,94 @@ namespace WebCore {
private:
StyleTextData();
- StyleTextData(const StyleTextData& other);
+ StyleTextData(const StyleTextData&);
};
- class StyleClipData : public RefCounted<StyleClipData> {
+ // Note: the rule for this class is, *no inheritance* of these props
+ class StyleMiscData : public RefCounted<StyleMiscData> {
public:
- static PassRefPtr<StyleClipData> create() { return adoptRef(new StyleClipData); }
- PassRefPtr<StyleClipData> copy() const { return adoptRef(new StyleClipData(*this)); }
+ static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
+ PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
- bool operator==(const StyleClipData &other) const;
- bool operator!=(const StyleClipData &other) const
+ bool operator==(const StyleMiscData&) const;
+ bool operator!=(const StyleMiscData& other) const
{
return !(*this == other);
}
- String clipPath;
-
- private:
- StyleClipData();
- StyleClipData(const StyleClipData&);
- };
-
- class StyleMaskData : public RefCounted<StyleMaskData> {
- public:
- static PassRefPtr<StyleMaskData> create() { return adoptRef(new StyleMaskData); }
- PassRefPtr<StyleMaskData> copy() const { return adoptRef(new StyleMaskData(*this)); }
-
- bool operator==(const StyleMaskData &other) const;
- bool operator!=(const StyleMaskData &other) const { return !(*this == other); }
+ Color floodColor;
+ float floodOpacity;
+ Color lightingColor;
- String maskElement;
+ // non-inherited text stuff lives here not in StyleTextData.
+ RefPtr<CSSValue> baselineShiftValue;
- private:
- StyleMaskData();
- StyleMaskData(const StyleMaskData&);
+ private:
+ StyleMiscData();
+ StyleMiscData(const StyleMiscData&);
};
- class StyleMarkerData : public RefCounted<StyleMarkerData> {
+ class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> {
public:
- static PassRefPtr<StyleMarkerData> create() { return adoptRef(new StyleMarkerData); }
- PassRefPtr<StyleMarkerData> copy() const { return adoptRef(new StyleMarkerData(*this)); }
+ static PassRefPtr<StyleShadowSVGData> create() { return adoptRef(new StyleShadowSVGData); }
+ PassRefPtr<StyleShadowSVGData> copy() const { return adoptRef(new StyleShadowSVGData(*this)); }
- bool operator==(const StyleMarkerData &other) const;
- bool operator!=(const StyleMarkerData &other) const
+ bool operator==(const StyleShadowSVGData&) const;
+ bool operator!=(const StyleShadowSVGData& other) const
{
return !(*this == other);
}
- String startMarker;
- String midMarker;
- String endMarker;
+ OwnPtr<ShadowData> shadow;
private:
- StyleMarkerData();
- StyleMarkerData(const StyleMarkerData&);
+ StyleShadowSVGData();
+ StyleShadowSVGData(const StyleShadowSVGData&);
};
- // Note : the rule for this class is, *no inheritance* of these props
- class StyleMiscData : public RefCounted<StyleMiscData> {
+ // Non-inherited resources
+ class StyleResourceData : public RefCounted<StyleResourceData> {
public:
- static PassRefPtr<StyleMiscData> create() { return adoptRef(new StyleMiscData); }
- PassRefPtr<StyleMiscData> copy() const { return adoptRef(new StyleMiscData(*this)); }
+ static PassRefPtr<StyleResourceData> create() { return adoptRef(new StyleResourceData); }
+ PassRefPtr<StyleResourceData> copy() const { return adoptRef(new StyleResourceData(*this)); }
- bool operator==(const StyleMiscData &other) const;
- bool operator!=(const StyleMiscData &other) const
+ bool operator==(const StyleResourceData&) const;
+ bool operator!=(const StyleResourceData& other) const
{
return !(*this == other);
}
+ String clipper;
String filter;
- Color floodColor;
- float floodOpacity;
-
- Color lightingColor;
-
- // non-inherited text stuff lives here not in StyleTextData.
- RefPtr<CSSValue> baselineShiftValue;
+ String masker;
private:
- StyleMiscData();
- StyleMiscData(const StyleMiscData&);
+ StyleResourceData();
+ StyleResourceData(const StyleResourceData&);
};
-
- class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> {
+
+ // Inherited resources
+ class StyleInheritedResourceData : public RefCounted<StyleInheritedResourceData> {
public:
- static PassRefPtr<StyleShadowSVGData> create() { return adoptRef(new StyleShadowSVGData); }
- PassRefPtr<StyleShadowSVGData> copy() const { return adoptRef(new StyleShadowSVGData(*this)); }
-
- bool operator==(const StyleShadowSVGData& other) const;
- bool operator!=(const StyleShadowSVGData& other) const
+ static PassRefPtr<StyleInheritedResourceData> create() { return adoptRef(new StyleInheritedResourceData); }
+ PassRefPtr<StyleInheritedResourceData> copy() const { return adoptRef(new StyleInheritedResourceData(*this)); }
+
+ bool operator==(const StyleInheritedResourceData&) const;
+ bool operator!=(const StyleInheritedResourceData& other) const
{
return !(*this == other);
}
- OwnPtr<ShadowData> shadow;
+ String markerStart;
+ String markerMid;
+ String markerEnd;
private:
- StyleShadowSVGData();
- StyleShadowSVGData(const StyleShadowSVGData& other);
+ StyleInheritedResourceData();
+ StyleInheritedResourceData(const StyleInheritedResourceData&);
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // SVGRenderStyleDefs_h
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/style/ShadowData.cpp b/WebCore/rendering/style/ShadowData.cpp
index 1954224..d4569d0 100644
--- a/WebCore/rendering/style/ShadowData.cpp
+++ b/WebCore/rendering/style/ShadowData.cpp
@@ -25,23 +25,23 @@
namespace WebCore {
ShadowData::ShadowData(const ShadowData& o)
- : x(o.x)
- , y(o.y)
- , blur(o.blur)
- , spread(o.spread)
- , style(o.style)
- , color(o.color)
+ : m_x(o.m_x)
+ , m_y(o.m_y)
+ , m_blur(o.m_blur)
+ , m_spread(o.m_spread)
+ , m_style(o.m_style)
+ , m_color(o.m_color)
{
- next = o.next ? new ShadowData(*o.next) : 0;
+ m_next = o.m_next ? new ShadowData(*o.m_next) : 0;
}
bool ShadowData::operator==(const ShadowData& o) const
{
- if ((next && !o.next) || (!next && o.next) ||
- (next && o.next && *next != *o.next))
+ if ((m_next && !o.m_next) || (!m_next && o.m_next) ||
+ (m_next && o.m_next && *m_next != *o.m_next))
return false;
- return x == o.x && y == o.y && blur == o.blur && spread == o.spread && style == o.style && color == o.color;
+ return m_x == o.m_x && m_y == o.m_y && m_blur == o.m_blur && m_spread == o.m_spread && m_style == o.m_style && m_color == o.m_color;
}
} // namespace WebCore
diff --git a/WebCore/rendering/style/ShadowData.h b/WebCore/rendering/style/ShadowData.h
index 089cf77..9252e13 100644
--- a/WebCore/rendering/style/ShadowData.h
+++ b/WebCore/rendering/style/ShadowData.h
@@ -34,31 +34,31 @@ enum ShadowStyle { Normal, Inset };
// This struct holds information about shadows for the text-shadow and box-shadow properties.
-struct ShadowData : FastAllocBase {
+class ShadowData : public FastAllocBase {
+public:
ShadowData()
- : x(0)
- , y(0)
- , blur(0)
- , spread(0)
- , style(Normal)
- , next(0)
+ : m_x(0)
+ , m_y(0)
+ , m_blur(0)
+ , m_spread(0)
+ , m_style(Normal)
+ , m_next(0)
{
}
ShadowData(int x, int y, int blur, int spread, ShadowStyle style, const Color& color)
- : x(x)
- , y(y)
- , blur(blur)
- , spread(spread)
- , style(style)
- , color(color)
- , next(0)
+ : m_x(x)
+ , m_y(y)
+ , m_blur(blur)
+ , m_spread(spread)
+ , m_style(style)
+ , m_color(color)
+ , m_next(0)
{
}
ShadowData(const ShadowData& o);
-
- ~ShadowData() { delete next; }
+ ~ShadowData() { delete m_next; }
bool operator==(const ShadowData& o) const;
bool operator!=(const ShadowData& o) const
@@ -66,13 +66,24 @@ struct ShadowData : FastAllocBase {
return !(*this == o);
}
- int x;
- int y;
- int blur;
- int spread;
- ShadowStyle style;
- Color color;
- ShadowData* next;
+ int x() const { return m_x; }
+ int y() const { return m_y; }
+ int blur() const { return m_blur; }
+ int spread() const { return m_spread; }
+ ShadowStyle style() const { return m_style; }
+ const Color& color() const { return m_color; }
+
+ const ShadowData* next() const { return m_next; }
+ void setNext(ShadowData* shadow) { m_next = shadow; }
+
+private:
+ int m_x;
+ int m_y;
+ int m_blur;
+ int m_spread;
+ ShadowStyle m_style;
+ Color m_color;
+ ShadowData* m_next;
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/StyleBackgroundData.h b/WebCore/rendering/style/StyleBackgroundData.h
index 8f2da36..48a700e 100644
--- a/WebCore/rendering/style/StyleBackgroundData.h
+++ b/WebCore/rendering/style/StyleBackgroundData.h
@@ -45,13 +45,19 @@ public:
return !(*this == o);
}
- FillLayer m_background;
- Color m_color;
- OutlineValue m_outline;
+ const FillLayer& background() const { return m_background; }
+ const Color& color() const { return m_color; }
+ const OutlineValue& outline() const { return m_outline; }
private:
+ friend class RenderStyle;
+
StyleBackgroundData();
- StyleBackgroundData(const StyleBackgroundData&);
+ StyleBackgroundData(const StyleBackgroundData&);
+
+ FillLayer m_background;
+ Color m_color;
+ OutlineValue m_outline;
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/StyleBoxData.cpp b/WebCore/rendering/style/StyleBoxData.cpp
index d9734d1..2c523da 100644
--- a/WebCore/rendering/style/StyleBoxData.cpp
+++ b/WebCore/rendering/style/StyleBoxData.cpp
@@ -28,40 +28,41 @@
namespace WebCore {
StyleBoxData::StyleBoxData()
- : z_index(0)
- , z_auto(true)
- , boxSizing(CONTENT_BOX)
+ : m_minWidth(RenderStyle::initialMinSize())
+ , m_maxWidth(RenderStyle::initialMaxSize())
+ , m_minHeight(RenderStyle::initialMinSize())
+ , m_maxHeight(RenderStyle::initialMaxSize())
+ , m_zIndex(0)
+ , m_hasAutoZIndex(true)
+ , m_boxSizing(CONTENT_BOX)
{
- // Initialize our min/max widths/heights.
- min_width = min_height = RenderStyle::initialMinSize();
- max_width = max_height = RenderStyle::initialMaxSize();
}
StyleBoxData::StyleBoxData(const StyleBoxData& o)
: RefCounted<StyleBoxData>()
- , width(o.width)
- , height(o.height)
- , min_width(o.min_width)
- , max_width(o.max_width)
- , min_height(o.min_height)
- , max_height(o.max_height)
- , z_index(o.z_index)
- , z_auto(o.z_auto)
- , boxSizing(o.boxSizing)
+ , m_width(o.m_width)
+ , m_height(o.m_height)
+ , m_minWidth(o.m_minWidth)
+ , m_maxWidth(o.m_maxWidth)
+ , m_minHeight(o.m_minHeight)
+ , m_maxHeight(o.m_maxHeight)
+ , m_zIndex(o.m_zIndex)
+ , m_hasAutoZIndex(o.m_hasAutoZIndex)
+ , m_boxSizing(o.m_boxSizing)
{
}
bool StyleBoxData::operator==(const StyleBoxData& o) const
{
- return width == o.width &&
- height == o.height &&
- min_width == o.min_width &&
- max_width == o.max_width &&
- min_height == o.min_height &&
- max_height == o.max_height &&
- z_index == o.z_index &&
- z_auto == o.z_auto &&
- boxSizing == o.boxSizing;
+ return m_width == o.m_width
+ && m_height == o.m_height
+ && m_minWidth == o.m_minWidth
+ && m_maxWidth == o.m_maxWidth
+ && m_minHeight == o.m_minHeight
+ && m_maxHeight == o.m_maxHeight
+ && m_zIndex == o.m_zIndex
+ && m_hasAutoZIndex == o.m_hasAutoZIndex
+ && m_boxSizing == o.m_boxSizing;
}
} // namespace WebCore
diff --git a/WebCore/rendering/style/StyleBoxData.h b/WebCore/rendering/style/StyleBoxData.h
index a5bd2ff..00bce4e 100644
--- a/WebCore/rendering/style/StyleBoxData.h
+++ b/WebCore/rendering/style/StyleBoxData.h
@@ -26,6 +26,7 @@
#define StyleBoxData_h
#include "Length.h"
+#include "RenderStyleConstants.h"
#include <wtf/RefCounted.h>
#include <wtf/PassRefPtr.h>
@@ -42,24 +43,42 @@ public:
return !(*this == o);
}
- Length width;
- Length height;
-
- Length min_width;
- Length max_width;
-
- Length min_height;
- Length max_height;
-
- Length vertical_align;
-
- int z_index;
- bool z_auto : 1;
- unsigned boxSizing : 1; // EBoxSizing
+ Length width() const { return m_width; }
+ Length height() const { return m_height; }
+
+ Length minWidth() const { return m_minWidth; }
+ Length minHeight() const { return m_minHeight; }
+
+ Length maxWidth() const { return m_maxWidth; }
+ Length maxHeight() const { return m_maxHeight; }
+
+ Length verticalAlign() const { return m_verticalAlign; }
+
+ int zIndex() const { return m_zIndex; }
+ bool hasAutoZIndex() const { return m_hasAutoZIndex; }
+ EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(m_boxSizing); }
+
private:
+ friend class RenderStyle;
+
StyleBoxData();
StyleBoxData(const StyleBoxData&);
+
+ Length m_width;
+ Length m_height;
+
+ Length m_minWidth;
+ Length m_maxWidth;
+
+ Length m_minHeight;
+ Length m_maxHeight;
+
+ Length m_verticalAlign;
+
+ int m_zIndex;
+ bool m_hasAutoZIndex : 1;
+ unsigned m_boxSizing : 1; // EBoxSizing
};
} // namespace WebCore
diff --git a/WebCore/rendering/style/StyleMultiColData.h b/WebCore/rendering/style/StyleMultiColData.h
index dec0a55..d3fe720 100644
--- a/WebCore/rendering/style/StyleMultiColData.h
+++ b/WebCore/rendering/style/StyleMultiColData.h
@@ -50,7 +50,7 @@ public:
{
if (m_rule.style() == BNONE || m_rule.style() == BHIDDEN)
return 0;
- return m_rule.width;
+ return m_rule.width();
}
float m_width;