Diff
Modified: trunk/Source/WebCore/ChangeLog (205891 => 205892)
--- trunk/Source/WebCore/ChangeLog 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/ChangeLog 2016-09-14 00:38:57 UTC (rev 205892)
@@ -1,3 +1,71 @@
+2016-09-12 Dean Jackson <[email protected]>
+
+ Replace RGBA32 with Color in member variables
+ https://bugs.webkit.org/show_bug.cgi?id=161856
+ <rdar://problem/28254324>
+
+ Reviewed by Simon Fraser.
+
+ In preparation for the Color class to become more than
+ just a 4-byte RGBA value, I went through a few places
+ that were using the RGBA32 type directly, and replaced
+ them with Color. This will make some objects a little
+ bigger e.g. BorderValue and its friends.
+
+ I mostly looked at the places that were using RGBA32 as
+ a member variable. There is still a lot of RGBA32 use
+ around the project, in particular the CSS parser.
+
+ There should be no behaviour change.
+
+ * html/canvas/CanvasRenderingContext2D.cpp: Shadows now use Color.
+ (WebCore::CanvasRenderingContext2D::setShadow):
+ (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
+ (WebCore::CanvasRenderingContext2D::didDraw):
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/CanvasStyle.cpp: Canvas style uses Color for fills and strokes.
+ (WebCore::CanvasStyle::CanvasStyle):
+ (WebCore::CanvasStyle::isEquivalentColor):
+ (WebCore::CanvasStyle::isEquivalentRGBA):
+ (WebCore::CanvasStyle::applyStrokeColor):
+ (WebCore::CanvasStyle::applyFillColor):
+ * html/canvas/CanvasStyle.h:
+ (WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
+ (WebCore::CanvasStyle::color):
+
+ * html/track/TextTrackCueGeneric.h: Foreground, background and
+ highlight colors.
+ * platform/graphics/InbandTextTrackPrivateClient.h:
+ (WebCore::GenericCueData::setForegroundColor):
+ (WebCore::GenericCueData::setBackgroundColor):
+ (WebCore::GenericCueData::setHighlightColor):
+
+ * page/PageOverlay.cpp: Background color.
+ (WebCore::PageOverlay::setBackgroundColor):
+ * page/PageOverlay.h:
+
+ * platform/graphics/mac/ColorMac.h: Random function that returned RGBA32.
+ * platform/graphics/mac/ColorMac.mm:
+ (WebCore::oldAquaFocusRingColor):
+
+ * rendering/RenderTableCell.cpp: Update the size of CollapsedBorderValue.
+
+ * rendering/RenderTheme.h: Use a NeverDestroyed Color rather than a static RGBA32.
+
+ * rendering/style/BorderValue.h: Use a Color.
+ (WebCore::BorderValue::BorderValue):
+ (WebCore::BorderValue::isTransparent):
+ (WebCore::BorderValue::operator==):
+ (WebCore::BorderValue::setColor):
+ (WebCore::BorderValue::color):
+ * rendering/style/CollapsedBorderValue.h:
+ (WebCore::CollapsedBorderValue::CollapsedBorderValue):
+ (WebCore::CollapsedBorderValue::color):
+ * rendering/style/OutlineValue.h:
+ (WebCore::OutlineValue::operator==):
+
+ * rendering/style/RenderStyle.cpp: Update to match new BorderValue.
+
2016-09-13 Jer Noble <[email protected]>
[media-source] MediaSource.addSourceBuffer(null) should throw an exception
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (205891 => 205892)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-09-14 00:38:57 UTC (rev 205892)
@@ -1258,17 +1258,17 @@
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float grayLevel, float alpha)
{
- setShadow(FloatSize(width, height), blur, makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha));
+ setShadow(FloatSize(width, height), blur, Color(grayLevel, grayLevel, grayLevel, alpha));
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float r, float g, float b, float a)
{
- setShadow(FloatSize(width, height), blur, makeRGBA32FromFloats(r, g, b, a));
+ setShadow(FloatSize(width, height), blur, Color(r, g, b, a));
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float c, float m, float y, float k, float a)
{
- setShadow(FloatSize(width, height), blur, makeRGBAFromCMYKA(c, m, y, k, a));
+ setShadow(FloatSize(width, height), blur, Color(c, m, y, k, a));
}
void CanvasRenderingContext2D::clearShadow()
@@ -1276,7 +1276,7 @@
setShadow(FloatSize(), 0, Color::transparent);
}
-void CanvasRenderingContext2D::setShadow(const FloatSize& offset, float blur, RGBA32 color)
+void CanvasRenderingContext2D::setShadow(const FloatSize& offset, float blur, Color color)
{
if (state().shadowOffset == offset && state().shadowBlur == blur && state().shadowColor == color)
return;
@@ -1306,7 +1306,7 @@
bool CanvasRenderingContext2D::shouldDrawShadows() const
{
- return alphaChannel(state().shadowColor) && (state().shadowBlur || !state().shadowOffset.isZero());
+ return state().shadowColor.alpha() && (state().shadowBlur || !state().shadowOffset.isZero());
}
enum ImageSizeType {
@@ -1882,7 +1882,7 @@
dirtyRect = ctm.mapRect(r);
}
- if (options & CanvasDidDrawApplyShadow && alphaChannel(state().shadowColor)) {
+ if (options & CanvasDidDrawApplyShadow && state().shadowColor.alpha()) {
// The shadow gets applied after transformation
FloatRect shadowRect(dirtyRect);
shadowRect.move(state().shadowOffset);
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (205891 => 205892)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -284,7 +284,7 @@
float miterLimit;
FloatSize shadowOffset;
float shadowBlur;
- RGBA32 shadowColor;
+ Color shadowColor;
float globalAlpha;
CompositeOperator globalComposite;
BlendMode globalBlend;
@@ -316,7 +316,7 @@
const State& state() const { return m_stateStack.last(); }
void applyLineDash() const;
- void setShadow(const FloatSize& offset, float blur, RGBA32 color);
+ void setShadow(const FloatSize& offset, float blur, Color);
void applyShadow();
bool shouldDrawShadows() const;
Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.cpp (205891 => 205892)
--- trunk/Source/WebCore/html/canvas/CanvasStyle.cpp 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.cpp 2016-09-14 00:38:57 UTC (rev 205892)
@@ -83,26 +83,26 @@
}
}
-CanvasStyle::CanvasStyle(RGBA32 rgba)
- : m_rgba(rgba)
+CanvasStyle::CanvasStyle(Color color)
+ : m_color(color)
, m_type(RGBA)
{
}
CanvasStyle::CanvasStyle(float grayLevel, float alpha)
- : m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha))
+ : m_color(Color(grayLevel, grayLevel, grayLevel, alpha))
, m_type(RGBA)
{
}
CanvasStyle::CanvasStyle(float r, float g, float b, float a)
- : m_rgba(makeRGBA32FromFloats(r, g, b, a))
+ : m_color(Color(r, g, b, a))
, m_type(RGBA)
{
}
CanvasStyle::CanvasStyle(float c, float m, float y, float k, float a)
- : m_cmyka(new CMYKAValues(makeRGBAFromCMYKA(c, m, y, k, a), c, m, y, k, a))
+ : m_cmyka(new CMYKAValues(Color(c, m, y, k, a), c, m, y, k, a))
, m_type(CMYKA)
{
}
@@ -175,7 +175,7 @@
switch (m_type) {
case RGBA:
- return m_rgba == other.m_rgba;
+ return m_color == other.m_color;
case CMYKA:
return m_cmyka->c == other.m_cmyka->c
&& m_cmyka->m == other.m_cmyka->m
@@ -200,7 +200,7 @@
if (m_type != RGBA)
return false;
- return m_rgba == makeRGBA32FromFloats(r, g, b, a);
+ return m_color == Color(r, g, b, a);
}
bool CanvasStyle::isEquivalentCMYKA(float c, float m, float y, float k, float a) const
@@ -223,7 +223,7 @@
else if (m_type == ImagePattern)
m_pattern->ref();
else if (m_type == CMYKA)
- m_cmyka = new CMYKAValues(other.m_cmyka->rgba, other.m_cmyka->c, other.m_cmyka->m, other.m_cmyka->y, other.m_cmyka->k, other.m_cmyka->a);
+ m_cmyka = new CMYKAValues(other.m_cmyka->color, other.m_cmyka->c, other.m_cmyka->m, other.m_cmyka->y, other.m_cmyka->k, other.m_cmyka->a);
}
CanvasStyle& CanvasStyle::operator=(const CanvasStyle& other)
@@ -241,7 +241,7 @@
return;
switch (m_type) {
case RGBA:
- context->setStrokeColor(m_rgba);
+ context->setStrokeColor(m_color);
break;
case CMYKA: {
// FIXME: Do this through platform-independent GraphicsContext API.
@@ -249,7 +249,7 @@
#if USE(CG)
CGContextSetCMYKStrokeColor(context->platformContext(), m_cmyka->c, m_cmyka->m, m_cmyka->y, m_cmyka->k, m_cmyka->a);
#else
- context->setStrokeColor(m_cmyka->rgba);
+ context->setStrokeColor(m_cmyka->color);
#endif
break;
}
@@ -273,7 +273,7 @@
return;
switch (m_type) {
case RGBA:
- context->setFillColor(m_rgba);
+ context->setFillColor(m_color);
break;
case CMYKA: {
// FIXME: Do this through platform-independent GraphicsContext API.
@@ -281,7 +281,7 @@
#if USE(CG)
CGContextSetCMYKFillColor(context->platformContext(), m_cmyka->c, m_cmyka->m, m_cmyka->y, m_cmyka->k, m_cmyka->a);
#else
- context->setFillColor(m_cmyka->rgba);
+ context->setFillColor(m_cmyka->color);
#endif
break;
}
Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.h (205891 => 205892)
--- trunk/Source/WebCore/html/canvas/CanvasStyle.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -42,7 +42,7 @@
class CanvasStyle {
public:
CanvasStyle();
- explicit CanvasStyle(RGBA32);
+ explicit CanvasStyle(Color);
CanvasStyle(float grayLevel, float alpha);
CanvasStyle(float r, float g, float b, float alpha);
CanvasStyle(float c, float m, float y, float k, float alpha);
@@ -80,9 +80,14 @@
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(CMYKAValues);
public:
- CMYKAValues() : rgba(0), c(0), m(0), y(0), k(0), a(0) { }
- CMYKAValues(RGBA32 rgba, float cyan, float magenta, float yellow, float black, float alpha) : rgba(rgba), c(cyan), m(magenta), y(yellow), k(black), a(alpha) { }
- RGBA32 rgba;
+ CMYKAValues()
+ : color(), c(0), m(0), y(0), k(0), a(0)
+ { }
+
+ CMYKAValues(Color color, float cyan, float magenta, float yellow, float black, float alpha)
+ : color(color), c(cyan), m(magenta), y(yellow), k(black), a(alpha)
+ { }
+ Color color;
float c;
float m;
float y;
@@ -99,7 +104,7 @@
}
union {
- RGBA32 m_rgba;
+ Color m_color;
float m_overrideAlpha;
CanvasGradient* m_gradient;
CanvasPattern* m_pattern;
@@ -134,8 +139,8 @@
{
ASSERT(m_type == RGBA || m_type == CMYKA);
if (m_type == RGBA)
- return Color(m_rgba).serialized();
- return Color(m_cmyka->rgba).serialized();
+ return m_color.serialized();
+ return m_cmyka->color.serialized();
}
inline CanvasStyle::CanvasStyle(CanvasStyle&& other)
Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.h (205891 => 205892)
--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -62,13 +62,13 @@
void setFontName(String name) { m_fontName = name; }
Color foregroundColor() const { return m_foregroundColor; }
- void setForegroundColor(RGBA32 color) { m_foregroundColor.setRGB(color); }
+ void setForegroundColor(Color color) { m_foregroundColor = color; }
Color backgroundColor() const { return m_backgroundColor; }
- void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
+ void setBackgroundColor(Color color) { m_backgroundColor = color; }
Color highlightColor() const { return m_highlightColor; }
- void setHighlightColor(RGBA32 color) { m_highlightColor.setRGB(color); }
+ void setHighlightColor(Color color) { m_highlightColor = color; }
void setFontSize(int, const IntSize&, bool important) override;
Modified: trunk/Source/WebCore/page/PageOverlay.cpp (205891 => 205892)
--- trunk/Source/WebCore/page/PageOverlay.cpp 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/page/PageOverlay.cpp 2016-09-14 00:38:57 UTC (rev 205892)
@@ -136,7 +136,7 @@
return IntSize();
}
-void PageOverlay::setBackgroundColor(RGBA32 backgroundColor)
+void PageOverlay::setBackgroundColor(Color backgroundColor)
{
if (m_backgroundColor == backgroundColor)
return;
Modified: trunk/Source/WebCore/page/PageOverlay.h (205891 => 205892)
--- trunk/Source/WebCore/page/PageOverlay.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/page/PageOverlay.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -106,8 +106,8 @@
WEBCORE_EXPORT IntSize viewToOverlayOffset() const;
- RGBA32 backgroundColor() const { return m_backgroundColor; }
- void setBackgroundColor(RGBA32);
+ Color backgroundColor() const { return m_backgroundColor; }
+ void setBackgroundColor(Color);
void setShouldIgnoreMouseEventsOutsideBounds(bool flag) { m_shouldIgnoreMouseEventsOutsideBounds = flag; }
@@ -144,7 +144,7 @@
OverlayType m_overlayType;
IntRect m_overrideFrame;
- RGBA32 m_backgroundColor { Color::transparent };
+ Color m_backgroundColor { Color::transparent };
PageOverlayID m_pageOverlayID;
bool m_shouldIgnoreMouseEventsOutsideBounds { true };
Modified: trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h (205891 => 205892)
--- trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -87,13 +87,13 @@
void setRelativeFontSize(double relativeFontSize) { m_relativeFontSize = relativeFontSize; }
Color foregroundColor() const { return m_foregroundColor; }
- void setForegroundColor(RGBA32 color) { m_foregroundColor.setRGB(color); }
+ void setForegroundColor(Color color) { m_foregroundColor = color; }
Color backgroundColor() const { return m_backgroundColor; }
- void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
+ void setBackgroundColor(Color color) { m_backgroundColor = color; }
Color highlightColor() const { return m_highlightColor; }
- void setHighlightColor(RGBA32 color) { m_highlightColor.setRGB(color); }
+ void setHighlightColor(Color color) { m_highlightColor = color; }
enum Status {
Uninitialized,
Modified: trunk/Source/WebCore/platform/graphics/mac/ColorMac.h (205891 => 205892)
--- trunk/Source/WebCore/platform/graphics/mac/ColorMac.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/platform/graphics/mac/ColorMac.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -47,7 +47,7 @@
WEBCORE_EXPORT void setUsesTestModeFocusRingColor(bool);
// Focus ring color used for testing purposes.
- RGBA32 oldAquaFocusRingColor();
+ Color oldAquaFocusRingColor();
}
Modified: trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm (205891 => 205892)
--- trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm 2016-09-14 00:38:57 UTC (rev 205892)
@@ -34,7 +34,7 @@
static bool useOldAquaFocusRingColor;
-RGBA32 oldAquaFocusRingColor()
+Color oldAquaFocusRingColor()
{
return 0xFF7DADD9;
}
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (205891 => 205892)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2016-09-14 00:38:57 UTC (rev 205892)
@@ -52,7 +52,7 @@
};
COMPILE_ASSERT(sizeof(RenderTableCell) == sizeof(SameSizeAsRenderTableCell), RenderTableCell_should_stay_small);
-COMPILE_ASSERT(sizeof(CollapsedBorderValue) == 12, CollapsedBorderValue_should_stay_small);
+COMPILE_ASSERT(sizeof(CollapsedBorderValue) == 16, CollapsedBorderValue_should_stay_small);
RenderTableCell::RenderTableCell(Element& element, RenderStyle&& style)
: RenderBlockFlow(element, WTFMove(style))
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (205891 => 205892)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2016-09-14 00:38:57 UTC (rev 205892)
@@ -1336,4 +1336,14 @@
return StringTruncator::centerTruncate(string, width, font);
}
+#if ENABLE(TOUCH_EVENTS)
+Color RenderTheme::platformTapHighlightColor() const
+{
+ // This color is expected to be drawn on a semi-transparent overlay,
+ // making it more transparent than its alpha value indicates.
+ static NeverDestroyed<const Color> defaultTapHighlightColor = Color(0, 0, 0, 102);
+ return defaultTapHighlightColor;
+}
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (205891 => 205892)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -173,7 +173,7 @@
static float platformFocusRingOffset(float outlineWidth) { return std::max<float>(outlineWidth - platformFocusRingWidth(), 0); }
#if ENABLE(TOUCH_EVENTS)
static Color tapHighlightColor();
- virtual Color platformTapHighlightColor() const { return RenderTheme::defaultTapHighlightColor; }
+ virtual Color platformTapHighlightColor() const;
#endif
virtual void platformColorsDidChange();
@@ -409,12 +409,6 @@
mutable Color m_activeListBoxSelectionForegroundColor;
mutable Color m_inactiveListBoxSelectionForegroundColor;
-#if ENABLE(TOUCH_EVENTS)
- // This color is expected to be drawn on a semi-transparent overlay,
- // making it more transparent than its alpha value indicates.
- static const RGBA32 defaultTapHighlightColor = 0x66000000;
-#endif
-
#if USE(NEW_THEME)
Theme* m_theme; // The platform-specific theme.
#endif
Modified: trunk/Source/WebCore/rendering/style/BorderValue.h (205891 => 205892)
--- trunk/Source/WebCore/rendering/style/BorderValue.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/style/BorderValue.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -34,10 +34,7 @@
friend class RenderStyle;
public:
BorderValue()
- : m_width(3)
- , m_color(0)
- , m_colorIsValid(false)
- , m_style(BNONE)
+ : m_style(BNONE)
, m_isAuto(AUTO_OFF)
{
}
@@ -49,7 +46,7 @@
bool isTransparent() const
{
- return m_colorIsValid && !alphaChannel(m_color);
+ return m_color.isValid() && !m_color.alpha();
}
bool isVisible(bool checkStyle = true) const
@@ -59,7 +56,7 @@
bool operator==(const BorderValue& o) const
{
- return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsValid == o.m_colorIsValid;
+ return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color;
}
bool operator!=(const BorderValue& o) const
@@ -69,19 +66,17 @@
void setColor(const Color& color)
{
- m_color = color.rgb();
- m_colorIsValid = color.isValid();
+ m_color = color;
}
- Color color() const { return Color(m_color, m_colorIsValid); }
+ Color color() const { return m_color; }
float width() const { return m_width; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
protected:
- float m_width;
- RGBA32 m_color;
- unsigned m_colorIsValid : 1;
+ float m_width { 3 };
+ Color m_color;
unsigned m_style : 4; // EBorderStyle
Modified: trunk/Source/WebCore/rendering/style/CollapsedBorderValue.h (205891 => 205892)
--- trunk/Source/WebCore/rendering/style/CollapsedBorderValue.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/style/CollapsedBorderValue.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -33,8 +33,7 @@
class CollapsedBorderValue {
public:
CollapsedBorderValue()
- : m_colorIsValid(false)
- , m_style(BNONE)
+ : m_style(BNONE)
, m_precedence(BOFF)
, m_transparent(false)
{
@@ -42,8 +41,7 @@
CollapsedBorderValue(const BorderValue& border, const Color& color, EBorderPrecedence precedence)
: m_width(LayoutUnit(border.nonZero() ? border.width() : 0))
- , m_color(color.rgb())
- , m_colorIsValid(color.isValid())
+ , m_color(color)
, m_style(border.style())
, m_precedence(precedence)
, m_transparent(border.isTransparent())
@@ -53,7 +51,7 @@
LayoutUnit width() const { return m_style > BHIDDEN ? m_width : LayoutUnit::fromPixel(0); }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
bool exists() const { return m_precedence != BOFF; }
- Color color() const { return Color(m_color, m_colorIsValid); }
+ Color color() const { return m_color; }
bool isTransparent() const { return m_transparent; }
EBorderPrecedence precedence() const { return static_cast<EBorderPrecedence>(m_precedence); }
@@ -66,8 +64,7 @@
private:
LayoutUnit m_width;
- RGBA32 m_color { 0 };
- unsigned m_colorIsValid : 1;
+ Color m_color;
unsigned m_style : 4; // EBorderStyle
unsigned m_precedence : 3; // EBorderPrecedence
unsigned m_transparent : 1;
Modified: trunk/Source/WebCore/rendering/style/OutlineValue.h (205891 => 205892)
--- trunk/Source/WebCore/rendering/style/OutlineValue.h 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/style/OutlineValue.h 2016-09-14 00:38:57 UTC (rev 205892)
@@ -34,7 +34,7 @@
public:
bool operator==(const OutlineValue& o) const
{
- return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsValid == o.m_colorIsValid && m_offset == o.m_offset && m_isAuto == o.m_isAuto;
+ 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
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (205891 => 205892)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2016-09-14 00:38:57 UTC (rev 205892)
@@ -64,7 +64,7 @@
struct SameSizeAsBorderValue {
float m_width;
- RGBA32 m_color;
+ Color m_color;
int m_restBits;
};
Modified: trunk/Source/WebKit/mac/ChangeLog (205891 => 205892)
--- trunk/Source/WebKit/mac/ChangeLog 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-09-14 00:38:57 UTC (rev 205892)
@@ -1,3 +1,27 @@
+2016-09-12 Dean Jackson <[email protected]>
+
+ Replace RGBA32 with Color in member variables
+ https://bugs.webkit.org/show_bug.cgi?id=161856
+ <rdar://problem/28254324>
+
+ Reviewed by Simon Fraser.
+
+ In preparation for the Color class to become more than
+ just a 4-byte RGBA value, I went through a few places
+ that were using the RGBA32 type directly, and replaced
+ them with Color. This will make some objects a little
+ bigger e.g. BorderValue and its friends.
+
+ I mostly looked at the places that were using RGBA32 as
+ a member variable. There is still a lot of RGBA32 use
+ around the project, in particular the CSS parser.
+
+ There should be no behaviour change.
+
+ * Misc/WebKitNSStringExtras.mm:
+ (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Explicitly
+ call a Color constructor, rather than passing an RGBA32.
+
2016-09-13 Chris Dumez <[email protected]>
Drop support for <isindex>
Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm (205891 => 205892)
--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm 2016-09-14 00:36:43 UTC (rev 205891)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm 2016-09-14 00:38:57 UTC (rev 205892)
@@ -103,7 +103,7 @@
CGFloat blue;
CGFloat alpha;
[[textColor colorUsingColorSpaceName:NSDeviceRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
- graphicsContext.setFillColor(makeRGBA(red * 255, green * 255, blue * 255, alpha * 255));
+ graphicsContext.setFillColor(Color(static_cast<float>(red * 255), static_cast<float>(green * 255.0f), static_cast<float>(blue * 255.0f), static_cast<float>(alpha * 255.0f)));
webCoreFont.drawText(graphicsContext, run, FloatPoint(point.x, (flipped ? point.y : (-1 * point.y))));