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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return m_styleDeclaration->removeVariable(name); | 67 return m_styleDeclaration->removeVariable(name); |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
71 void CSSVariablesMap::clear(ExceptionState& es) const | 71 void CSSVariablesMap::clear(ExceptionState& es) const |
72 { | 72 { |
73 if (m_styleDeclaration) | 73 if (m_styleDeclaration) |
74 return m_styleDeclaration->clearVariables(es); | 74 return m_styleDeclaration->clearVariables(es); |
75 } | 75 } |
76 | 76 |
| 77 void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callbac
k, ScriptValue* thisArg) const |
| 78 { |
| 79 if (!m_styleDeclaration) |
| 80 return; |
| 81 RefPtr<CSSVariablesIterator> iterator = m_styleDeclaration->variablesIterato
r(); |
| 82 while (!iterator->atEnd()) { |
| 83 String name = iterator->name(); |
| 84 String value = iterator->value(); |
| 85 if (thisArg) |
| 86 callback->handleItem(*thisArg, value, name, const_cast<CSSVariablesM
ap*>(this)); |
| 87 else |
| 88 callback->handleItem(value, name, const_cast<CSSVariablesMap*>(this)
); |
| 89 iterator->advance(); |
| 90 } |
| 91 } |
| 92 |
| 93 void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callbac
k, ScriptValue thisArg) const |
| 94 { |
| 95 forEach(callback, &thisArg); |
| 96 } |
| 97 |
| 98 void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callbac
k) const |
| 99 { |
| 100 forEach(callback, 0); |
| 101 } |
| 102 |
77 } // namespace WebCore | 103 } // namespace WebCore |
OLD | NEW |