| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return String(); | 48 return String(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool CSSVariablesMap::has(const AtomicString& name) const | 51 bool CSSVariablesMap::has(const AtomicString& name) const |
| 52 { | 52 { |
| 53 if (m_styleDeclaration) | 53 if (m_styleDeclaration) |
| 54 return !get(name).isEmpty(); | 54 return !get(name).isEmpty(); |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CSSVariablesMap::set(const AtomicString& name, const String& value, Excepti
onState& es) | 58 void CSSVariablesMap::set(const AtomicString& name, const String& value, Excepti
onState& exceptionState) |
| 59 { | 59 { |
| 60 if (!m_styleDeclaration) | 60 if (!m_styleDeclaration) |
| 61 return; | 61 return; |
| 62 if (m_styleDeclaration->setVariableValue(name, value, es)) { | 62 if (m_styleDeclaration->setVariableValue(name, value, exceptionState)) { |
| 63 Iterators::iterator end = m_activeIterators.end(); | 63 Iterators::iterator end = m_activeIterators.end(); |
| 64 for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it
) | 64 for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it
) |
| 65 (*it)->addedVariable(name); | 65 (*it)->addedVariable(name); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CSSVariablesMap::remove(const AtomicString& name) | 69 bool CSSVariablesMap::remove(const AtomicString& name) |
| 70 { | 70 { |
| 71 if (!m_styleDeclaration) | 71 if (!m_styleDeclaration) |
| 72 return false; | 72 return false; |
| 73 if (m_styleDeclaration->removeVariable(name)) { | 73 if (m_styleDeclaration->removeVariable(name)) { |
| 74 Iterators::iterator end = m_activeIterators.end(); | 74 Iterators::iterator end = m_activeIterators.end(); |
| 75 for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it
) | 75 for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it
) |
| 76 (*it)->removedVariable(name); | 76 (*it)->removedVariable(name); |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 void CSSVariablesMap::clear(ExceptionState& es) | 82 void CSSVariablesMap::clear(ExceptionState& exceptionState) |
| 83 { | 83 { |
| 84 if (!m_styleDeclaration) | 84 if (!m_styleDeclaration) |
| 85 return; | 85 return; |
| 86 if (m_styleDeclaration->clearVariables(es)) { | 86 if (m_styleDeclaration->clearVariables(exceptionState)) { |
| 87 Iterators::iterator end = m_activeIterators.end(); | 87 Iterators::iterator end = m_activeIterators.end(); |
| 88 for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it
) | 88 for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it
) |
| 89 (*it)->clearedVariables(); | 89 (*it)->clearedVariables(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callbac
k, ScriptValue& thisArg) const | 93 void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callbac
k, ScriptValue& thisArg) const |
| 94 { | 94 { |
| 95 forEach(callback, &thisArg); | 95 forEach(callback, &thisArg); |
| 96 } | 96 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 113 callback->handleItem(*thisArg, value, name, const_cast<CSSVariablesM
ap*>(this)); | 113 callback->handleItem(*thisArg, value, name, const_cast<CSSVariablesM
ap*>(this)); |
| 114 else | 114 else |
| 115 callback->handleItem(value, name, const_cast<CSSVariablesMap*>(this)
); | 115 callback->handleItem(value, name, const_cast<CSSVariablesMap*>(this)
); |
| 116 iterator->advance(); | 116 iterator->advance(); |
| 117 } | 117 } |
| 118 ASSERT(m_activeIterators.last() == iterator.get()); | 118 ASSERT(m_activeIterators.last() == iterator.get()); |
| 119 m_activeIterators.removeLast(); | 119 m_activeIterators.removeLast(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace WebCore | 122 } // namespace WebCore |
| OLD | NEW |