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

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

Issue 198553002: Use new is*Element() helper functions even more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 bool HTMLFormControlElement::formNoValidate() const 97 bool HTMLFormControlElement::formNoValidate() const
98 { 98 {
99 return fastHasAttribute(formnovalidateAttr); 99 return fastHasAttribute(formnovalidateAttr);
100 } 100 }
101 101
102 void HTMLFormControlElement::updateAncestorDisabledState() const 102 void HTMLFormControlElement::updateAncestorDisabledState() const
103 { 103 {
104 HTMLFieldSetElement* fieldSetAncestor = 0; 104 HTMLFieldSetElement* fieldSetAncestor = 0;
105 ContainerNode* legendAncestor = 0; 105 ContainerNode* legendAncestor = 0;
106 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor-> parentNode()) { 106 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor-> parentNode()) {
107 if (!legendAncestor && ancestor->hasTagName(legendTag)) 107 if (!legendAncestor && isHTMLLegendElement(*ancestor))
108 legendAncestor = ancestor; 108 legendAncestor = ancestor;
109 if (ancestor->hasTagName(fieldsetTag)) { 109 if (isHTMLFieldSetElement(*ancestor)) {
110 fieldSetAncestor = toHTMLFieldSetElement(ancestor); 110 fieldSetAncestor = toHTMLFieldSetElement(ancestor);
111 break; 111 break;
112 } 112 }
113 } 113 }
114 m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledF ormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend() )) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled; 114 m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledF ormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend() )) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled;
115 } 115 }
116 116
117 void HTMLFormControlElement::ancestorDisabledStateWasChanged() 117 void HTMLFormControlElement::ancestorDisabledStateWasChanged()
118 { 118 {
119 m_ancestorDisabledState = AncestorDisabledStateUnknown; 119 m_ancestorDisabledState = AncestorDisabledStateUnknown;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 short HTMLFormControlElement::tabIndex() const 351 short HTMLFormControlElement::tabIndex() const
352 { 352 {
353 // Skip the supportsFocus check in HTMLElement. 353 // Skip the supportsFocus check in HTMLElement.
354 return Element::tabIndex(); 354 return Element::tabIndex();
355 } 355 }
356 356
357 bool HTMLFormControlElement::recalcWillValidate() const 357 bool HTMLFormControlElement::recalcWillValidate() const
358 { 358 {
359 if (m_dataListAncestorState == Unknown) { 359 if (m_dataListAncestorState == Unknown) {
360 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancest or->parentNode()) { 360 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancest or->parentNode()) {
361 if (ancestor->hasTagName(datalistTag)) { 361 if (isHTMLDataListElement(*ancestor)) {
362 m_dataListAncestorState = InsideDataList; 362 m_dataListAncestorState = InsideDataList;
363 break; 363 break;
364 } 364 }
365 } 365 }
366 if (m_dataListAncestorState == Unknown) 366 if (m_dataListAncestorState == Unknown)
367 m_dataListAncestorState = NotInsideDataList; 367 m_dataListAncestorState = NotInsideDataList;
368 } 368 }
369 return m_dataListAncestorState == NotInsideDataList && !isDisabledOrReadOnly (); 369 return m_dataListAncestorState == NotInsideDataList && !isDisabledOrReadOnly ();
370 } 370 }
371 371
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 void HTMLFormControlElement::setFocus(bool flag) 505 void HTMLFormControlElement::setFocus(bool flag)
506 { 506 {
507 LabelableElement::setFocus(flag); 507 LabelableElement::setFocus(flag);
508 508
509 if (!flag && wasChangedSinceLastFormControlChangeEvent()) 509 if (!flag && wasChangedSinceLastFormControlChangeEvent())
510 dispatchFormControlChangeEvent(); 510 dispatchFormControlChangeEvent();
511 } 511 }
512 512
513 } // namespace Webcore 513 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFieldSetElement.cpp ('k') | Source/core/html/HTMLFormControlsCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698