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

Side by Side Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 24020008: Introduce CSS_VALUE_TYPE_CASTS macro to cast CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 { 1204 {
1205 if (value->isPrimitiveValue()) { 1205 if (value->isPrimitiveValue()) {
1206 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1206 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1207 return primitiveValue->hasVariableReference(); 1207 return primitiveValue->hasVariableReference();
1208 } 1208 }
1209 1209
1210 if (value->isCalculationValue()) 1210 if (value->isCalculationValue())
1211 return static_cast<CSSCalcValue*>(value)->hasVariableReference(); 1211 return static_cast<CSSCalcValue*>(value)->hasVariableReference();
1212 1212
1213 if (value->isReflectValue()) { 1213 if (value->isReflectValue()) {
1214 CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value); 1214 CSSReflectValue* reflectValue = toCSSReflectValue(value);
1215 CSSPrimitiveValue* direction = reflectValue->direction(); 1215 CSSPrimitiveValue* direction = reflectValue->direction();
1216 CSSPrimitiveValue* offset = reflectValue->offset(); 1216 CSSPrimitiveValue* offset = reflectValue->offset();
1217 CSSValue* mask = reflectValue->mask(); 1217 CSSValue* mask = reflectValue->mask();
1218 return (direction && hasVariableReference(direction)) || (offset && hasV ariableReference(offset)) || (mask && hasVariableReference(mask)); 1218 return (direction && hasVariableReference(direction)) || (offset && hasV ariableReference(offset)) || (mask && hasVariableReference(mask));
1219 } 1219 }
1220 1220
1221 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 1221 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1222 if (hasVariableReference(i.value())) 1222 if (hasVariableReference(i.value()))
1223 return true; 1223 return true;
1224 } 1224 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 bool didSet = false; 1325 bool didSet = false;
1326 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 1326 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1327 CSSValue* item = i.value(); 1327 CSSValue* item = i.value();
1328 if (item->isImageGeneratorValue()) { 1328 if (item->isImageGeneratorValue()) {
1329 if (item->isGradientValue()) 1329 if (item->isGradientValue())
1330 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document(). textLinkColors(), state.style()->color()).get()), didSet); 1330 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document(). textLinkColors(), state.style()->color()).get()), didSet);
1331 else 1331 else
1332 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSImageGeneratorValue*>(item)), didSet); 1332 state.style()->setContent(StyleGeneratedImage::create(st atic_cast<CSSImageGeneratorValue*>(item)), didSet);
1333 didSet = true; 1333 didSet = true;
1334 } else if (item->isImageSetValue()) { 1334 } else if (item->isImageSetValue()) {
1335 state.style()->setContent(state.elementStyleResources().setO rPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), did Set); 1335 state.style()->setContent(state.elementStyleResources().setO rPendingFromValue(CSSPropertyContent, toCSSImageSetValue(item)), didSet);
1336 didSet = true; 1336 didSet = true;
1337 } 1337 }
1338 1338
1339 if (item->isImageValue()) { 1339 if (item->isImageValue()) {
1340 state.style()->setContent(state.elementStyleResources().cach edOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet); 1340 state.style()->setContent(state.elementStyleResources().cach edOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet);
1341 didSet = true; 1341 didSet = true;
1342 continue; 1342 continue;
1343 } 1343 }
1344 1344
1345 if (!item->isPrimitiveValue()) 1345 if (!item->isPrimitiveValue())
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 case CSSPropertyWebkitBoxReflect: { 1527 case CSSPropertyWebkitBoxReflect: {
1528 HANDLE_INHERIT_AND_INITIAL(boxReflect, BoxReflect) 1528 HANDLE_INHERIT_AND_INITIAL(boxReflect, BoxReflect)
1529 if (primitiveValue) { 1529 if (primitiveValue) {
1530 state.style()->setBoxReflect(RenderStyle::initialBoxReflect()); 1530 state.style()->setBoxReflect(RenderStyle::initialBoxReflect());
1531 return; 1531 return;
1532 } 1532 }
1533 1533
1534 if (!value->isReflectValue()) 1534 if (!value->isReflectValue())
1535 return; 1535 return;
1536 1536
1537 CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value); 1537 CSSReflectValue* reflectValue = toCSSReflectValue(value);
1538 RefPtr<StyleReflection> reflection = StyleReflection::create(); 1538 RefPtr<StyleReflection> reflection = StyleReflection::create();
1539 reflection->setDirection(*reflectValue->direction()); 1539 reflection->setDirection(*reflectValue->direction());
1540 if (reflectValue->offset()) 1540 if (reflectValue->offset())
1541 reflection->setOffset(reflectValue->offset()->convertToLength<FixedI ntegerConversion | PercentConversion>(state.style(), state.rootElementStyle(), z oomFactor)); 1541 reflection->setOffset(reflectValue->offset()->convertToLength<FixedI ntegerConversion | PercentConversion>(state.style(), state.rootElementStyle(), z oomFactor));
1542 NinePieceImage mask; 1542 NinePieceImage mask;
1543 mask.setMaskDefaults(); 1543 mask.setMaskDefaults();
1544 state.styleMap().mapNinePieceImage(state.style(), id, reflectValue->mask (), mask); 1544 state.styleMap().mapNinePieceImage(state.style(), id, reflectValue->mask (), mask);
1545 reflection->setMask(mask); 1545 reflection->setMask(mask);
1546 1546
1547 state.style()->setBoxReflect(reflection.release()); 1547 state.style()->setBoxReflect(reflection.release());
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2396 break; 2396 break;
2397 } 2397 }
2398 case CSSPropertyEnableBackground: 2398 case CSSPropertyEnableBackground:
2399 // Silently ignoring this property for now 2399 // Silently ignoring this property for now
2400 // http://bugs.webkit.org/show_bug.cgi?id=6022 2400 // http://bugs.webkit.org/show_bug.cgi?id=6022
2401 break; 2401 break;
2402 } 2402 }
2403 } 2403 }
2404 2404
2405 } // namespace WebCore 2405 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ElementStyleResources.cpp ('k') | Source/core/rendering/style/StylePendingImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698