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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el
ement, HTMLFormElement* currentAssociatedForm) | 101 HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el
ement, HTMLFormElement* currentAssociatedForm) |
102 { | 102 { |
103 const AtomicString& formId(element->fastGetAttribute(formAttr)); | 103 const AtomicString& formId(element->fastGetAttribute(formAttr)); |
104 if (!formId.isNull() && element->inDocument()) { | 104 if (!formId.isNull() && element->inDocument()) { |
105 // The HTML5 spec says that the element should be associated with | 105 // The HTML5 spec says that the element should be associated with |
106 // the first element in the document to have an ID that equal to | 106 // the first element in the document to have an ID that equal to |
107 // the value of form attribute, so we put the result of | 107 // the value of form attribute, so we put the result of |
108 // treeScope()->getElementById() over the given element. | 108 // treeScope()->getElementById() over the given element. |
109 HTMLFormElement* newForm = 0; | 109 HTMLFormElement* newForm = 0; |
110 Element* newFormCandidate = element->treeScope().getElementById(formId); | 110 Element* newFormCandidate = element->treeScope()->getElementById(formId)
; |
111 if (newFormCandidate && newFormCandidate->hasTagName(formTag)) | 111 if (newFormCandidate && newFormCandidate->hasTagName(formTag)) |
112 newForm = toHTMLFormElement(newFormCandidate); | 112 newForm = toHTMLFormElement(newFormCandidate); |
113 return newForm; | 113 return newForm; |
114 } | 114 } |
115 | 115 |
116 if (!currentAssociatedForm) | 116 if (!currentAssociatedForm) |
117 return element->findFormAncestor(); | 117 return element->findFormAncestor(); |
118 | 118 |
119 return currentAssociatedForm; | 119 return currentAssociatedForm; |
120 } | 120 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 { | 286 { |
287 return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociat
edElement*>(associatedElement))); | 287 return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociat
edElement*>(associatedElement))); |
288 } | 288 } |
289 | 289 |
290 PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(cons
t AtomicString& id, FormAssociatedElement* element) | 290 PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(cons
t AtomicString& id, FormAssociatedElement* element) |
291 { | 291 { |
292 return adoptPtr(new FormAttributeTargetObserver(id, element)); | 292 return adoptPtr(new FormAttributeTargetObserver(id, element)); |
293 } | 293 } |
294 | 294 |
295 FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id,
FormAssociatedElement* element) | 295 FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id,
FormAssociatedElement* element) |
296 : IdTargetObserver(toHTMLElement(element)->treeScope().idTargetObserverRegis
try(), id) | 296 : IdTargetObserver(toHTMLElement(element)->treeScope()->idTargetObserverRegi
stry(), id) |
297 , m_element(element) | 297 , m_element(element) |
298 { | 298 { |
299 } | 299 } |
300 | 300 |
301 void FormAttributeTargetObserver::idTargetChanged() | 301 void FormAttributeTargetObserver::idTargetChanged() |
302 { | 302 { |
303 m_element->formAttributeTargetChanged(); | 303 m_element->formAttributeTargetChanged(); |
304 } | 304 } |
305 | 305 |
306 } // namespace Webcore | 306 } // namespace Webcore |
OLD | NEW |