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

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

Issue 2631663002: Clean up ComputedStyleCSSValueMapping after change to ComputedStyle::getVariable() (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
8 * Copyright (C) 2015 Google Inc. All rights reserved. 8 * Copyright (C) 2015 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 } 1941 }
1942 1942
1943 const CSSValue* ComputedStyleCSSValueMapping::get( 1943 const CSSValue* ComputedStyleCSSValueMapping::get(
1944 const AtomicString customPropertyName, 1944 const AtomicString customPropertyName,
1945 const ComputedStyle& style, 1945 const ComputedStyle& style,
1946 const PropertyRegistry* registry) { 1946 const PropertyRegistry* registry) {
1947 if (registry) { 1947 if (registry) {
1948 const PropertyRegistry::Registration* registration = 1948 const PropertyRegistry::Registration* registration =
1949 registry->registration(customPropertyName); 1949 registry->registration(customPropertyName);
1950 if (registration) { 1950 if (registration) {
1951 const CSSValue* result = nullptr; 1951 const CSSValue* result = style.getRegisteredVariable(
1952 if (registration->inherits()) { 1952 customPropertyName, registration->inherits());
1953 if (StyleInheritedVariables* variables = style.inheritedVariables())
1954 result = variables->registeredVariable(customPropertyName);
1955 } else {
1956 if (StyleNonInheritedVariables* variables =
1957 style.nonInheritedVariables())
1958 result = variables->registeredVariable(customPropertyName);
1959 }
1960 if (result) 1953 if (result)
1961 return result; 1954 return result;
1962 return registration->initial(); 1955 return registration->initial();
1963 } 1956 }
1964 } 1957 }
1965 1958
1966 StyleInheritedVariables* variables = style.inheritedVariables(); 1959 bool isInheritedProperty = true;
1967 if (!variables) 1960 CSSVariableData* data =
1968 return nullptr; 1961 style.getVariable(customPropertyName, isInheritedProperty);
1969
1970 CSSVariableData* data = variables->getVariable(customPropertyName);
1971 if (!data) 1962 if (!data)
1972 return nullptr; 1963 return nullptr;
1973 1964
1974 return CSSCustomPropertyDeclaration::create(customPropertyName, data); 1965 return CSSCustomPropertyDeclaration::create(customPropertyName, data);
1975 } 1966 }
1976 1967
1977 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> 1968 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>>
1978 ComputedStyleCSSValueMapping::getVariables(const ComputedStyle& style) { 1969 ComputedStyleCSSValueMapping::getVariables(const ComputedStyle& style) {
1979 // TODO(timloh): Also return non-inherited variables 1970 // TODO(timloh): Also return non-inherited variables
1980 StyleInheritedVariables* variables = style.inheritedVariables(); 1971 StyleInheritedVariables* variables = style.inheritedVariables();
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
3650 case CSSPropertyAll: 3641 case CSSPropertyAll:
3651 return nullptr; 3642 return nullptr;
3652 default: 3643 default:
3653 break; 3644 break;
3654 } 3645 }
3655 ASSERT_NOT_REACHED(); 3646 ASSERT_NOT_REACHED();
3656 return nullptr; 3647 return nullptr;
3657 } 3648 }
3658 3649
3659 } // namespace blink 3650 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698