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

Side by Side Diff: Source/core/html/FormAssociatedElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/FileInputType.cpp ('k') | Source/core/html/HTMLAnchorElement.h » ('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 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 m_form = 0; 156 m_form = 0;
157 didChangeForm(); 157 didChangeForm();
158 } 158 }
159 159
160 void FormAssociatedElement::resetFormOwner() 160 void FormAssociatedElement::resetFormOwner()
161 { 161 {
162 HTMLFormElement* originalForm = m_form; 162 HTMLFormElement* originalForm = m_form;
163 setForm(findAssociatedForm(toHTMLElement(this), m_form)); 163 setForm(findAssociatedForm(toHTMLElement(this), m_form));
164 HTMLElement* element = toHTMLElement(this); 164 HTMLElement* element = toHTMLElement(this);
165 if (m_form && m_form != originalForm && m_form->inDocument()) 165 if (m_form && m_form != originalForm && m_form->inDocument())
166 element->document()->didAssociateFormControl(element); 166 element->document().didAssociateFormControl(element);
167 } 167 }
168 168
169 void FormAssociatedElement::formAttributeChanged() 169 void FormAssociatedElement::formAttributeChanged()
170 { 170 {
171 HTMLElement* element = toHTMLElement(this); 171 HTMLElement* element = toHTMLElement(this);
172 if (!element->fastHasAttribute(formAttr)) { 172 if (!element->fastHasAttribute(formAttr)) {
173 // The form attribute removed. We need to reset form owner here. 173 // The form attribute removed. We need to reset form owner here.
174 HTMLFormElement* originalForm = m_form; 174 HTMLFormElement* originalForm = m_form;
175 setForm(element->findFormAncestor()); 175 setForm(element->findFormAncestor());
176 HTMLElement* element = toHTMLElement(this); 176 HTMLElement* element = toHTMLElement(this);
177 if (m_form && m_form != originalForm && m_form->inDocument()) 177 if (m_form && m_form != originalForm && m_form->inDocument())
178 element->document()->didAssociateFormControl(element); 178 element->document().didAssociateFormControl(element);
179 m_formAttributeTargetObserver = nullptr; 179 m_formAttributeTargetObserver = nullptr;
180 } else { 180 } else {
181 resetFormOwner(); 181 resetFormOwner();
182 if (element->inDocument()) 182 if (element->inDocument())
183 resetFormAttributeTargetObserver(); 183 resetFormAttributeTargetObserver();
184 } 184 }
185 } 185 }
186 186
187 bool FormAssociatedElement::customError() const 187 bool FormAssociatedElement::customError() const
188 { 188 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 , m_element(element) 299 , m_element(element)
300 { 300 {
301 } 301 }
302 302
303 void FormAttributeTargetObserver::idTargetChanged() 303 void FormAttributeTargetObserver::idTargetChanged()
304 { 304 {
305 m_element->formAttributeTargetChanged(); 305 m_element->formAttributeTargetChanged();
306 } 306 }
307 307
308 } // namespace Webcore 308 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/FileInputType.cpp ('k') | Source/core/html/HTMLAnchorElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698