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

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

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 940b6a059bdc7bb1787faadf0015652220d254f8..95c0ed17f8d17d32242e5b2c2882cdeedd20d8c1 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -652,7 +652,7 @@ static PassRefPtr<CSSValue> valueForPositionOffset(RenderStyle* style, CSSProper
return zoomAdjustedPixelValueForLength(l, style);
}
-PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(RenderStyle* style, const StyleColor& color) const
+PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(RenderStyle* style, const Color& color) const
{
// This function does NOT look at visited information, so that computed style doesn't expose that.
if (!color.isValid())
@@ -660,23 +660,6 @@ PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo
return cssValuePool().createColorValue(color.rgb());
}
-PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(const RenderObject* renderer, const RenderStyle* style, int colorProperty) const
-{
- Color color;
- if (renderer) {
- if (m_allowVisitedStyle)
- color = renderer->resolveColor(colorProperty);
- else
- color = renderer->resolveColor(style->colorIncludingFallback(colorProperty, false /* visited */));
- } else {
- if (m_allowVisitedStyle)
- color = style->visitedDependentColor(colorProperty).color();
- else
- color = style->colorIncludingFallback(colorProperty, false /* visited */).color();
- }
- return cssValuePool().createColorValue(color.rgb());
-}
-
static PassRefPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, const RenderStyle* style, RenderView* renderView)
{
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
@@ -933,7 +916,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj
filterValue = CSSFilterValue::create(CSSFilterValue::DropShadowFilterOperation);
// We want our computed style to look like that of a text shadow (has neither spread nor inset style).
OwnPtr<ShadowData> shadow = ShadowData::create(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, dropShadowOperation->color());
- filterValue->append(valueForShadow(renderer, shadow.get(), CSSPropertyTextShadow, style));
+ filterValue->append(valueForShadow(shadow.get(), CSSPropertyTextShadow, style));
break;
}
case FilterOperation::VALIDATED_CUSTOM:
@@ -1323,7 +1306,7 @@ bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
return style->fontDescription().useFixedDefaultSize();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const RenderObject* renderer, const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style) const
{
if (!shadow)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1335,7 +1318,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const RenderObj
RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(s->blur(), style);
RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : zoomAdjustedPixelValue(s->spread(), style);
RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool().createIdentifierValue(CSSValueInset);
- RefPtr<CSSPrimitiveValue> color = cssValuePool().createColorValue(renderer ? renderer->resolveColor(s->color()).rgb() : s->color().rgb());
+ RefPtr<CSSPrimitiveValue> color = cssValuePool().createColorValue(s->color().rgb());
list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
}
return list.release();
@@ -1668,7 +1651,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
break;
case CSSPropertyBackgroundColor:
- return cssValuePool().createColorValue(renderer->resolveColor(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor()).rgb());
+ return cssValuePool().createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
case CSSPropertyBackgroundImage:
case CSSPropertyWebkitMaskImage: {
const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
@@ -1814,13 +1797,13 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return style->borderImageSource()->cssValue();
return cssValuePool().createIdentifierValue(CSSValueNone);
case CSSPropertyBorderTopColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyBorderTopColor);
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
case CSSPropertyBorderRightColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyBorderRightColor);
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor());
case CSSPropertyBorderBottomColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyBorderBottomColor);
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor());
case CSSPropertyBorderLeftColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyBorderLeftColor);
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor());
case CSSPropertyBorderTopStyle:
return cssValuePool().createValue(style->borderTopStyle());
case CSSPropertyBorderRightStyle:
@@ -1863,7 +1846,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return valueForReflection(style->boxReflect(), style.get());
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow:
- return valueForShadow(renderer, style->boxShadow(), propertyID, style.get());
+ return valueForShadow(style->boxShadow(), propertyID, style.get());
case CSSPropertyCaptionSide:
return cssValuePool().createValue(style->captionSide());
case CSSPropertyClear:
@@ -1885,7 +1868,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitColumnProgression:
return cssValuePool().createValue(style->columnProgression());
case CSSPropertyWebkitColumnRuleColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyWebkitColumnRuleColor);
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
case CSSPropertyWebkitColumnRuleStyle:
return cssValuePool().createValue(style->columnRuleStyle());
case CSSPropertyWebkitColumnRuleWidth:
@@ -2159,7 +2142,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return cssValuePool().createIdentifierValue(CSSValueAuto);
return cssValuePool().createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyOutlineColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyOutlineColor);
+ return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor());
case CSSPropertyOutlineOffset:
return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
case CSSPropertyOutlineStyle:
@@ -2238,9 +2221,9 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitTextDecorationsInEffect:
return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
case CSSPropertyWebkitTextFillColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyWebkitTextFillColor);
+ return currentColorOrValidColor(style.get(), style->textFillColor());
case CSSPropertyWebkitTextEmphasisColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyWebkitTextEmphasisColor);
+ return currentColorOrValidColor(style.get(), style->textEmphasisColor());
case CSSPropertyWebkitTextEmphasisPosition:
return cssValuePool().createValue(style->textEmphasisPosition());
case CSSPropertyWebkitTextEmphasisStyle:
@@ -2274,7 +2257,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return textIndent.release();
}
case CSSPropertyTextShadow:
- return valueForShadow(renderer, style->textShadow(), propertyID, style.get());
+ return valueForShadow(style->textShadow(), propertyID, style.get());
case CSSPropertyTextRendering:
return cssValuePool().createValue(style->fontDescription().textRenderingMode());
case CSSPropertyTextOverflow:
@@ -2284,7 +2267,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitTextSecurity:
return cssValuePool().createValue(style->textSecurity());
case CSSPropertyWebkitTextStrokeColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyWebkitTextStrokeColor);
+ return currentColorOrValidColor(style.get(), style->textStrokeColor());
case CSSPropertyWebkitTextStrokeWidth:
return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
case CSSPropertyTextTransform:
@@ -2576,7 +2559,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitRtlOrdering:
return cssValuePool().createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
case CSSPropertyWebkitTapHighlightColor:
- return currentColorOrValidColor(renderer, style.get(), CSSPropertyWebkitTapHighlightColor);
+ return currentColorOrValidColor(style.get(), style->tapHighlightColor());
case CSSPropertyWebkitUserDrag:
return cssValuePool().createValue(style->userDrag());
case CSSPropertyWebkitUserSelect:

Powered by Google App Engine
This is Rietveld 408576698