Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1404)

Unified Diff: Source/core/platform/graphics/Color.cpp

Issue 20061003: Move isValid/isCurrentColor from Color to StyleColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/Color.cpp
diff --git a/Source/core/platform/graphics/Color.cpp b/Source/core/platform/graphics/Color.cpp
index 2be440495905b3c917d3c363557f0cd135bf9c5b..96aa93c896f6f618bf13fec113f55ebf42c6755b 100644
--- a/Source/core/platform/graphics/Color.cpp
+++ b/Source/core/platform/graphics/Color.cpp
@@ -44,6 +44,7 @@ const RGBA32 Color::darkGray;
const RGBA32 Color::gray;
const RGBA32 Color::lightGray;
const RGBA32 Color::transparent;
+const RGBA32 Color::stdShadowColor;
#endif
static const RGBA32 lightenedBlack = 0xFF545454;
@@ -178,28 +179,6 @@ int differenceSquared(const Color& c1, const Color& c2)
return dR * dR + dG * dG + dB * dB;
}
-Color::Color(const String& name)
-{
- if (name[0] == '#') {
- if (name.is8Bit())
- m_valid = parseHexColor(name.characters8() + 1, name.length() - 1, m_color);
- else
- m_valid = parseHexColor(name.characters16() + 1, name.length() - 1, m_color);
- } else
- setNamedColor(name);
-}
-
-Color::Color(const char* name)
-{
- if (name[0] == '#')
- m_valid = parseHexColor(&name[1], m_color);
- else {
- const NamedColor* foundColor = findColor(name, strlen(name));
- m_color = foundColor ? foundColor->ARGBValue : 0;
- m_valid = foundColor;
- }
-}
-
String Color::serialized() const
{
if (!hasAlpha()) {
@@ -244,29 +223,6 @@ String Color::nameForRenderTreeAsText() const
return String::format("#%02X%02X%02X", red(), green(), blue());
}
-static inline const NamedColor* findNamedColor(const String& name)
-{
- char buffer[64]; // easily big enough for the longest color name
- unsigned length = name.length();
- if (length > sizeof(buffer) - 1)
- return 0;
- for (unsigned i = 0; i < length; ++i) {
- UChar c = name[i];
- if (!c || c > 0x7F)
- return 0;
- buffer[i] = toASCIILower(static_cast<char>(c));
- }
- buffer[length] = '\0';
- return findColor(buffer, length);
-}
-
-void Color::setNamedColor(const String& name)
-{
- const NamedColor* foundColor = findNamedColor(name);
- m_color = foundColor ? foundColor->ARGBValue : 0;
- m_valid = foundColor;
-}
-
Color Color::light() const
{
// Hardcode this common case for speed.

Powered by Google App Engine
This is Rietveld 408576698