Chromium Code Reviews| 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, value); | 1460 variables->setVariable(name, 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 DCHECK(variables); | |
| 1467 if (!variables->hasOneRef()) | |
| 1468 variables = variables->copy(); | |
| 1469 DCHECK(!!parsedValue == !!variables->getVariable(name)); | |
|
meade_UTC10
2016/09/06 04:52:07
I don't really understand what this check is for,
| |
| 1470 DCHECK(!(parsedValue && variables->getVariable(name)->needsVariableResolutio n())); | |
|
meade_UTC10
2016/09/06 04:52:07
Is this one "you can clear a variable that still n
Timothy Loh
2016/09/06 08:21:17
Both dchecks are sanity checks about the relation
| |
| 1471 variables->setRegisteredInheritedProperty(name, parsedValue); | |
| 1472 } | |
| 1473 | |
| 1463 void ComputedStyle::removeVariable(const AtomicString& name) | 1474 void ComputedStyle::removeVariable(const AtomicString& name) |
| 1464 { | 1475 { |
| 1465 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl es; | 1476 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl es; |
| 1466 if (!variables) | 1477 if (!variables) |
| 1467 return; | 1478 return; |
| 1468 if (!variables->hasOneRef()) | 1479 if (!variables->hasOneRef()) |
| 1469 variables = variables->copy(); | 1480 variables = variables->copy(); |
| 1470 variables->removeVariable(name); | 1481 variables->removeVariable(name); |
| 1471 } | 1482 } |
| 1472 | 1483 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2045 if (value < 0) | 2056 if (value < 0) |
| 2046 fvalue -= 0.5f; | 2057 fvalue -= 0.5f; |
| 2047 else | 2058 else |
| 2048 fvalue += 0.5f; | 2059 fvalue += 0.5f; |
| 2049 } | 2060 } |
| 2050 | 2061 |
| 2051 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2062 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2052 } | 2063 } |
| 2053 | 2064 |
| 2054 } // namespace blink | 2065 } // namespace blink |
| OLD | NEW |