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

Side by Side Diff: Source/core/css/resolver/StyleBuilderCustom.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 return true; 1088 return true;
1089 } 1089 }
1090 if (angle > 135.0f && angle <= 225.0f) { 1090 if (angle > 135.0f && angle <= 225.0f) {
1091 orientation = GO_180DEG; 1091 orientation = GO_180DEG;
1092 return true; 1092 return true;
1093 } 1093 }
1094 orientation = GO_270DEG; 1094 orientation = GO_270DEG;
1095 return true; 1095 return true;
1096 } 1096 }
1097 1097
1098 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const StyleColor& fgC olor) 1098 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor)
1099 { 1099 {
1100 Color color; 1100 Color color;
1101 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) 1101 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
1102 color = fgColor.color(); 1102 color = fgColor;
1103 else 1103 else
1104 color = svgColor->color(); 1104 color = svgColor->color();
1105 return color; 1105 return color;
1106 } 1106 }
1107 1107
1108 static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder) 1108 static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder)
1109 { 1109 {
1110 if (cssPaintOrder->isValueList()) { 1110 if (cssPaintOrder->isValueList()) {
1111 int paintOrder = 0; 1111 int paintOrder = 0;
1112 CSSValueListInspector iter(cssPaintOrder); 1112 CSSValueListInspector iter(cssPaintOrder);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i sInheritedValue()); 1259 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i sInheritedValue());
1260 1260
1261 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit 1261 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit
1262 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInhe rit -> (state.parentNode() && state.parentStyle()) 1262 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInhe rit -> (state.parentNode() && state.parentStyle())
1263 1263
1264 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLi nkStyle() || !isValidVisitedLinkProperty(id))) { 1264 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLi nkStyle() || !isValidVisitedLinkProperty(id))) {
1265 // Limit the properties that can be applied to only the ones honored by :visited. 1265 // Limit the properties that can be applied to only the ones honored by :visited.
1266 return; 1266 return;
1267 } 1267 }
1268 1268
1269 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimiti veValue(value) : 0;
1270 if (primitiveValue && primitiveValue->getValueID() == CSSValueCurrentcolor)
1271 state.style()->setHasCurrentColor();
1272
1269 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id)) 1273 if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id))
1270 state.parentStyle()->setHasExplicitlyInheritedProperties(); 1274 state.parentStyle()->setHasExplicitlyInheritedProperties();
1271 1275
1272 if (id == CSSPropertyVariable) { 1276 if (id == CSSPropertyVariable) {
1273 ASSERT_WITH_SECURITY_IMPLICATION(value->isVariableValue()); 1277 ASSERT_WITH_SECURITY_IMPLICATION(value->isVariableValue());
1274 CSSVariableValue* variable = toCSSVariableValue(value); 1278 CSSVariableValue* variable = toCSSVariableValue(value);
1275 ASSERT(!variable->name().isEmpty()); 1279 ASSERT(!variable->name().isEmpty());
1276 ASSERT(!variable->value().isEmpty()); 1280 ASSERT(!variable->value().isEmpty());
1277 state.style()->setVariable(variable->name(), variable->value()); 1281 state.style()->setVariable(variable->name(), variable->value());
1278 return; 1282 return;
(...skipping 28 matching lines...) Expand all
1307 } 1311 }
1308 1312
1309 if (!value->isValueList()) 1313 if (!value->isValueList())
1310 return; 1314 return;
1311 1315
1312 bool didSet = false; 1316 bool didSet = false;
1313 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 1317 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1314 CSSValue* item = i.value(); 1318 CSSValue* item = i.value();
1315 if (item->isImageGeneratorValue()) { 1319 if (item->isImageGeneratorValue()) {
1316 if (item->isGradientValue()) 1320 if (item->isGradientValue())
1317 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document(). textLinkColors()).get()), didSet); 1321 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document(). textLinkColors(), state.style()->color()).get()), didSet);
1318 else 1322 else
1319 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSImageGeneratorValue*>(item)), didSet); 1323 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSImageGeneratorValue*>(item)), didSet);
1320 didSet = true; 1324 didSet = true;
1321 } else if (item->isImageSetValue()) { 1325 } else if (item->isImageSetValue()) {
1322 state.style()->setContent(state.elementStyleResources().setO rPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), did Set); 1326 state.style()->setContent(state.elementStyleResources().setO rPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), did Set);
1323 didSet = true; 1327 didSet = true;
1324 } 1328 }
1325 1329
1326 if (item->isImageValue()) { 1330 if (item->isImageValue()) {
1327 state.style()->setContent(state.elementStyleResources().cach edOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet); 1331 state.style()->setContent(state.elementStyleResources().cach edOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 1491 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1488 CSSValue* currValue = i.value(); 1492 CSSValue* currValue = i.value();
1489 if (!currValue->isShadowValue()) 1493 if (!currValue->isShadowValue())
1490 continue; 1494 continue;
1491 ShadowValue* item = static_cast<ShadowValue*>(currValue); 1495 ShadowValue* item = static_cast<ShadowValue*>(currValue);
1492 int x = item->x->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor); 1496 int x = item->x->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor);
1493 int y = item->y->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor); 1497 int y = item->y->computeLength<int>(state.style(), state.rootElement Style(), zoomFactor);
1494 int blur = item->blur ? item->blur->computeLength<int>(state.style() , state.rootElementStyle(), zoomFactor) : 0; 1498 int blur = item->blur ? item->blur->computeLength<int>(state.style() , state.rootElementStyle(), zoomFactor) : 0;
1495 int spread = item->spread ? item->spread->computeLength<int>(state.s tyle(), state.rootElementStyle(), zoomFactor) : 0; 1499 int spread = item->spread ? item->spread->computeLength<int>(state.s tyle(), state.rootElementStyle(), zoomFactor) : 0;
1496 ShadowStyle shadowStyle = item->style && item->style->getValueID() = = CSSValueInset ? Inset : Normal; 1500 ShadowStyle shadowStyle = item->style && item->style->getValueID() = = CSSValueInset ? Inset : Normal;
1497 StyleColor color; 1501 Color color;
1498 if (item->color) 1502 if (item->color)
1499 color = state.document().textLinkColors().colorFromPrimitiveValu e(item->color.get()); 1503 color = state.document().textLinkColors().colorFromPrimitiveValu e(item->color.get(), state.style()->visitedDependentColor(CSSPropertyColor));
1500 else if (state.style()) 1504 else if (state.style())
1501 color = state.style()->color(); 1505 color = state.style()->color();
1502 1506
1503 if (!color.isValid()) 1507 if (!color.isValid())
1504 color = Color::transparent; 1508 color = Color::transparent;
1505 OwnPtr<ShadowData> shadow = ShadowData::create(IntPoint(x, y), blur, spread, shadowStyle, color); 1509 OwnPtr<ShadowData> shadow = ShadowData::create(IntPoint(x, y), blur, spread, shadowStyle, color);
1506 if (id == CSSPropertyTextShadow) 1510 if (id == CSSPropertyTextShadow)
1507 state.style()->setTextShadow(shadow.release(), i.index()); // ad d to the list if this is not the first entry 1511 state.style()->setTextShadow(shadow.release(), i.index()); // ad d to the list if this is not the first entry
1508 else 1512 else
1509 state.style()->setBoxShadow(shadow.release(), i.index()); // add to the list if this is not the first entry 1513 state.style()->setBoxShadow(shadow.release(), i.index()); // add to the list if this is not the first entry
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 1611
1608 if (perspectiveValue >= 0.0f) 1612 if (perspectiveValue >= 0.0f)
1609 state.style()->setPerspective(perspectiveValue); 1613 state.style()->setPerspective(perspectiveValue);
1610 return; 1614 return;
1611 } 1615 }
1612 case CSSPropertyWebkitTapHighlightColor: { 1616 case CSSPropertyWebkitTapHighlightColor: {
1613 HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor); 1617 HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor);
1614 if (!primitiveValue) 1618 if (!primitiveValue)
1615 break; 1619 break;
1616 1620
1617 StyleColor col = state.document().textLinkColors().colorFromPrimitiveVal ue(primitiveValue); 1621 Color col = state.document().textLinkColors().colorFromPrimitiveValue(pr imitiveValue, state.style()->visitedDependentColor(CSSPropertyColor));
1618 state.style()->setTapHighlightColor(col); 1622 state.style()->setTapHighlightColor(col);
1619 return; 1623 return;
1620 } 1624 }
1621 case CSSPropertyInvalid: 1625 case CSSPropertyInvalid:
1622 return; 1626 return;
1623 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch. 1627 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch.
1624 case CSSPropertyWebkitBorderEndColor: 1628 case CSSPropertyWebkitBorderEndColor:
1625 case CSSPropertyWebkitBorderEndStyle: 1629 case CSSPropertyWebkitBorderEndStyle:
1626 case CSSPropertyWebkitBorderEndWidth: 1630 case CSSPropertyWebkitBorderEndWidth:
1627 case CSSPropertyWebkitBorderStartColor: 1631 case CSSPropertyWebkitBorderStartColor:
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 break; 2384 break;
2381 } 2385 }
2382 case CSSPropertyEnableBackground: 2386 case CSSPropertyEnableBackground:
2383 // Silently ignoring this property for now 2387 // Silently ignoring this property for now
2384 // http://bugs.webkit.org/show_bug.cgi?id=6022 2388 // http://bugs.webkit.org/show_bug.cgi?id=6022
2385 break; 2389 break;
2386 } 2390 }
2387 } 2391 }
2388 2392
2389 } // namespace WebCore 2393 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698