OLD | NEW |
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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 void FormAssociatedElement::setForm(HTMLFormElement* newForm) | 129 void FormAssociatedElement::setForm(HTMLFormElement* newForm) |
130 { | 130 { |
131 if (m_form == newForm) | 131 if (m_form == newForm) |
132 return; | 132 return; |
133 willChangeForm(); | 133 willChangeForm(); |
134 if (m_form) | 134 if (m_form) |
135 m_form->removeFormElement(this); | 135 m_form->removeFormElement(this); |
136 m_form = newForm; | 136 m_form = newForm; |
137 if (m_form) | 137 if (m_form) |
138 m_form->registerFormElement(this); | 138 m_form->registerFormElement(*this); |
139 didChangeForm(); | 139 didChangeForm(); |
140 } | 140 } |
141 | 141 |
142 void FormAssociatedElement::willChangeForm() | 142 void FormAssociatedElement::willChangeForm() |
143 { | 143 { |
144 } | 144 } |
145 | 145 |
146 void FormAssociatedElement::didChangeForm() | 146 void FormAssociatedElement::didChangeForm() |
147 { | 147 { |
148 } | 148 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 { | 267 { |
268 const AtomicString& name = toHTMLElement(this)->getNameAttribute(); | 268 const AtomicString& name = toHTMLElement(this)->getNameAttribute(); |
269 return name.isNull() ? emptyAtom : name; | 269 return name.isNull() ? emptyAtom : name; |
270 } | 270 } |
271 | 271 |
272 bool FormAssociatedElement::isFormControlElementWithState() const | 272 bool FormAssociatedElement::isFormControlElementWithState() const |
273 { | 273 { |
274 return false; | 274 return false; |
275 } | 275 } |
276 | 276 |
| 277 const HTMLElement& toHTMLElement(const FormAssociatedElement& associatedElement) |
| 278 { |
| 279 if (associatedElement.isFormControlElement()) |
| 280 return toHTMLFormControlElement(associatedElement); |
| 281 // Assumes the element is an HTMLObjectElement |
| 282 return toHTMLObjectElement(associatedElement); |
| 283 } |
| 284 |
277 const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) | 285 const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) |
278 { | 286 { |
279 if (associatedElement->isFormControlElement()) | 287 ASSERT(associatedElement); |
280 return toHTMLFormControlElement(associatedElement); | 288 return &toHTMLElement(*associatedElement); |
281 // Assumes the element is an HTMLObjectElement | |
282 return toHTMLObjectElement(associatedElement); | |
283 } | 289 } |
284 | 290 |
285 HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) | 291 HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) |
286 { | 292 { |
287 return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociat
edElement*>(associatedElement))); | 293 return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociat
edElement*>(associatedElement))); |
288 } | 294 } |
289 | 295 |
| 296 HTMLElement& toHTMLElement(FormAssociatedElement& associatedElement) |
| 297 { |
| 298 return const_cast<HTMLElement&>(toHTMLElement(static_cast<const FormAssociat
edElement&>(associatedElement))); |
| 299 } |
| 300 |
290 PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(cons
t AtomicString& id, FormAssociatedElement* element) | 301 PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(cons
t AtomicString& id, FormAssociatedElement* element) |
291 { | 302 { |
292 return adoptPtr(new FormAttributeTargetObserver(id, element)); | 303 return adoptPtr(new FormAttributeTargetObserver(id, element)); |
293 } | 304 } |
294 | 305 |
295 FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id,
FormAssociatedElement* element) | 306 FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id,
FormAssociatedElement* element) |
296 : IdTargetObserver(toHTMLElement(element)->treeScope().idTargetObserverRegis
try(), id) | 307 : IdTargetObserver(toHTMLElement(element)->treeScope().idTargetObserverRegis
try(), id) |
297 , m_element(element) | 308 , m_element(element) |
298 { | 309 { |
299 } | 310 } |
300 | 311 |
301 void FormAttributeTargetObserver::idTargetChanged() | 312 void FormAttributeTargetObserver::idTargetChanged() |
302 { | 313 { |
303 m_element->formAttributeTargetChanged(); | 314 m_element->formAttributeTargetChanged(); |
304 } | 315 } |
305 | 316 |
306 } // namespace Webcore | 317 } // namespace Webcore |
OLD | NEW |