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

Side by Side 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: 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 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 CSSRule* CSSComputedStyleDeclaration::parentRule() const 635 CSSRule* CSSComputedStyleDeclaration::parentRule() const
636 { 636 {
637 return nullptr; 637 return nullptr;
638 } 638 }
639 639
640 String CSSComputedStyleDeclaration::getPropertyValue(const String& propertyName) 640 String CSSComputedStyleDeclaration::getPropertyValue(const String& propertyName)
641 { 641 {
642 CSSPropertyID propertyID = cssPropertyID(propertyName); 642 CSSPropertyID propertyID = cssPropertyID(propertyName);
643 if (!propertyID) { 643 if (!propertyID) {
644 if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser ::isValidVariableName(propertyName)) 644 if (RuntimeEnabledFeatures::cssVariablesEnabled() && CSSVariableParser:: isValidVariableName(propertyName)) {
645 return String(); 645 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(AtomicStrin g(propertyName));
646 return getPropertyCSSValue(AtomicString(propertyName))->cssText(); 646 if (value)
dstockwell 2015/12/08 21:32:39 indentation
shans 2015/12/08 21:49:25 I think the indentation here is correct?
647 return value->cssText();
648 }
649 return String();
647 } 650 }
648 ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID)); 651 ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID));
649 return getPropertyValue(propertyID); 652 return getPropertyValue(propertyID);
650 } 653 }
651 654
652 String CSSComputedStyleDeclaration::getPropertyPriority(const String&) 655 String CSSComputedStyleDeclaration::getPropertyPriority(const String&)
653 { 656 {
654 // All computed styles have a priority of not "important". 657 // All computed styles have a priority of not "important".
655 return ""; 658 return "";
656 } 659 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a re computed, and therefore the '" + getPropertyNameString(id) + "' property is r ead-only."); 695 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a re computed, and therefore the '" + getPropertyNameString(id) + "' property is r ead-only.");
693 } 696 }
694 697
695 DEFINE_TRACE(CSSComputedStyleDeclaration) 698 DEFINE_TRACE(CSSComputedStyleDeclaration)
696 { 699 {
697 visitor->trace(m_node); 700 visitor->trace(m_node);
698 CSSStyleDeclaration::trace(visitor); 701 CSSStyleDeclaration::trace(visitor);
699 } 702 }
700 703
701 } // namespace blink 704 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698