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

Unified Diff: third_party/WebKit/Source/core/editing/EditingStyle.cpp

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase and review feedback Created 5 years, 2 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: third_party/WebKit/Source/core/editing/EditingStyle.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
index a2584dfbf666a684a6f0cd839d2c07344961a1b5..c02bfb577c1f39aaf1c6509c06685342d1082e99 100644
--- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -29,6 +29,7 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/HTMLNames.h"
+#include "core/css/CSSColorValue.h"
#include "core/css/CSSComputedStyleDeclaration.h"
#include "core/css/CSSPropertyMetadata.h"
#include "core/css/CSSRuleList.h"
@@ -396,12 +397,11 @@ EditingStyle::~EditingStyle()
static RGBA32 cssValueToRGBA(CSSValue* colorValue)
{
- if (!colorValue || !colorValue->isPrimitiveValue())
+ if (!colorValue || (!colorValue->isColorValue() && !colorValue->isPrimitiveValue()))
return Color::transparent;
- CSSPrimitiveValue* primitiveColor = toCSSPrimitiveValue(colorValue);
- if (primitiveColor->isRGBColor())
- return primitiveColor->getRGBA32Value();
+ if (colorValue->isColorValue())
+ return toCSSColorValue(colorValue)->value();
RGBA32 rgba = 0;
// FIXME: Why ignore the return value?
@@ -1694,11 +1694,11 @@ bool isTransparentColorValue(CSSValue* cssValue)
{
if (!cssValue)
return true;
+ if (cssValue->isColorValue())
+ return !alphaChannel(toCSSColorValue(cssValue)->value());
if (!cssValue->isPrimitiveValue())
return false;
CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue);
- if (value->isRGBColor())
- return !alphaChannel(value->getRGBA32Value());
return value->getValueID() == CSSValueTransparent;
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/TextLinkColors.cpp ('k') | third_party/WebKit/Source/core/html/HTMLHRElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698