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

Unified Diff: Source/core/css/CSSGradientValue.cpp

Issue 767343003: Make currentColor keyword in linear-gradient work (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Resolve gradient colors later Created 6 years 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
« Source/core/css/CSSGradientValue.h ('K') | « Source/core/css/CSSGradientValue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSGradientValue.cpp
diff --git a/Source/core/css/CSSGradientValue.cpp b/Source/core/css/CSSGradientValue.cpp
index 1fe20b2c583d2f4faa94fa32eec31e5a2e1b0efc..03479afd02eb0e92a6ebc72ca90a9c46f6c6817d 100644
--- a/Source/core/css/CSSGradientValue.cpp
+++ b/Source/core/css/CSSGradientValue.cpp
@@ -71,9 +71,9 @@ PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize&
RenderStyle* rootStyle = renderer->document().documentElement()->renderStyle();
CSSToLengthConversionData conversionData(renderer->style(), rootStyle, renderer->view(), renderer->style()->effectiveZoom());
if (isLinearGradientValue())
- gradient = toCSSLinearGradientValue(this)->createGradient(conversionData, size);
+ gradient = toCSSLinearGradientValue(this)->createGradient(conversionData, size, *renderer);
else
- gradient = toCSSRadialGradientValue(this)->createGradient(conversionData, size);
+ gradient = toCSSRadialGradientValue(this)->createGradient(conversionData, size, *renderer);
RefPtr<Image> newImage = GradientGeneratedImage::create(gradient, size);
if (cacheable)
@@ -233,7 +233,7 @@ static void replaceColorHintsWithColorStops(WillBeHeapVector<GradientStop>& stop
}
}
-void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat)
+void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat, const RenderObject& object)
{
if (m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CSSDeprecatedRadialGradient) {
sortStopsIfNeeded();
@@ -275,7 +275,7 @@ void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionD
if (stop.isHint())
hasHints = true;
else
- stops[i].color = stop.m_resolvedColor;
+ stops[i].color = object.document().textLinkColors().colorFromPrimitiveValue(stop.m_color.get(), object.style()->visitedDependentColor(CSSPropertyColor));
if (stop.m_position) {
if (stop.m_position->isPercentage())
@@ -767,7 +767,7 @@ static void endPointsFromAngle(float angleDeg, const IntSize& size, FloatPoint&
firstPoint.set(halfWidth - endX, halfHeight + endY);
}
-PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(const CSSToLengthConversionData& conversionData, const IntSize& size)
+PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(const CSSToLengthConversionData& conversionData, const IntSize& size, const RenderObject& object)
{
ASSERT(!size.isEmpty());
@@ -828,7 +828,7 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(const CSSToLengthCon
gradient->setDrawsInPMColorSpace(true);
// Now add the stops.
- addStops(gradient.get(), conversionData, 1);
+ addStops(gradient.get(), conversionData, 1, object);
return gradient.release();
}
@@ -1112,7 +1112,7 @@ static inline float horizontalEllipseRadius(const FloatSize& p, float aspectRati
}
// FIXME: share code with the linear version
-PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(const CSSToLengthConversionData& conversionData, const IntSize& size)
+PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(const CSSToLengthConversionData& conversionData, const IntSize& size, const RenderObject& object)
{
ASSERT(!size.isEmpty());
@@ -1249,7 +1249,7 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(const CSSToLengthCon
}
// Now add the stops.
- addStops(gradient.get(), conversionData, maxExtent);
+ addStops(gradient.get(), conversionData, maxExtent, object);
return gradient.release();
}
« Source/core/css/CSSGradientValue.h ('K') | « Source/core/css/CSSGradientValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698