Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "core/dom/IdTargetObserver.h" | 29 #include "core/dom/IdTargetObserver.h" |
| 30 #include "core/html/HTMLFormControlElement.h" | 30 #include "core/html/HTMLFormControlElement.h" |
| 31 #include "core/html/HTMLFormElement.h" | 31 #include "core/html/HTMLFormElement.h" |
| 32 #include "core/html/HTMLObjectElement.h" | 32 #include "core/html/HTMLObjectElement.h" |
| 33 #include "core/html/ValidityState.h" | 33 #include "core/html/ValidityState.h" |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 using namespace HTMLNames; | 37 using namespace HTMLNames; |
| 38 | 38 |
| 39 class FormAttributeTargetObserver : public IdTargetObserver { | 39 // FIXME: Oilpan: IdTargetObserver should be on-heap. |
|
haraken
2014/05/09 05:02:03
Yes, this will allow us to remove the complexity i
Mads Ager (chromium)
2014/05/09 05:46:30
Maybe, but only if the notification can wait until
| |
| 40 WTF_MAKE_FAST_ALLOCATED; | 40 class FormAttributeTargetObserver : public NoBaseWillBeGarbageCollectedFinalized <FormAttributeTargetObserver>, public IdTargetObserver { |
| 41 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | |
| 41 public: | 42 public: |
| 42 static PassOwnPtr<FormAttributeTargetObserver> create(const AtomicString& id , FormAssociatedElement*); | 43 static PassOwnPtrWillBeRawPtr<FormAttributeTargetObserver> create(const Atom icString& id, FormAssociatedElement*); |
| 44 void trace(Visitor* visitor) { visitor->trace(m_element); } | |
| 43 virtual void idTargetChanged() OVERRIDE; | 45 virtual void idTargetChanged() OVERRIDE; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement*); | 48 FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement*); |
| 47 | 49 |
| 48 FormAssociatedElement* m_element; | 50 RawPtrWillBeMember<FormAssociatedElement> m_element; |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 FormAssociatedElement::FormAssociatedElement() | 53 FormAssociatedElement::FormAssociatedElement() |
| 52 : m_formWasSetByParser(false) | 54 : m_formWasSetByParser(false) |
| 53 { | 55 { |
| 54 } | 56 } |
| 55 | 57 |
| 56 FormAssociatedElement::~FormAssociatedElement() | 58 FormAssociatedElement::~FormAssociatedElement() |
| 57 { | 59 { |
| 58 // We can't call setForm here because it contains virtual calls. | 60 // We can't call setForm here because it contains virtual calls. |
| 59 } | 61 } |
| 60 | 62 |
| 61 void FormAssociatedElement::trace(Visitor* visitor) | 63 void FormAssociatedElement::trace(Visitor* visitor) |
| 62 { | 64 { |
| 65 visitor->trace(m_formAttributeTargetObserver); | |
| 63 visitor->trace(m_form); | 66 visitor->trace(m_form); |
| 64 visitor->trace(m_validityState); | 67 visitor->trace(m_validityState); |
| 65 } | 68 } |
| 66 | 69 |
| 67 ValidityState* FormAssociatedElement::validity() | 70 ValidityState* FormAssociatedElement::validity() |
| 68 { | 71 { |
| 69 if (!m_validityState) | 72 if (!m_validityState) |
| 70 m_validityState = ValidityState::create(this); | 73 m_validityState = ValidityState::create(this); |
| 71 | 74 |
| 72 return m_validityState.get(); | 75 return m_validityState.get(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 String FormAssociatedElement::validationMessage() const | 263 String FormAssociatedElement::validationMessage() const |
| 261 { | 264 { |
| 262 return customError() ? m_customValidationMessage : String(); | 265 return customError() ? m_customValidationMessage : String(); |
| 263 } | 266 } |
| 264 | 267 |
| 265 void FormAssociatedElement::setCustomValidity(const String& error) | 268 void FormAssociatedElement::setCustomValidity(const String& error) |
| 266 { | 269 { |
| 267 m_customValidationMessage = error; | 270 m_customValidationMessage = error; |
| 268 } | 271 } |
| 269 | 272 |
| 270 void FormAssociatedElement::setFormAttributeTargetObserver(PassOwnPtr<FormAttrib uteTargetObserver> newObserver) | 273 void FormAssociatedElement::setFormAttributeTargetObserver(PassOwnPtrWillBeRawPt r<FormAttributeTargetObserver> newObserver) |
| 271 { | 274 { |
| 272 if (m_formAttributeTargetObserver) | 275 if (m_formAttributeTargetObserver) |
| 273 m_formAttributeTargetObserver->unregister(); | 276 m_formAttributeTargetObserver->unregister(); |
| 274 m_formAttributeTargetObserver = newObserver; | 277 m_formAttributeTargetObserver = newObserver; |
| 275 } | 278 } |
| 276 | 279 |
| 277 void FormAssociatedElement::resetFormAttributeTargetObserver() | 280 void FormAssociatedElement::resetFormAttributeTargetObserver() |
| 278 { | 281 { |
| 279 HTMLElement* element = toHTMLElement(this); | 282 HTMLElement* element = toHTMLElement(this); |
| 280 const AtomicString& formId(element->fastGetAttribute(formAttr)); | 283 const AtomicString& formId(element->fastGetAttribute(formAttr)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) | 320 HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) |
| 318 { | 321 { |
| 319 return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociat edElement*>(associatedElement))); | 322 return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociat edElement*>(associatedElement))); |
| 320 } | 323 } |
| 321 | 324 |
| 322 HTMLElement& toHTMLElement(FormAssociatedElement& associatedElement) | 325 HTMLElement& toHTMLElement(FormAssociatedElement& associatedElement) |
| 323 { | 326 { |
| 324 return const_cast<HTMLElement&>(toHTMLElement(static_cast<const FormAssociat edElement&>(associatedElement))); | 327 return const_cast<HTMLElement&>(toHTMLElement(static_cast<const FormAssociat edElement&>(associatedElement))); |
| 325 } | 328 } |
| 326 | 329 |
| 327 PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(cons t AtomicString& id, FormAssociatedElement* element) | 330 PassOwnPtrWillBeRawPtr<FormAttributeTargetObserver> FormAttributeTargetObserver: :create(const AtomicString& id, FormAssociatedElement* element) |
| 328 { | 331 { |
| 329 return adoptPtr(new FormAttributeTargetObserver(id, element)); | 332 return adoptPtrWillBeNoop(new FormAttributeTargetObserver(id, element)); |
| 330 } | 333 } |
| 331 | 334 |
| 332 FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement* element) | 335 FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement* element) |
| 333 : IdTargetObserver(toHTMLElement(element)->treeScope().idTargetObserverRegis try(), id) | 336 : IdTargetObserver(toHTMLElement(element)->treeScope().idTargetObserverRegis try(), id) |
| 334 , m_element(element) | 337 , m_element(element) |
| 335 { | 338 { |
| 336 } | 339 } |
| 337 | 340 |
| 338 void FormAttributeTargetObserver::idTargetChanged() | 341 void FormAttributeTargetObserver::idTargetChanged() |
| 339 { | 342 { |
| 340 m_element->formAttributeTargetChanged(); | 343 m_element->formAttributeTargetChanged(); |
| 341 } | 344 } |
| 342 | 345 |
| 343 } // namespace Webcore | 346 } // namespace Webcore |
| OLD | NEW |