OLD | NEW |
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
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariable
Data> value) | 1453 void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariable
Data> value) |
1454 { | 1454 { |
1455 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; | 1455 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; |
1456 if (!variables) | 1456 if (!variables) |
1457 variables = StyleVariableData::create(); | 1457 variables = StyleVariableData::create(); |
1458 else if (!variables->hasOneRef()) | 1458 else if (!variables->hasOneRef()) |
1459 variables = variables->copy(); | 1459 variables = variables->copy(); |
1460 variables->setVariable(name, std::move(value)); | 1460 variables->setVariable(name, std::move(value)); |
1461 } | 1461 } |
1462 | 1462 |
| 1463 void ComputedStyle::setRegisteredInheritedProperty(const AtomicString& name, con
st CSSValue* parsedValue) |
| 1464 { |
| 1465 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; |
| 1466 // The CSSVariableData needs to be set before calling this function |
| 1467 DCHECK(variables); |
| 1468 DCHECK(!!parsedValue == !!variables->getVariable(name)); |
| 1469 DCHECK(!(variables->getVariable(name) && variables->getVariable(name)->needs
VariableResolution())); |
| 1470 |
| 1471 if (!variables->hasOneRef()) |
| 1472 variables = variables->copy(); |
| 1473 variables->setRegisteredInheritedProperty(name, parsedValue); |
| 1474 } |
| 1475 |
1463 void ComputedStyle::removeVariable(const AtomicString& name) | 1476 void ComputedStyle::removeVariable(const AtomicString& name) |
1464 { | 1477 { |
1465 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; | 1478 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; |
1466 if (!variables) | 1479 if (!variables) |
1467 return; | 1480 return; |
1468 if (!variables->hasOneRef()) | 1481 if (!variables->hasOneRef()) |
1469 variables = variables->copy(); | 1482 variables = variables->copy(); |
1470 variables->removeVariable(name); | 1483 variables->removeVariable(name); |
1471 } | 1484 } |
1472 | 1485 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 if (value < 0) | 2058 if (value < 0) |
2046 fvalue -= 0.5f; | 2059 fvalue -= 0.5f; |
2047 else | 2060 else |
2048 fvalue += 0.5f; | 2061 fvalue += 0.5f; |
2049 } | 2062 } |
2050 | 2063 |
2051 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2064 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
2052 } | 2065 } |
2053 | 2066 |
2054 } // namespace blink | 2067 } // namespace blink |
OLD | NEW |