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

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

Issue 569993002: <label> should support form association by parser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated Created 6 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
« no previous file with comments | « Source/core/html/FormAssociatedElement.h ('k') | Source/core/html/HTMLLabelElement.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 12 matching lines...) Expand all
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/html/FormAssociatedElement.h" 26 #include "core/html/FormAssociatedElement.h"
27 27
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/dom/IdTargetObserver.h" 29 #include "core/dom/IdTargetObserver.h"
30 #include "core/dom/NodeTraversal.h" 30 #include "core/dom/NodeTraversal.h"
31 #include "core/html/HTMLFormControlElement.h" 31 #include "core/html/HTMLFormControlElement.h"
32 #include "core/html/HTMLFormElement.h" 32 #include "core/html/HTMLFormElement.h"
33 #include "core/html/HTMLLabelElement.h"
33 #include "core/html/HTMLObjectElement.h" 34 #include "core/html/HTMLObjectElement.h"
34 #include "core/html/ValidityState.h" 35 #include "core/html/ValidityState.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 using namespace HTMLNames; 39 using namespace HTMLNames;
39 40
40 class FormAttributeTargetObserver : public IdTargetObserver { 41 class FormAttributeTargetObserver : public IdTargetObserver {
41 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 42 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
42 public: 43 public:
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 bool FormAssociatedElement::isFormControlElementWithState() const 302 bool FormAssociatedElement::isFormControlElementWithState() const
302 { 303 {
303 return false; 304 return false;
304 } 305 }
305 306
306 const HTMLElement& toHTMLElement(const FormAssociatedElement& associatedElement) 307 const HTMLElement& toHTMLElement(const FormAssociatedElement& associatedElement)
307 { 308 {
308 if (associatedElement.isFormControlElement()) 309 if (associatedElement.isFormControlElement())
309 return toHTMLFormControlElement(associatedElement); 310 return toHTMLFormControlElement(associatedElement);
310 // Assumes the element is an HTMLObjectElement 311 else if (associatedElement.isLabelElement())
311 return toHTMLObjectElement(associatedElement); 312 return toHTMLLabelElement(associatedElement);
313 else
314 return toHTMLObjectElement(associatedElement);
312 } 315 }
313 316
314 const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) 317 const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement)
315 { 318 {
316 ASSERT(associatedElement); 319 ASSERT(associatedElement);
317 return &toHTMLElement(*associatedElement); 320 return &toHTMLElement(*associatedElement);
318 } 321 }
319 322
320 HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) 323 HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement)
321 { 324 {
(...skipping 21 matching lines...) Expand all
343 visitor->trace(m_element); 346 visitor->trace(m_element);
344 IdTargetObserver::trace(visitor); 347 IdTargetObserver::trace(visitor);
345 } 348 }
346 349
347 void FormAttributeTargetObserver::idTargetChanged() 350 void FormAttributeTargetObserver::idTargetChanged()
348 { 351 {
349 m_element->formAttributeTargetChanged(); 352 m_element->formAttributeTargetChanged();
350 } 353 }
351 354
352 } // namespace Webcore 355 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/FormAssociatedElement.h ('k') | Source/core/html/HTMLLabelElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698