Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: WebCore/dom/Attr.cpp

Issue 3565007: Merge 68096 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « WebCore/dom/Attr.h ('k') | WebCore/dom/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix); 112 m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix);
113 } 113 }
114 114
115 String Attr::nodeValue() const 115 String Attr::nodeValue() const
116 { 116 {
117 return value(); 117 return value();
118 } 118 }
119 119
120 void Attr::setValue(const AtomicString& value, ExceptionCode&) 120 void Attr::setValue(const AtomicString& value)
121 { 121 {
122 m_ignoreChildrenChanged++; 122 m_ignoreChildrenChanged++;
123 removeChildren(); 123 removeChildren();
124 m_attribute->setValue(value); 124 m_attribute->setValue(value);
125 createTextChild(); 125 createTextChild();
126 m_ignoreChildrenChanged--; 126 m_ignoreChildrenChanged--;
127 }
128
129 void Attr::setValue(const AtomicString& value, ExceptionCode&)
130 {
131 if (m_element && m_element->isIdAttributeName(m_attribute->name()))
132 m_element->updateId(m_element->getIdAttribute(), value);
133
134 setValue(value);
127 135
128 if (m_element) 136 if (m_element)
129 m_element->attributeChanged(m_attribute.get()); 137 m_element->attributeChanged(m_attribute.get());
130 } 138 }
131 139
132 void Attr::setNodeValue(const String& v, ExceptionCode& ec) 140 void Attr::setNodeValue(const String& v, ExceptionCode& ec)
133 { 141 {
134 setValue(v, ec); 142 setValue(v, ec);
135 } 143 }
136 144
(...skipping 23 matching lines...) Expand all
160 168
161 Node::childrenChanged(changedByParser, beforeChange, afterChange, childCount Delta); 169 Node::childrenChanged(changedByParser, beforeChange, afterChange, childCount Delta);
162 170
163 // FIXME: We should include entity references in the value 171 // FIXME: We should include entity references in the value
164 172
165 String val = ""; 173 String val = "";
166 for (Node *n = firstChild(); n; n = n->nextSibling()) { 174 for (Node *n = firstChild(); n; n = n->nextSibling()) {
167 if (n->isTextNode()) 175 if (n->isTextNode())
168 val += static_cast<Text *>(n)->data(); 176 val += static_cast<Text *>(n)->data();
169 } 177 }
170 178
179 if (m_element && m_element->isIdAttributeName(m_attribute->name()))
180 m_element->updateId(m_attribute->value(), val);
181
171 m_attribute->setValue(val.impl()); 182 m_attribute->setValue(val.impl());
172 if (m_element) 183 if (m_element)
173 m_element->attributeChanged(m_attribute.get()); 184 m_element->attributeChanged(m_attribute.get());
174 } 185 }
175 186
176 bool Attr::isId() const 187 bool Attr::isId() const
177 { 188 {
178 return qualifiedName().matches(document()->idAttributeName()); 189 return qualifiedName().matches(document()->idAttributeName());
179 } 190 }
180 191
181 } 192 }
OLDNEW
« no previous file with comments | « WebCore/dom/Attr.h ('k') | WebCore/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698