Commit 0cb17725 authored by hyatt's avatar hyatt

Fix for bug 6781, convert QColor to Color (and QRgb to RGBA32). r=maciej.

        * ForwardingHeaders/qcolor.h: Removed.
        * WebCore+SVG/KDOMSettings.h:
        * WebCore+SVG/RGBColorImpl.cpp:
        (RGBColorImpl::RGBColorImpl):
        (RGBColorImpl::red):
        (RGBColorImpl::green):
        (RGBColorImpl::blue):
        * WebCore+SVG/RGBColorImpl.h:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/objc/DOMCSS.mm:
        (getWrapperForRGB):
        (setWrapperForRGB):
        (removeWrapperForRGB):
        (-[DOMRGBColor dealloc]):
        (-[DOMRGBColor finalize]):
        (-[DOMRGBColor red]):
        (-[DOMRGBColor green]):
        (-[DOMRGBColor blue]):
        (-[DOMRGBColor _initWithRGB:]):
        (+[DOMRGBColor _RGBColorWithRGB:]):
        (-[DOMRGBColor alpha]):
        (-[DOMRGBColor _color]):
        * bridge/mac/MacFrame.mm:
        (MacFrame::attributedString):
        (MacFrame::fontAttributesForSelectionStart):
        (MacFrame::bodyBackgroundColor):
        (convertAttributesToUnderlines):
        * css/css_valueimpl.cpp:
        (WebCore::CSSPrimitiveValueImpl::CSSPrimitiveValueImpl):
        (WebCore::CSSPrimitiveValueImpl::cssText):
        * css/csshelper.h:
        * css/cssparser.cpp:
        (CSSParser::parseColor):
        (CSSParser::parseColorFromValue):
        * css/cssparser.h:
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::canShareStyleWithElement):
        (WebCore::):
        (WebCore::colorForCSSValue):
        (WebCore::CSSStyleSelector::applyProperty):
        (WebCore::CSSStyleSelector::getColorFromPrimitiveValue):
        * css/cssstyleselector.h:
        * kcanvas/KCanvasFilters.h:
        (KCanvasFEDiffuseLighting::lightingColor):
        (KCanvasFEDiffuseLighting::setLightingColor):
        (KCanvasFEFlood::floodColor):
        (KCanvasFEFlood::setFloodColor):
        (KCanvasFESpecularLighting::lightingColor):
        (KCanvasFESpecularLighting::setLightingColor):
        * kcanvas/KCanvasTreeDebug.cpp:
        (operator<<):
        * kcanvas/KCanvasTreeDebug.h:
        * kcanvas/device/KRenderingDevice.h:
        * kcanvas/device/KRenderingPaintServerGradient.cpp:
        (KCSortedGradientStopList::addStop):
        * kcanvas/device/KRenderingPaintServerGradient.h:
        * kcanvas/device/KRenderingPaintServerSolid.cpp:
        (KRenderingPaintServerSolid::color):
        (KRenderingPaintServerSolid::setColor):
        * kcanvas/device/KRenderingPaintServerSolid.h:
        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
        (ciColor):
        * kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.mm:
        (setupShadingWithStyle):
        * kcanvas/device/quartz/KRenderingPaintServerQuartz.mm:
        (KRenderingPaintServerPatternQuartz::setup):
        * khtml/ecma/kjs_css.h:
        * khtml/ecma/kjs_html.cpp:
        (KJS::KJS::Context2DFunction::callAsFunction):
        (KJS::colorRefFromValue):
        (KJS::colorFromValue):
        (KJS::Context2D::putValueProperty):
        (KJS::GradientFunction::callAsFunction):
        * khtml/ecma/kjs_html.h:
        * khtml/editing/apply_style_command.cpp:
        (WebCore::StyleChange::checkForLegacyHTMLStyleChange):
        * khtml/html/html_baseimpl.cpp:
        (WebCore::HTMLBodyElementImpl::parseMappedAttribute):
        * khtml/misc/helper.h:
        * khtml/xml/DocumentImpl.cpp:
        (WebCore::DocumentImpl::DocumentImpl):
        (WebCore::DocumentImpl::resetLinkColor):
        (WebCore::DocumentImpl::resetVisitedLinkColor):
        * khtml/xml/DocumentImpl.h:
        (WebCore::DocumentImpl::setTextColor):
        (WebCore::DocumentImpl::textColor):
        (WebCore::DocumentImpl::linkColor):
        (WebCore::DocumentImpl::visitedLinkColor):
        (WebCore::DocumentImpl::activeLinkColor):
        (WebCore::DocumentImpl::setLinkColor):
        (WebCore::DocumentImpl::setVisitedLinkColor):
        (WebCore::DocumentImpl::setActiveLinkColor):
        * ksvg2/css/SVGCSSStyleSelector.cpp:
        (KDOM::CSSStyleSelector::applySVGProperty):
        * ksvg2/css/SVGRenderStyle.h:
        * ksvg2/css/SVGRenderStyleDefs.h:
        * ksvg2/misc/KCanvasRenderingStyle.cpp:
        (WebCore::KSVGPainterFactory::fillPaintServer):
        * ksvg2/misc/KSVGTimeScheduler.cpp:
        (KSVG::SVGTimer::notifyAll):
        * ksvg2/svg/SVGAnimateColorElementImpl.cpp:
        (SVGAnimateColorElementImpl::handleTimerEvent):
        (SVGAnimateColorElementImpl::clampColor):
        (SVGAnimateColorElementImpl::color):
        (SVGAnimateColorElementImpl::initialColor):
        * ksvg2/svg/SVGAnimateColorElementImpl.h:
        * ksvg2/svg/SVGAnimateElementImpl.cpp:
        (SVGAnimateElementImpl::handleTimerEvent):
        * ksvg2/svg/SVGColorImpl.cpp:
        (SVGColorImpl::setRGBColor):
        (SVGColorImpl::color):
        * ksvg2/svg/SVGColorImpl.h:
        * ksvg2/svg/SVGGradientElementImpl.cpp:
        (SVGGradientElementImpl::rebuildStops):
        * kwq/KWQAccObject.mm:
        (AXAttributeStringSetStyle):
        * kwq/KWQBrush.h:
        (QBrush::QBrush::QBrush):
        (QBrush::color):
        (QBrush::setColor):
        * kwq/KWQColor.h: Removed.
        * kwq/KWQColor.mm: Removed.
        * kwq/KWQColorData.gperf: Removed.
        * kwq/KWQKConfigBase.h:
        * kwq/KWQKConfigBase.mm:
        (KConfig::readColorEntry):
        * kwq/KWQLineEdit.mm:
        (QLineEdit::setPalette):
        * kwq/KWQNamespace.h:
        (Qt::):
        * kwq/KWQObject.h:
        * kwq/KWQPainter.h:
        * kwq/KWQPainter.mm:
        (QPainter::setPen):
        (QPainter::setBrush):
        (QPainter::drawText):
        (QPainter::drawHighlightForText):
        (QPainter::selectedTextBackgroundColor):
        (_fillRectXX):
        (QPainter::setShadow):
        (QPainter::initFocusRing):
        * kwq/KWQPalette.h:
        (QColorGroup::QColorGroup):
        (QColorGroup::color):
        (QColorGroup::setColor):
        (QColorGroup::background):
        (QColorGroup::foreground):
        (QColorGroup::base):
        (QPalette::QPalette):
        (QPalette::background):
        (QPalette::foreground):
        * kwq/KWQPen.cpp:
        (QPen::QPen):
        (QPen::color):
        (QPen::setColor):
        * kwq/KWQPen.h:
        * kwq/KWQRenderTreeDebug.cpp:
        (operator<<):
        * kwq/KWQTextEdit.mm:
        (QTextEdit::setPalette):
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::tiled_pixmap):
        * loader/CachedImage.h:
        * page/Frame.cpp:
        (Frame::paint):
        * page/Frame.h:
        (MarkedTextUnderline::MarkedTextUnderline):
        * platform/Color.cpp: Added.
        (WebCore::makeRGB):
        (WebCore::makeRGBA):
        (WebCore::parseHexColor):
        (WebCore::Color::Color):
        (WebCore::Color::name):
        (WebCore::Color::setNamedColor):
        (WebCore::Color::hsv):
        (WebCore::Color::setHsv):
        (WebCore::Color::light):
        (WebCore::Color::dark):
        (WebCore::Color::getRgbaF):
        * platform/Color.h: Added.
        (WebCore::Color::Color):
        (WebCore::Color::rgb):
        (WebCore::Color::setRgb):
        (WebCore::operator==):
        (WebCore::operator!=):
        * platform/ColorData.gperf: Added.
        * rendering/InlineTextBox.cpp:
        (khtml::simpleDifferenceBetweenColors):
        (khtml::correctedTextColor):
        (khtml::InlineTextBox::paint):
        (khtml::InlineTextBox::paintSelection):
        (khtml::InlineTextBox::paintMarkedTextBackground):
        (khtml::InlineTextBox::paintDecoration):
        * rendering/RenderTable.h:
        (WebCore::RenderTable::bgColor):
        * rendering/RenderTableCell.cpp:
        (WebCore::outlineBox):
        (WebCore::RenderTableCell::paintBoxDecorations):
        * rendering/font.cpp:
        (khtml::Font::drawHighlightForText):
        (khtml::Font::drawText):
        * rendering/font.h:
        * rendering/render_box.cpp:
        (WebCore::RenderBox::paintRootBoxDecorations):
        (WebCore::RenderBox::paintBackgrounds):
        (WebCore::RenderBox::paintBackground):
        (WebCore::RenderBox::paintBackgroundExtended):
        (WebCore::RenderBox::outlineBox):
        * rendering/render_box.h:
        * rendering/render_flow.cpp:
        (RenderFlow::paintFocusRing):
        (RenderFlow::paintOutlineForLine):
        * rendering/render_form.cpp:
        (RenderFieldset::paintBorderMinusLegend):
        * rendering/render_frames.cpp:
        (WebCore::RenderFrameSet::userResize):
        * rendering/render_image.cpp:
        (WebCore::RenderImage::paint):
        * rendering/render_layer.h:
        * rendering/render_line.cpp:
        (WebCore::InlineFlowBox::paintBackgrounds):
        (WebCore::InlineFlowBox::paintBackground):
        (WebCore::InlineFlowBox::paintBackgroundAndBorder):
        (WebCore::InlineFlowBox::paintDecorations):
        (WebCore::EllipsisBox::paint):
        * rendering/render_line.h:
        * rendering/render_list.cpp:
        (RenderListMarker::paint):
        * rendering/render_object.cpp:
        (WebCore::RenderObject::drawBorder):
        (WebCore::RenderObject::paintBorder):
        (WebCore::RenderObject::paintOutline):
        (WebCore::RenderObject::selectionColor):
        (WebCore::RenderObject::getTextDecorationColors):
        * rendering/render_object.h:
        (WebCore::RenderObject::paintBackgroundExtended):
        * rendering/render_replaced.cpp:
        (WebCore::RenderReplaced::selectionColor):
        * rendering/render_replaced.h:
        * rendering/render_style.h:
        (khtml::BorderValue::isTransparent):
        (khtml::CollapsedBorderValue::color):
        (khtml::RenderStyle::hasBackground):
        (khtml::RenderStyle::borderLeftColor):
        (khtml::RenderStyle::borderRightColor):
        (khtml::RenderStyle::borderTopColor):
        (khtml::RenderStyle::borderBottomColor):
        (khtml::RenderStyle::outlineColor):
        (khtml::RenderStyle::color):
        (khtml::RenderStyle::backgroundColor):
        (khtml::RenderStyle::setBackgroundColor):
        (khtml::RenderStyle::setBorderLeftColor):
        (khtml::RenderStyle::setBorderRightColor):
        (khtml::RenderStyle::setBorderTopColor):
        (khtml::RenderStyle::setBorderBottomColor):
        (khtml::RenderStyle::setOutlineColor):
        (khtml::RenderStyle::setColor):
        (khtml::RenderStyle::initialColor):
        * rendering/render_theme.cpp:
        (khtml::RenderTheme::isControlStyled):
        * rendering/render_theme.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@12340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f5f07f15
