OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@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 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. 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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "CSSMutableStyleDeclaration.h" | 23 #include "CSSMutableStyleDeclaration.h" |
24 | 24 |
25 #include "CSSImageValue.h" | 25 #include "CSSImageValue.h" |
26 #include "CSSMutableValue.h" | |
27 #include "CSSParser.h" | 26 #include "CSSParser.h" |
28 #include "CSSPropertyLonghand.h" | 27 #include "CSSPropertyLonghand.h" |
29 #include "CSSPropertyNames.h" | 28 #include "CSSPropertyNames.h" |
30 #include "CSSRule.h" | 29 #include "CSSRule.h" |
31 #include "CSSStyleSheet.h" | 30 #include "CSSStyleSheet.h" |
32 #include "CSSValueKeywords.h" | 31 #include "CSSValueKeywords.h" |
33 #include "CSSValueList.h" | 32 #include "CSSValueList.h" |
34 #include "Document.h" | 33 #include "Document.h" |
35 #include "ExceptionCode.h" | 34 #include "ExceptionCode.h" |
36 #include "InspectorInstrumentation.h" | 35 #include "InspectorInstrumentation.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (candidates.contains(property->id())) { | 89 if (candidates.contains(property->id())) { |
91 if (!important && candidates.get(property->id())) | 90 if (!important && candidates.get(property->id())) |
92 continue; | 91 continue; |
93 removeProperty(property->id(), false); | 92 removeProperty(property->id(), false); |
94 } | 93 } |
95 m_properties.append(*property); | 94 m_properties.append(*property); |
96 candidates.set(property->id(), important); | 95 candidates.set(property->id(), important); |
97 } | 96 } |
98 } | 97 } |
99 | 98 |
100 CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration() | |
101 { | |
102 const CSSMutableStyleDeclarationConstIterator end = this->end(); | |
103 for (CSSMutableStyleDeclarationConstIterator it = begin(); it != end; ++it)
{ | |
104 CSSValue* value = it->value(); | |
105 if (!value || !value->isMutableValue()) | |
106 continue; | |
107 static_cast<CSSMutableValue*>(value)->setNode(0); | |
108 } | |
109 } | |
110 | |
111 CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutab
leStyleDeclaration& other) | 99 CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutab
leStyleDeclaration& other) |
112 { | 100 { |
113 ASSERT(!m_iteratorCount); | 101 ASSERT(!m_iteratorCount); |
114 // don't attach it to the same node, just leave the current m_node value | 102 // don't attach it to the same node, just leave the current m_node value |
115 m_properties = other.m_properties; | 103 m_properties = other.m_properties; |
116 m_strictParsing = other.m_strictParsing; | 104 m_strictParsing = other.m_strictParsing; |
117 return *this; | 105 return *this; |
118 } | 106 } |
119 | 107 |
120 String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const | 108 String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) | 864 CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) |
877 { | 865 { |
878 for (int n = m_properties.size() - 1 ; n >= 0; --n) { | 866 for (int n = m_properties.size() - 1 ; n >= 0; --n) { |
879 if (propertyID == m_properties[n].m_id) | 867 if (propertyID == m_properties[n].m_id) |
880 return &m_properties[n]; | 868 return &m_properties[n]; |
881 } | 869 } |
882 return 0; | 870 return 0; |
883 } | 871 } |
884 | 872 |
885 } // namespace WebCore | 873 } // namespace WebCore |
OLD | NEW |