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

Side by Side Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1510963002: Ensure we don't crash when asking for variables that don't exist from the computed style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); 1349 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style));
1350 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); 1350 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style));
1351 list->append(pair); 1351 list->append(pair);
1352 } 1352 }
1353 1353
1354 return list.release(); 1354 return list.release();
1355 } 1355 }
1356 1356
1357 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS tring customPropertyName, const ComputedStyle& style) 1357 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS tring customPropertyName, const ComputedStyle& style)
1358 { 1358 {
1359 CSSVariableData* data = style.variables()->getVariable(customPropertyName);
1360 if (!data)
1361 return nullptr;
1362
1359 return CSSCustomPropertyDeclaration::create(customPropertyName, style.variab les()->getVariable(customPropertyName)); 1363 return CSSCustomPropertyDeclaration::create(customPropertyName, style.variab les()->getVariable(customPropertyName));
Timothy Loh 2015/12/08 23:53:54 Since you already looked it up, just use the local
1360 } 1364 }
1361 1365
1362 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) 1366 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
1363 { 1367 {
1364 const SVGComputedStyle& svgStyle = style.svgStyle(); 1368 const SVGComputedStyle& svgStyle = style.svgStyle();
1365 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode()); 1369 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode());
1366 switch (propertyID) { 1370 switch (propertyID) {
1367 case CSSPropertyInvalid: 1371 case CSSPropertyInvalid:
1368 return nullptr; 1372 return nullptr;
1369 1373
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 case CSSPropertyAll: 2720 case CSSPropertyAll:
2717 return nullptr; 2721 return nullptr;
2718 default: 2722 default:
2719 break; 2723 break;
2720 } 2724 }
2721 ASSERT_NOT_REACHED(); 2725 ASSERT_NOT_REACHED();
2722 return nullptr; 2726 return nullptr;
2723 } 2727 }
2724 2728
2725 } 2729 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698