| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 void SVGPathSegListPropertyTearOff::clearContextAndRoles() | 32 void SVGPathSegListPropertyTearOff::clearContextAndRoles() |
| 33 { | 33 { |
| 34 ASSERT(m_values); | 34 ASSERT(m_values); |
| 35 unsigned size = m_values->size(); | 35 unsigned size = m_values->size(); |
| 36 for (unsigned i = 0; i < size; ++i) { | 36 for (unsigned i = 0; i < size; ++i) { |
| 37 ListItemType item = m_values->at(i); | 37 ListItemType item = m_values->at(i); |
| 38 static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(0, Pa
thSegUndefinedRole); | 38 static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(0, Pa
thSegUndefinedRole); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 void SVGPathSegListPropertyTearOff::clear(ExceptionState& es) | 42 void SVGPathSegListPropertyTearOff::clear(ExceptionState& exceptionState) |
| 43 { | 43 { |
| 44 ASSERT(m_values); | 44 ASSERT(m_values); |
| 45 if (m_values->isEmpty()) | 45 if (m_values->isEmpty()) |
| 46 return; | 46 return; |
| 47 | 47 |
| 48 clearContextAndRoles(); | 48 clearContextAndRoles(); |
| 49 SVGPathSegListPropertyTearOff::Base::clearValues(es); | 49 SVGPathSegListPropertyTearOff::Base::clearValues(exceptionState); |
| 50 } | 50 } |
| 51 | 51 |
| 52 SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::g
etItem(unsigned index, ExceptionState& es) | 52 SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::g
etItem(unsigned index, ExceptionState& exceptionState) |
| 53 { | 53 { |
| 54 ListItemType returnedItem = Base::getItemValues(index, es); | 54 ListItemType returnedItem = Base::getItemValues(index, exceptionState); |
| 55 if (returnedItem) { | 55 if (returnedItem) { |
| 56 ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->contextE
lement() == contextElement()); | 56 ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->contextE
lement() == contextElement()); |
| 57 ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->role() =
= m_pathSegRole); | 57 ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->role() =
= m_pathSegRole); |
| 58 } | 58 } |
| 59 return returnedItem.release(); | 59 return returnedItem.release(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::r
eplaceItem(PassListItemType passNewItem, unsigned index, ExceptionState& es) | 62 SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::r
eplaceItem(PassListItemType passNewItem, unsigned index, ExceptionState& excepti
onState) |
| 63 { | 63 { |
| 64 // Not specified, but FF/Opera do it this way, and it's just sane. | 64 // Not specified, but FF/Opera do it this way, and it's just sane. |
| 65 if (!passNewItem) { | 65 if (!passNewItem) { |
| 66 es.throwUninformativeAndGenericTypeError(); | 66 exceptionState.throwUninformativeAndGenericTypeError(); |
| 67 return 0; | 67 return 0; |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (index < m_values->size()) { | 70 if (index < m_values->size()) { |
| 71 ListItemType replacedItem = m_values->at(index); | 71 ListItemType replacedItem = m_values->at(index); |
| 72 ASSERT(replacedItem); | 72 ASSERT(replacedItem); |
| 73 static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRo
le(0, PathSegUndefinedRole); | 73 static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRo
le(0, PathSegUndefinedRole); |
| 74 } | 74 } |
| 75 | 75 |
| 76 ListItemType newItem = passNewItem; | 76 ListItemType newItem = passNewItem; |
| 77 return Base::replaceItemValues(newItem, index, es); | 77 return Base::replaceItemValues(newItem, index, exceptionState); |
| 78 } | 78 } |
| 79 | 79 |
| 80 SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::r
emoveItem(unsigned index, ExceptionState& es) | 80 SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::r
emoveItem(unsigned index, ExceptionState& exceptionState) |
| 81 { | 81 { |
| 82 SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListProp
ertyTearOff::Base::removeItemValues(index, es); | 82 SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListProp
ertyTearOff::Base::removeItemValues(index, exceptionState); |
| 83 if (removedItem) | 83 if (removedItem) |
| 84 static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRol
e(0, PathSegUndefinedRole); | 84 static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRol
e(0, PathSegUndefinedRole); |
| 85 return removedItem.release(); | 85 return removedItem.release(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 SVGPathElement* SVGPathSegListPropertyTearOff::contextElement() const | 88 SVGPathElement* SVGPathSegListPropertyTearOff::contextElement() const |
| 89 { | 89 { |
| 90 SVGElement* contextElement = m_animatedProperty->contextElement(); | 90 SVGElement* contextElement = m_animatedProperty->contextElement(); |
| 91 ASSERT(contextElement); | 91 ASSERT(contextElement); |
| 92 return toSVGPathElement(contextElement); | 92 return toSVGPathElement(contextElement); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 unsigned& index = *indexToModify; | 129 unsigned& index = *indexToModify; |
| 130 // Spec: If the item is already in this list, note that the index of the
item to (replace|insert before) is before the removal of the item. | 130 // Spec: If the item is already in this list, note that the index of the
item to (replace|insert before) is before the removal of the item. |
| 131 if (static_cast<unsigned>(indexToRemove) < index) | 131 if (static_cast<unsigned>(indexToRemove) < index) |
| 132 --index; | 132 --index; |
| 133 } | 133 } |
| 134 | 134 |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } | 138 } |
| OLD | NEW |