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

Unified Diff: third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.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: dammit tim 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp b/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
index d48c9b646cb182520c5e8bf76115bfd3637220e8..da497fdda56c1c08a7122a6283a7926e3abd0a7b 100644
--- a/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -641,9 +641,12 @@ String CSSComputedStyleDeclaration::getPropertyValue(const String& propertyName)
{
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID) {
- if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser::isValidVariableName(propertyName))
- return String();
- return getPropertyCSSValue(AtomicString(propertyName))->cssText();
+ if (RuntimeEnabledFeatures::cssVariablesEnabled() && CSSVariableParser::isValidVariableName(propertyName)) {
+ RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(AtomicString(propertyName));
+ if (value)
+ return value->cssText();
+ }
+ return String();
}
ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID));
return getPropertyValue(propertyID);

Powered by Google App Engine
This is Rietveld 408576698