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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2630683002: Move custom property isInheritedProperty storage logic into ComputedStyle (Closed)
Patch Set: Undo cscssvm change 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 PassRefPtr<CSSVariableData> value, 1819 PassRefPtr<CSSVariableData> value,
1820 const CSSValue* parsedValue) { 1820 const CSSValue* parsedValue) {
1821 DCHECK(!!value == !!parsedValue); 1821 DCHECK(!!value == !!parsedValue);
1822 DCHECK(!(value && value->needsVariableResolution())); 1822 DCHECK(!(value && value->needsVariableResolution()));
1823 1823
1824 StyleNonInheritedVariables& variables = mutableNonInheritedVariables(); 1824 StyleNonInheritedVariables& variables = mutableNonInheritedVariables();
1825 variables.setVariable(name, std::move(value)); 1825 variables.setVariable(name, std::move(value));
1826 variables.setRegisteredVariable(name, parsedValue); 1826 variables.setRegisteredVariable(name, parsedValue);
1827 } 1827 }
1828 1828
1829 void ComputedStyle::removeInheritedVariable(const AtomicString& name) { 1829 void ComputedStyle::removeVariable(const AtomicString& name,
1830 mutableInheritedVariables().removeVariable(name); 1830 bool isInheritedProperty) {
1831 } 1831 if (isInheritedProperty) {
1832 1832 mutableInheritedVariables().removeVariable(name);
1833 void ComputedStyle::removeNonInheritedVariable(const AtomicString& name) { 1833 } else {
1834 mutableNonInheritedVariables().removeVariable(name); 1834 mutableNonInheritedVariables().removeVariable(name);
1835 }
1835 } 1836 }
1836 1837
1837 CSSVariableData* ComputedStyle::getVariable(const AtomicString& name) const { 1838 CSSVariableData* ComputedStyle::getVariable(const AtomicString& name) const {
1838 if (inheritedVariables()) { 1839 CSSVariableData* variable = getVariable(name, true);
1839 if (CSSVariableData* variable = inheritedVariables()->getVariable(name)) 1840 if (variable) {
1840 return variable; 1841 return variable;
1841 } 1842 }
1842 if (nonInheritedVariables()) { 1843 return getVariable(name, false);
1843 if (CSSVariableData* variable = nonInheritedVariables()->getVariable(name)) 1844 }
1844 return variable; 1845
1846 CSSVariableData* ComputedStyle::getVariable(const AtomicString& name,
1847 bool isInheritedProperty) const {
1848 if (isInheritedProperty) {
1849 return inheritedVariables() ? inheritedVariables()->getVariable(name)
1850 : nullptr;
1845 } 1851 }
1846 return nullptr; 1852 return nonInheritedVariables() ? nonInheritedVariables()->getVariable(name)
1853 : nullptr;
1854 }
1855
1856 const CSSValue* ComputedStyle::getRegisteredVariable(
1857 const AtomicString& name,
1858 bool isInheritedProperty) const {
1859 if (isInheritedProperty) {
1860 return inheritedVariables() ? inheritedVariables()->registeredVariable(name)
1861 : nullptr;
1862 }
1863 return nonInheritedVariables()
1864 ? nonInheritedVariables()->registeredVariable(name)
1865 : nullptr;
1847 } 1866 }
1848 1867
1849 float ComputedStyle::wordSpacing() const { 1868 float ComputedStyle::wordSpacing() const {
1850 return getFontDescription().wordSpacing(); 1869 return getFontDescription().wordSpacing();
1851 } 1870 }
1852 float ComputedStyle::letterSpacing() const { 1871 float ComputedStyle::letterSpacing() const {
1853 return getFontDescription().letterSpacing(); 1872 return getFontDescription().letterSpacing();
1854 } 1873 }
1855 1874
1856 bool ComputedStyle::setFontDescription(const FontDescription& v) { 1875 bool ComputedStyle::setFontDescription(const FontDescription& v) {
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 if (value < 0) 2480 if (value < 0)
2462 fvalue -= 0.5f; 2481 fvalue -= 0.5f;
2463 else 2482 else
2464 fvalue += 0.5f; 2483 fvalue += 0.5f;
2465 } 2484 }
2466 2485
2467 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2486 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2468 } 2487 }
2469 2488
2470 } // namespace blink 2489 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698