This diff is collapsed.
......@@ -24,7 +24,7 @@
#define KDOM_KDOMSettings_H
#if SVG_SUPPORT
#include <qcolor.h>
#include "Color.h"
#include <qstring.h>
class KConfig;
......@@ -32,9 +32,9 @@ struct KPerDomainSettings;
// browser window color defaults -- Bernd
#define DOM_DEFAULT_LNK_COLOR Qt::blue
#define DOM_DEFAULT_TXT_COLOR Qt::black
#define DOM_DEFAULT_TXT_COLOR Color::black
#define DOM_DEFAULT_VLNK_COLOR Qt::magenta
#define DOM_DEFAULT_BASE_COLOR Qt::white
#define DOM_DEFAULT_BASE_COLOR Color::white
// KEEP IN SYNC WITH konqdefaults.h in kdebase/libkonq!
// lets be modern .. -- Bernd
......@@ -158,10 +158,10 @@ namespace KDOM
const QString &encoding() const;
// Color settings
const QColor &textColor() const;
const QColor &baseColor() const;
const QColor &linkColor() const;
const QColor &vLinkColor() const;
const Color &textColor() const;
const Color &baseColor() const;
const Color &linkColor() const;
const Color &vLinkColor() const;
// Java and JavaScript
bool isJavaEnabled(const QString &hostname = QString::null) const;
......
......@@ -27,14 +27,12 @@
using namespace KDOM;
RGBColorImpl::RGBColorImpl(const QRgb &color) : Shared<RGBColorImpl>()
RGBColorImpl::RGBColorImpl(const RGBA32 &color) : Shared<RGBColorImpl>(), m_color(color)
{
m_color = color;
}
RGBColorImpl::RGBColorImpl(const QColor &color) : Shared<RGBColorImpl>()
RGBColorImpl::RGBColorImpl(const Color &color) : Shared<RGBColorImpl>(), m_color(color)
{
m_color = color.rgb();
}
RGBColorImpl::~RGBColorImpl()
......@@ -43,17 +41,17 @@ RGBColorImpl::~RGBColorImpl()
CSSPrimitiveValueImpl *RGBColorImpl::red() const
{
return new CSSPrimitiveValueImpl(float(qAlpha(m_color) ? qRed(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
return new CSSPrimitiveValueImpl(float(m_color.alpha() ? m_color.red() : 0), CSSPrimitiveValue::CSS_DIMENSION);
}
CSSPrimitiveValueImpl *RGBColorImpl::green() const
{
return new CSSPrimitiveValueImpl(float(qAlpha(m_color) ? qGreen(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
return new CSSPrimitiveValueImpl(float(m_color.alpha() ? m_color.green() : 0), CSSPrimitiveValue::CSS_DIMENSION);
}
CSSPrimitiveValueImpl *RGBColorImpl::blue() const
{
return new CSSPrimitiveValueImpl(float(qAlpha(m_color) ? qBlue(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
return new CSSPrimitiveValueImpl(float(m_color.alpha() ? m_color.blue() : 0), CSSPrimitiveValue::CSS_DIMENSION);
}
// vim:ts=4:noet
......
......@@ -26,7 +26,7 @@
#include "Shared.h"
#include <qcolor.h>
#include "Color.h"
namespace KDOM
{
......@@ -35,8 +35,8 @@ namespace KDOM
class RGBColorImpl : public Shared<RGBColorImpl>
{
public:
RGBColorImpl(const QRgb &color);
RGBColorImpl(const QColor &color);
RGBColorImpl(const RGBA32 &color);
RGBColorImpl(const Color &color);
virtual ~RGBColorImpl();
// 'RGBColorImpl' functions
......@@ -45,7 +45,7 @@ namespace KDOM
CSSPrimitiveValueImpl *blue() const;
protected:
QRgb m_color;
Color m_color;
};
};
......
This diff is collapsed.
......@@ -27,7 +27,7 @@
#import "DOMCSS.h"
#import "DOMInternal.h"
#import "KWQColor.h"
#import "Color.h"
#import "KWQFoundationExtras.h"
#import "css_base.h"
#import "css_ruleimpl.h"
......@@ -71,7 +71,7 @@ using namespace DOM;
@end
@interface DOMRGBColor (WebCoreInternal)
+ (DOMRGBColor *)_RGBColorWithRGB:(QRgb)value;
+ (DOMRGBColor *)_RGBColorWithRGB:(RGBA32)value;
@end
@interface DOMRect (WebCoreInternal)
......@@ -995,14 +995,14 @@ using namespace DOM;
static CFMutableDictionaryRef wrapperCache = NULL;
id getWrapperForRGB(QRgb value)
id getWrapperForRGB(RGBA32 value)
{
if (!wrapperCache)
return nil;
return (id)CFDictionaryGetValue(wrapperCache, reinterpret_cast<const void *>(value));
}
void setWrapperForRGB(id wrapper, QRgb value)
void setWrapperForRGB(id wrapper, RGBA32 value)
{
if (!wrapperCache) {
// No need to retain/free either impl key, or id value. Items will be removed
......@@ -1012,7 +1012,7 @@ void setWrapperForRGB(id wrapper, QRgb value)
CFDictionarySetValue(wrapperCache, reinterpret_cast<const void *>(value), wrapper);
}
void removeWrapperForRGB(QRgb value)
void removeWrapperForRGB(RGBA32 value)
{
if (!wrapperCache)
return;
......@@ -1023,33 +1023,33 @@ void removeWrapperForRGB(QRgb value)
- (void)dealloc
{
removeWrapperForRGB(reinterpret_cast<QRgb>(_internal));
removeWrapperForRGB(reinterpret_cast<RGBA32>(_internal));
[super dealloc];
}
- (void)finalize
{
removeWrapperForRGB(reinterpret_cast<QRgb>(_internal));
removeWrapperForRGB(reinterpret_cast<RGBA32>(_internal));
[super finalize];
}
- (DOMCSSPrimitiveValue *)red
{
QRgb rgb = reinterpret_cast<QRgb>(_internal);
RGBA32 rgb = reinterpret_cast<RGBA32>(_internal);
int value = (rgb >> 16) & 0xFF;
return [DOMCSSPrimitiveValue _valueWithImpl:new CSSPrimitiveValueImpl(value, DOM::CSSPrimitiveValue::CSS_NUMBER)];
}
- (DOMCSSPrimitiveValue *)green
{
QRgb rgb = reinterpret_cast<QRgb>(_internal);
RGBA32 rgb = reinterpret_cast<RGBA32>(_internal);
int value = (rgb >> 8) & 0xFF;
return [DOMCSSPrimitiveValue _valueWithImpl:new CSSPrimitiveValueImpl(value, DOM::CSSPrimitiveValue::CSS_NUMBER)];
}
- (DOMCSSPrimitiveValue *)blue
{
QRgb rgb = reinterpret_cast<QRgb>(_internal);
RGBA32 rgb = reinterpret_cast<RGBA32>(_internal);
int value = rgb & 0xFF;
return [DOMCSSPrimitiveValue _valueWithImpl:new CSSPrimitiveValueImpl(value, DOM::CSSPrimitiveValue::CSS_NUMBER)];
}
......@@ -1063,7 +1063,7 @@ void removeWrapperForRGB(QRgb value)
@implementation DOMRGBColor (WebCoreInternal)
- (id)_initWithRGB:(QRgb)value
- (id)_initWithRGB:(RGBA32)value
{
[super _init];
_internal = reinterpret_cast<DOMObjectInternal *>(value);
......@@ -1071,7 +1071,7 @@ void removeWrapperForRGB(QRgb value)
return self;
}
+ (DOMRGBColor *)_RGBColorWithRGB:(QRgb)value
+ (DOMRGBColor *)_RGBColorWithRGB:(RGBA32)value
{
id cachedInstance;
cachedInstance = getWrapperForRGB(value);
......@@ -1087,8 +1087,8 @@ void removeWrapperForRGB(QRgb value)
- (DOMCSSPrimitiveValue *)alpha
{
QRgb rgb = reinterpret_cast<QRgb>(_internal);
float value = (float)qAlpha(rgb) / 0xFF;
RGBA32 rgb = reinterpret_cast<RGBA32>(_internal);
float value = (float)Color(rgb).alpha() / 0xFF;
return [DOMCSSPrimitiveValue _valueWithImpl:new CSSPrimitiveValueImpl(value, DOM::CSSPrimitiveValue::CSS_NUMBER)];
}
......@@ -1099,8 +1099,8 @@ void removeWrapperForRGB(QRgb value)
- (NSColor *)_color
{
QRgb rgb = reinterpret_cast<QRgb>(_internal);
return nsColor(QColor(rgb));
RGBA32 rgb = reinterpret_cast<RGBA32>(_internal);
return nsColor(Color(rgb));
}
@end
......
......@@ -2472,9 +2472,9 @@ NSAttributedString *MacFrame::attributedString(NodeImpl *_start, int startOffset
if (text.length() > 0 || needSpace) {
NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
[attrs setObject:font forKey:NSFontAttributeName];
if (style && style->color().isValid() && qAlpha(style->color().rgb()) != 0)
if (style && style->color().isValid() && style->color().alpha() != 0)
[attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
if (style && style->backgroundColor().isValid() && qAlpha(style->backgroundColor().rgb()) != 0)
if (style && style->backgroundColor().isValid() && style->backgroundColor().alpha() != 0)
[attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
if (text.length() > 0) {
......@@ -2923,7 +2923,7 @@ NSDictionary *MacFrame::fontAttributesForSelectionStart() const
if (style->font().getNSFont())
[result setObject:style->font().getNSFont() forKey:NSFontAttributeName];
if (style->color().isValid() && style->color() != black)
if (style->color().isValid() && style->color() != Color::black)
[result setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
ShadowData *shadow = style->textShadow();
......@@ -3076,7 +3076,7 @@ void MacFrame::setDisplaysWithFocusAttributes(bool flag)
NSColor *MacFrame::bodyBackgroundColor() const
{
if (document() && document()->body() && document()->body()->renderer()) {
QColor bgColor = document()->body()->renderer()->style()->backgroundColor();
Color bgColor = document()->body()->renderer()->style()->backgroundColor();
if (bgColor.isValid()) {
return nsColor(bgColor);
}
......@@ -3422,13 +3422,13 @@ static QValueList<MarkedTextUnderline> convertAttributesToUnderlines(const Range
continue;
NSRange range = [[ranges objectAtIndex:i] rangeValue];
NSColor *color = [[attributes objectAtIndex:i] objectForKey:NSUnderlineColorAttributeName];
QColor qColor = Qt::black;
Color qColor = Color::black;
if (color) {
NSColor* deviceColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
qColor = QColor(qRgba((int)(255 * [deviceColor redComponent]),
(int)(255 * [deviceColor blueComponent]),
(int)(255 * [deviceColor greenComponent]),
(int)(255 * [deviceColor alphaComponent])));
qColor = Color(makeRGBA((int)(255 * [deviceColor redComponent]),
(int)(255 * [deviceColor blueComponent]),
(int)(255 * [deviceColor greenComponent]),
(int)(255 * [deviceColor alphaComponent])));
}
result.append(MarkedTextUnderline(range.location + baseOffset,
......
......@@ -782,7 +782,7 @@ CSSPrimitiveValueImpl::CSSPrimitiveValueImpl( DashboardRegionImpl *r)
}
#endif
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(QRgb color)
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(RGBA32 color)
{
m_value.rgbcolor = color;
m_type = CSSPrimitiveValue::CSS_RGBCOLOR;
......@@ -1055,16 +1055,16 @@ DOMString CSSPrimitiveValueImpl::cssText() const
break;
}
case CSSPrimitiveValue::CSS_RGBCOLOR: {
QColor color(m_value.rgbcolor);
if (qAlpha(m_value.rgbcolor) < 0xFF)
Color color(m_value.rgbcolor);
if (color.alpha() < 0xFF)
text = "rgba(";
else
text = "rgb(";
text += QString::number(color.red()) + ", ";
text += QString::number(color.green()) + ", ";
text += QString::number(color.blue());
if (qAlpha(m_value.rgbcolor) < 0xFF)
text += ", " + QString::number((float)qAlpha(m_value.rgbcolor) / 0xFF);
if (color.alpha() < 0xFF)
text += ", " + QString::number((float)color.alpha() / 0xFF);
text += ")";
break;
}
......
......@@ -22,7 +22,7 @@
#ifndef css_helper_h
#define css_helper_h
#include <qcolor.h>
#include "Color.h"
#include <qfont.h>
#include "dom/dom_string.h"
......
......@@ -229,9 +229,9 @@ bool CSSParser::parseValue( CSSMutableStyleDeclarationImpl *declaration, int _id
return ok;
}
QRgb CSSParser::parseColor(const DOMString &string)
RGBA32 CSSParser::parseColor(const DOMString &string)
{
QRgb color = 0;
RGBA32 color = 0;
RefPtr<CSSMutableStyleDeclarationImpl>dummyStyleDeclaration = new CSSMutableStyleDeclarationImpl;
CSSParser parser(true);
......@@ -2163,7 +2163,7 @@ CSSValueListImpl *CSSParser::parseFontFamily()
}
bool CSSParser::parseColor(const QString &name, QRgb& rgb)
bool CSSParser::parseColor(const QString &name, RGBA32& rgb)
{
int len = name.length();
......@@ -2192,7 +2192,7 @@ bool CSSParser::parseColor(const QString &name, QRgb& rgb)
}
// try a little harder
QColor tc;
Color tc;
tc.setNamedColor(name.lower());
if (tc.isValid()) {
rgb = tc.rgb();
......@@ -2210,7 +2210,7 @@ CSSPrimitiveValueImpl *CSSParser::parseColor()
CSSPrimitiveValueImpl *CSSParser::parseColorFromValue(Value* value)
{
QRgb c = transparentColor;
RGBA32 c = Color::transparent;
if ( !strict && value->unit == CSSPrimitiveValue::CSS_NUMBER &&
value->fValue >= 0. && value->fValue < 1000000. ) {
QString str;
......@@ -2249,7 +2249,7 @@ CSSPrimitiveValueImpl *CSSParser::parseColorFromValue(Value* value)
r = kMax( 0, kMin( 255, r ) );
g = kMax( 0, kMin( 255, g ) );
b = kMax( 0, kMin( 255, b ) );
c = qRgb( r, g, b );
c = makeRGB( r, g, b );
}
else if ( value->unit == Value::Function &&
value->function->args != 0 &&
......@@ -2284,7 +2284,7 @@ CSSPrimitiveValueImpl *CSSParser::parseColorFromValue(Value* value)
g = kMax( 0, kMin( 255, g ) );
b = kMax( 0, kMin( 255, b ) );
int a = (int)(kMax( 0.0, kMin( 1.0, v->fValue ) ) * 255);
c = qRgba( r, g, b, a );
c = makeRGBA( r, g, b, a );
}
else
return 0;
......
......@@ -23,7 +23,7 @@
#define _CSS_cssparser_h_
#include <qstring.h>
#include <qcolor.h>
#include "Color.h"
#include <dom/dom_string.h>
#include "xml/dom_atomicstring.h"
......@@ -110,7 +110,7 @@ namespace DOM {
DOM::CSSRuleImpl *parseRule( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string );
bool parseValue( DOM::CSSMutableStyleDeclarationImpl *decls, int id, const DOM::DOMString &string,
bool _important );
static QRgb CSSParser::parseColor( const DOM::DOMString &string );
static RGBA32 CSSParser::parseColor( const DOM::DOMString &string );
bool parseColor( DOM::CSSMutableStyleDeclarationImpl *declaration, const DOM::DOMString &string );
bool parseDeclaration( DOM::CSSMutableStyleDeclarationImpl *decls, const DOM::DOMString &string );
......@@ -156,7 +156,7 @@ namespace DOM {
CSSValueImpl *parseSVGStrokeDasharray();
#endif
static bool parseColor(const QString &name, QRgb& rgb);
static bool parseColor(const QString &name, RGBA32& rgb);
// CSS3 Parsing Routines (for properties specific to CSS3)
bool parseShadow(int propId, bool important);
......
......@@ -667,8 +667,8 @@ bool CSSStyleSelector::canShareStyleWithElement(NodeImpl* n)
bool linksMatch = true;
if (s->isLink()) {
// We need to check to see if the visited state matches.
QColor linkColor = element->getDocument()->linkColor();
QColor visitedColor = element->getDocument()->visitedLinkColor();
Color linkColor = element->getDocument()->linkColor();
Color visitedColor = element->getDocument()->visitedLinkColor();
if (pseudoState == PseudoUnknown)
checkPseudoState(element, s->renderer()->style()->pseudoState() != PseudoAnyLink ||
linkColor != visitedColor);
......@@ -1657,7 +1657,7 @@ static Length convertToLength( CSSPrimitiveValueImpl *primitiveValue, RenderStyl
// color mapping code
struct colorMap {
int css_value;
QRgb color;
RGBA32 color;
};
static const colorMap cmap[] = {
......@@ -1678,7 +1678,7 @@ static const colorMap cmap[] = {
{ CSS_VAL_TEAL, 0xFF008080 },
{ CSS_VAL_WHITE, 0xFFFFFFFF },
{ CSS_VAL_YELLOW, 0xFFFFFF00 },
{ CSS_VAL_TRANSPARENT, transparentColor },
{ CSS_VAL_TRANSPARENT, Color::transparent },
{ CSS_VAL_GREY, 0xFF808080 },
{ CSS_VAL_ACTIVEBORDER, 0xFFE0E0E0 },
{ CSS_VAL_ACTIVECAPTION, 0xFF000000 },
......@@ -1712,7 +1712,7 @@ static const colorMap cmap[] = {
};
static QColor colorForCSSValue( int css_value )
static Color colorForCSSValue( int css_value )
{
// try the regular ones first
const colorMap *col = cmap;
......@@ -1721,7 +1721,7 @@ static QColor colorForCSSValue( int css_value )
if ( col->css_value )
return col->color;
return QColor();
return Color();
}
void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant,
......@@ -2343,7 +2343,7 @@ void CSSStyleSelector::applyProperty( int id, CSSValueImpl *value )
case CSS_PROP_OUTLINE_COLOR:
// this property is an extension used to get HTML4 <font> right.
{
QColor col;
Color col;
if (isInherit) {
HANDLE_INHERIT_COND(CSS_PROP_BACKGROUND_COLOR, backgroundColor, BackgroundColor)
HANDLE_INHERIT_COND(CSS_PROP_BORDER_TOP_COLOR, borderTopColor, BorderTopColor)
......@@ -3208,10 +3208,10 @@ void CSSStyleSelector::applyProperty( int id, CSSValueImpl *value )
style->setBorderRightColor(parentStyle->borderRightColor());
}
else if (isInitial) {
style->setBorderTopColor(QColor()); // Reset to invalid color so currentColor is used instead.
style->setBorderBottomColor(QColor());
style->setBorderLeftColor(QColor());
style->setBorderRightColor(QColor());
style->setBorderTopColor(Color()); // Reset to invalid color so currentColor is used instead.
style->setBorderBottomColor(Color());
style->setBorderLeftColor(Color());
style->setBorderRightColor(Color());
}
}
if (id == CSS_PROP_BORDER || id == CSS_PROP_BORDER_STYLE)
......@@ -3566,7 +3566,7 @@ void CSSStyleSelector::applyProperty( int id, CSSValueImpl *value )
int x = item->x->computeLength(style, paintDeviceMetrics);
int y = item->y->computeLength(style, paintDeviceMetrics);
int blur = item->blur ? item->blur->computeLength(style, paintDeviceMetrics) : 0;
QColor col = transparentColor;
Color col = Color::transparent;
if (item->color) {
int ident = item->color->getIdent();
if (ident)
......@@ -4265,16 +4265,16 @@ float CSSStyleSelector::smallerFontSize(float size, bool quirksMode) const
return size/1.2;
}
QColor CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValueImpl* primitiveValue)
Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValueImpl* primitiveValue)
{
QColor col;
Color col;
int ident = primitiveValue->getIdent();
if (ident) {
if (ident == CSS_VAL__KHTML_TEXT)
col = element->getDocument()->textColor();
else if (ident == CSS_VAL__KHTML_LINK) {
QColor linkColor = element->getDocument()->linkColor();
QColor visitedColor = element->getDocument()->visitedLinkColor();
Color linkColor = element->getDocument()->linkColor();
Color visitedColor = element->getDocument()->visitedLinkColor();
if (linkColor == visitedColor)
col = linkColor;
else {
......
......@@ -141,7 +141,7 @@ namespace khtml
void setFontSize(FontDef& fontDef, float size);
float getComputedSizeFromSpecifiedSize(bool isAbsoluteSize, float specifiedSize);
QColor getColorFromPrimitiveValue(DOM::CSSPrimitiveValueImpl* primitiveValue);
Color getColorFromPrimitiveValue(DOM::CSSPrimitiveValueImpl* primitiveValue);
QPaintDeviceMetrics* paintMetrics() const { return paintDeviceMetrics; }
......@@ -184,7 +184,7 @@ namespace khtml
bool m_hasUAAppearance;
BorderData m_borderData;
BackgroundLayer m_backgroundData;
QColor m_backgroundColor;
Color m_backgroundColor;
public:
static RenderStyle* styleNotYetAvailable;
......
......@@ -27,7 +27,7 @@
#include "KCanvasResources.h"
#include "FloatSize.h"
#include <qcolor.h>
#include "Color.h"
#include <qstringlist.h>
#ifdef __OBJC__
......@@ -405,8 +405,8 @@ public:
KCanvasFEDiffuseLighting() : m_lightSource(0) { }
~KCanvasFEDiffuseLighting() { delete m_lightSource; }
QColor lightingColor() const { return m_lightingColor; }
void setLightingColor(const QColor &lightingColor) { m_lightingColor = lightingColor; }
Color lightingColor() const { return m_lightingColor; }
void setLightingColor(const Color &lightingColor) { m_lightingColor = lightingColor; }
float surfaceScale() const { return m_surfaceScale; }
void setSurfaceScale(float surfaceScale) { m_surfaceScale = surfaceScale; }
......@@ -426,7 +426,7 @@ public:
QTextStream &externalRepresentation(QTextStream &) const;
private:
QColor m_lightingColor;
Color m_lightingColor;
float m_surfaceScale;
float m_diffuseConstant;
float m_kernelUnitLengthX;
......@@ -459,8 +459,8 @@ private:
class KCanvasFEFlood : public KCanvasFilterEffect
{
public:
QColor floodColor() const { return m_floodColor; }
void setFloodColor(const QColor &color) { m_floodColor = color; }
Color floodColor() const { return m_floodColor; }
void setFloodColor(const Color &color) { m_floodColor = color; }
float floodOpacity() const { return m_floodOpacity; }
void setFloodOpacity(float floodOpacity) { m_floodOpacity = floodOpacity; }
......@@ -468,7 +468,7 @@ public:
QTextStream &externalRepresentation(QTextStream &) const;
private:
QColor m_floodColor;
Color m_floodColor;
float m_floodOpacity;
};
......@@ -565,8 +565,8 @@ public:
KCanvasFESpecularLighting() : m_lightSource(0) { }
~KCanvasFESpecularLighting() { delete m_lightSource; }
QColor lightingColor() const { return m_lightingColor; }
void setLightingColor(const QColor &lightingColor) { m_lightingColor = lightingColor; }
Color lightingColor() const { return m_lightingColor; }
void setLightingColor(const Color &lightingColor) { m_lightingColor = lightingColor; }
float surfaceScale() const { return m_surfaceScale; }
void setSurfaceScale(float surfaceScale) { m_surfaceScale = surfaceScale; }
......@@ -589,7 +589,7 @@ public:
QTextStream &externalRepresentation(QTextStream &) const;
private:
QColor m_lightingColor;
Color m_lightingColor;
float m_surfaceScale;
float m_specularConstant;
float m_specularExponent;
......
......@@ -172,7 +172,7 @@ QTextStream &operator<<(QTextStream &ts, const QMatrix &m)
return ts;
}
QTextStream &operator<<(QTextStream &ts, const QColor &c)
QTextStream &operator<<(QTextStream &ts, const Color &c)
{
return ts << c.name();
}
......
......@@ -28,7 +28,6 @@
#include <q3valuelist.h>
class QMatrix;
class QColor;
class QStringList;
class KCClipData;
class KCPathData;
......@@ -37,6 +36,7 @@ class RenderPath;
class KCanvasContainer;
namespace WebCore {
class Color;
class FloatSize;
class FloatPoint;
class FloatRect;
......@@ -56,7 +56,7 @@ void writeRenderResources(QTextStream &ts, KDOM::NodeImpl *parent);
// helper operators defined used in various classes to dump the render tree.
QTextStream &operator<<(QTextStream &ts, const QMatrix &);
QTextStream &operator<<(QTextStream &ts, const WebCore::IntRect &);
QTextStream &operator<<(QTextStream &ts, const QColor &);
QTextStream &operator<<(QTextStream &ts, const WebCore::Color &);
QTextStream &operator<<(QTextStream &ts, const WebCore::IntPoint &);
QTextStream &operator<<(QTextStream &ts, const WebCore::FloatSize &);
QTextStream &operator<<(QTextStream &ts, const WebCore::FloatRect &);
......
......@@ -24,7 +24,7 @@
#define KRenderingDevice_H
#if SVG_SUPPORT
#include <qcolor.h>
#include "Color.h"
#include <qobject.h>
#include <q3ptrstack.h>
......