Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (97044 => 97045)
--- trunk/Source/_javascript_Core/ChangeLog 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-10-10 07:50:48 UTC (rev 97045)
@@ -1,3 +1,12 @@
+2011-10-10 Andreas Kling <kl...@webkit.org>
+
+ Shrink BorderValue.
+ https://bugs.webkit.org/show_bug.cgi?id=69521
+
+ Reviewed by Antti Koivisto.
+
+ * config.h: Touch to force full rebuild.
+
2011-10-09 Yuqiang Xian <yuqiang.x...@intel.com>
Improve Null or Undefined test in 32_64 DFG
Modified: trunk/Source/_javascript_Core/config.h (97044 => 97045)
--- trunk/Source/_javascript_Core/config.h 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/_javascript_Core/config.h 2011-10-10 07:50:48 UTC (rev 97045)
@@ -109,7 +109,7 @@
// this breaks compilation of <QFontDatabase>, at least, so turn it off for now
// Also generates errors on wx on Windows and QNX, because these functions
-// are used from wx and QNX headers.
+// are used from wx and QNX headers.
#if !PLATFORM(QT) && !PLATFORM(WX) && !OS(QNX)
#include <wtf/DisallowCType.h>
#endif
Modified: trunk/Source/WebCore/ChangeLog (97044 => 97045)
--- trunk/Source/WebCore/ChangeLog 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/ChangeLog 2011-10-10 07:50:48 UTC (rev 97045)
@@ -1,3 +1,77 @@
+2011-10-06 Andreas Kling <kl...@webkit.org>
+
+ Shrink BorderValue.
+ https://bugs.webkit.org/show_bug.cgi?id=69521
+
+ Reviewed by Antti Koivisto.
+
+ Unroll BorderValue's Color member so we can pack the color's validity flag
+ in BorderValue's bitfield.
+
+ This shrinks BorderValue by 32 bit, which in turn shrinks BorderData by
+ 16 bytes. This reduces memory consumption by 760 kB when loading the full
+ HTML5 spec.
+
+ * platform/graphics/Color.h:
+ (WebCore::Color::Color):
+
+ Allow construction of Color objects with specific validity.
+
+ * rendering/style/BorderValue.h:
+ (WebCore::BorderValue::BorderValue):
+ (WebCore::BorderValue::isTransparent):
+ (WebCore::BorderValue::operator==):
+ (WebCore::BorderValue::setColor):
+ (WebCore::BorderValue::color):
+ * rendering/style/OutlineValue.h:
+ (WebCore::OutlineValue::operator==):
+
+ Unroll m_color into BorderValue by splitting it into an RGBA32 and a bool.
+ Made those variables private and added color(), setColor() accessors.
+
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::setBorderLeftColor):
+ (WebCore::InheritedFlags::setBorderRightColor):
+ (WebCore::InheritedFlags::setBorderTopColor):
+ (WebCore::InheritedFlags::setBorderBottomColor):
+ (WebCore::InheritedFlags::setOutlineColor):
+ (WebCore::InheritedFlags::setColumnRuleColor):
+
+ Added a SET_BORDERVALUE_COLOR macro and use that instead of SET_VAR
+ when setting BorderValue colors.
+
+ (WebCore::InheritedFlags::fillPaintColor):
+ (WebCore::InheritedFlags::strokePaintColor):
+ (WebCore::InheritedFlags::borderLeftColor):
+ (WebCore::InheritedFlags::borderRightColor):
+ (WebCore::InheritedFlags::borderTopColor):
+ (WebCore::InheritedFlags::borderBottomColor):
+ (WebCore::InheritedFlags::backgroundColor):
+ (WebCore::InheritedFlags::color):
+ (WebCore::InheritedFlags::columnRuleColor):
+ (WebCore::InheritedFlags::outlineColor):
+ (WebCore::InheritedFlags::textEmphasisColor):
+ (WebCore::InheritedFlags::textFillColor):
+ (WebCore::InheritedFlags::textStrokeColor):
+ (WebCore::InheritedFlags::stopColor):
+ (WebCore::InheritedFlags::floodColor):
+ (WebCore::InheritedFlags::lightingColor):
+
+ Made color getters return "Color" instead of "const Color&" since
+ BorderValue no longer has an actual object to return the reference to.
+
+ * css/CSSStyleApplyProperty.cpp:
+ (WebCore::ApplyPropertyColor::applyInheritValue):
+ * page/animation/AnimationBase.cpp:
+ (WebCore::PropertyWrapperColor::PropertyWrapperColor):
+ (WebCore::PropertyWrapperColor::blend):
+ (WebCore::PropertyWrapperMaybeInvalidColor::PropertyWrapperMaybeInvalidColor):
+ (WebCore::PropertyWrapperSVGPaint::PropertyWrapperSVGPaint):
+ (WebCore::AnimationBase::ensurePropertyMap):
+
+ Adapt to RenderStyle color getters now returning "Color" instead of
+ "const Color&".
+
2011-10-09 Yury Semikhatsky <yu...@chromium.org>
Missing m_notificationPresenter initialization in WorkerThread constructor
Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (97044 => 97045)
--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-10-10 07:50:48 UTC (rev 97045)
@@ -219,9 +219,9 @@
template <ColorInherit inheritColorFromParent>
class ApplyPropertyColor : public ApplyPropertyBase {
public:
- typedef const Color& (RenderStyle::*GetterFunction)() const;
+ typedef Color (RenderStyle::*GetterFunction)() const;
typedef void (RenderStyle::*SetterFunction)(const Color&);
- typedef const Color& (RenderStyle::*DefaultFunction)() const;
+ typedef Color (RenderStyle::*DefaultFunction)() const;
typedef Color (*InitialFunction)();
ApplyPropertyColor(GetterFunction getter, SetterFunction setter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
@@ -235,7 +235,7 @@
private:
virtual void applyInheritValue(CSSStyleSelector* selector) const
{
- const Color& color = (selector->parentStyle()->*m_getter)();
+ const Color color = (selector->parentStyle()->*m_getter)();
if (m_default && !color.isValid())
(selector->style()->*m_setter)((selector->parentStyle()->*m_default)());
else
Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (97044 => 97045)
--- trunk/Source/WebCore/page/animation/AnimationBase.cpp 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp 2011-10-10 07:50:48 UTC (rev 97045)
@@ -295,6 +295,23 @@
void (RenderStyle::*m_setter)(T);
};
+class PropertyWrapperColor : public PropertyWrapperGetter<Color> {
+public:
+ PropertyWrapperColor(int prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+ : PropertyWrapperGetter<Color>(prop, getter)
+ , m_setter(setter)
+ {
+ }
+
+ virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+ {
+ (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<Color>::m_getter)(), (b->*PropertyWrapperGetter<Color>::m_getter)(), progress));
+ }
+
+protected:
+ void (RenderStyle::*m_setter)(const Color&);
+};
+
#if USE(ACCELERATED_COMPOSITING)
class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
public:
@@ -470,7 +487,7 @@
class PropertyWrapperMaybeInvalidColor : public PropertyWrapperBase {
public:
- PropertyWrapperMaybeInvalidColor(int prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+ PropertyWrapperMaybeInvalidColor(int prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
: PropertyWrapperBase(prop)
, m_getter(getter)
, m_setter(setter)
@@ -509,7 +526,7 @@
}
private:
- const Color& (RenderStyle::*m_getter)() const;
+ Color (RenderStyle::*m_getter)() const;
void (RenderStyle::*m_setter)(const Color&);
};
@@ -673,7 +690,7 @@
#if ENABLE(SVG)
class PropertyWrapperSVGPaint : public PropertyWrapperBase {
public:
- PropertyWrapperSVGPaint(int prop, const SVGPaint::SVGPaintType& (RenderStyle::*paintTypeGetter)() const, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+ PropertyWrapperSVGPaint(int prop, const SVGPaint::SVGPaintType& (RenderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
: PropertyWrapperBase(prop)
, m_paintTypeGetter(paintTypeGetter)
, m_getter(getter)
@@ -727,7 +744,7 @@
private:
const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
- const Color& (RenderStyle::*m_getter)() const;
+ Color (RenderStyle::*m_getter)() const;
void (RenderStyle::*m_setter)(const Color&);
};
#endif
@@ -770,9 +787,9 @@
gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight));
gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop));
gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom));
- gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor));
+ gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor));
- gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor));
+ gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
Modified: trunk/Source/WebCore/platform/graphics/Color.h (97044 => 97045)
--- trunk/Source/WebCore/platform/graphics/Color.h 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/platform/graphics/Color.h 2011-10-10 07:50:48 UTC (rev 97045)
@@ -78,7 +78,7 @@
WTF_MAKE_FAST_ALLOCATED;
public:
Color() : m_color(0), m_valid(false) { }
- Color(RGBA32 col) : m_color(col), m_valid(true) { }
+ Color(RGBA32 color, bool valid = true) : m_color(color), m_valid(valid) { ASSERT(m_valid || !m_color); }
Color(int r, int g, int b) : m_color(makeRGB(r, g, b)), m_valid(true) { }
Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)), m_valid(true) { }
// Color is currently limited to 32bit RGBA, perhaps some day we'll support better colors
Modified: trunk/Source/WebCore/rendering/style/BorderValue.h (97044 => 97045)
--- trunk/Source/WebCore/rendering/style/BorderValue.h 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/rendering/style/BorderValue.h 2011-10-10 07:50:48 UTC (rev 97045)
@@ -34,7 +34,9 @@
friend class RenderStyle;
public:
BorderValue()
- : m_width(3)
+ : m_rgba(0)
+ , m_validColor(false)
+ , m_width(3)
, m_style(BNONE)
, m_isAuto(AUTO_OFF)
{
@@ -47,7 +49,7 @@
bool isTransparent() const
{
- return m_color.isValid() && !m_color.alpha();
+ return m_validColor && !alphaChannel(m_rgba);
}
bool isVisible(bool checkStyle = true) const
@@ -57,7 +59,7 @@
bool operator==(const BorderValue& o) const
{
- return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color;
+ return m_width == o.m_width && m_style == o.m_style && color() == o.color();
}
bool operator!=(const BorderValue& o) const
@@ -65,12 +67,23 @@
return !(*this == o);
}
- const Color& color() const { return m_color; }
+ void setColor(const Color& color)
+ {
+ m_rgba = color.rgb();
+ m_validColor = color.isValid();
+ }
+ Color color() const { return Color(m_rgba, m_validColor); }
+
unsigned short width() const { return m_width; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
+private:
+ // Instead of using the Color class here, we "unroll" its members onto BorderValue
+ // to maximize struct packing. Use accessors to read/write.
+ RGBA32 m_rgba;
+ bool m_validColor : 1;
+
protected:
- Color m_color;
unsigned m_width : 12;
unsigned m_style : 4; // EBorderStyle
Modified: trunk/Source/WebCore/rendering/style/OutlineValue.h (97044 => 97045)
--- trunk/Source/WebCore/rendering/style/OutlineValue.h 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/rendering/style/OutlineValue.h 2011-10-10 07:50:48 UTC (rev 97045)
@@ -39,7 +39,7 @@
bool operator==(const OutlineValue& o) const
{
- 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;
+ return m_width == o.m_width && m_style == o.m_style && color() == o.color() && m_offset == o.m_offset && m_isAuto == o.m_isAuto;
}
bool operator!=(const OutlineValue& o) const
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (97044 => 97045)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2011-10-10 07:15:15 UTC (rev 97044)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2011-10-10 07:50:48 UTC (rev 97045)
@@ -95,6 +95,10 @@
if (!compareEqual(group->variable, value)) \
group.access()->variable = value;
+#define SET_BORDERVALUE_COLOR(group, variable, value) \
+ if (!compareEqual(group->variable.color(), value)) \
+ group.access()->variable.setColor(value);
+
namespace WebCore {
using std::max;
@@ -944,21 +948,21 @@
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 setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, 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 setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, 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 setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, 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 setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v) }
void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v) }
void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto) }
void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v) }
- void setOutlineColor(const Color& v) { SET_VAR(m_background, m_outline.m_color, v) }
+ void setOutlineColor(const Color& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v) }
void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
@@ -1151,7 +1155,7 @@
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.m_color, c); }
+ void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, 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.m_width, w); }
void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
@@ -1231,13 +1235,13 @@
SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
const SVGPaint::SVGPaintType& fillPaintType() const { return svgStyle()->fillPaintType(); }
- const Color& fillPaintColor() const { return svgStyle()->fillPaintColor(); }
+ Color fillPaintColor() const { return svgStyle()->fillPaintColor(); }
void setFillPaintColor(const Color& c) { accessSVGStyle()->setFillPaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
float fillOpacity() const { return svgStyle()->fillOpacity(); }
void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); }
const SVGPaint::SVGPaintType& strokePaintType() const { return svgStyle()->strokePaintType(); }
- const Color& strokePaintColor() const { return svgStyle()->strokePaintColor(); }
+ Color strokePaintColor() const { return svgStyle()->strokePaintColor(); }
void setStrokePaintColor(const Color& c) { accessSVGStyle()->setStrokePaint(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, c, ""); }
float strokeOpacity() const { return svgStyle()->strokeOpacity(); }
void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); }
@@ -1509,24 +1513,24 @@
}
// Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
- const Color& borderLeftColor() const { return surround->border.left().color(); }
- const Color& borderRightColor() const { return surround->border.right().color(); }
- const Color& borderTopColor() const { return surround->border.top().color(); }
- const Color& borderBottomColor() const { return surround->border.bottom().color(); }
- const Color& backgroundColor() const { return m_background->color(); }
- const Color& color() const { return inherited->color; }
- const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
- const Color& outlineColor() const { return m_background->outline().color(); }
- const Color& textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
- const Color& textFillColor() const { return rareInheritedData->textFillColor; }
- const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
+ Color borderLeftColor() const { return surround->border.left().color(); }
+ Color borderRightColor() const { return surround->border.right().color(); }
+ Color borderTopColor() const { return surround->border.top().color(); }
+ Color borderBottomColor() const { return surround->border.bottom().color(); }
+ Color backgroundColor() const { return m_background->color(); }
+ Color color() const { return inherited->color; }
+ Color columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
+ Color outlineColor() const { return m_background->outline().color(); }
+ Color textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
+ Color textFillColor() const { return rareInheritedData->textFillColor; }
+ Color textStrokeColor() const { return rareInheritedData->textStrokeColor; }
Color colorIncludingFallback(int colorProperty) const;
#if ENABLE(SVG)
- const Color& stopColor() const { return svgStyle()->stopColor(); }
- const Color& floodColor() const { return svgStyle()->floodColor(); }
- const Color& lightingColor() const { return svgStyle()->lightingColor(); }
+ Color stopColor() const { return svgStyle()->stopColor(); }
+ Color floodColor() const { return svgStyle()->floodColor(); }
+ Color lightingColor() const { return svgStyle()->lightingColor(); }
#endif
void appendContent(PassOwnPtr<ContentData>);