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 30 matching lines...) Expand all Loading... |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 using namespace HTMLNames; | 45 using namespace HTMLNames; |
46 using namespace std; | 46 using namespace std; |
47 | 47 |
48 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc
ument& document, HTMLFormElement* form) | 48 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc
ument& document, HTMLFormElement* form) |
49 : LabelableElement(tagName, document) | 49 : LabelableElement(tagName, document) |
50 , m_disabled(false) | 50 , m_disabled(false) |
| 51 , m_isAutofilled(false) |
51 , m_isReadOnly(false) | 52 , m_isReadOnly(false) |
52 , m_isRequired(false) | 53 , m_isRequired(false) |
53 , m_valueMatchesRenderer(false) | 54 , m_valueMatchesRenderer(false) |
54 , m_ancestorDisabledState(AncestorDisabledStateUnknown) | 55 , m_ancestorDisabledState(AncestorDisabledStateUnknown) |
55 , m_dataListAncestorState(Unknown) | 56 , m_dataListAncestorState(Unknown) |
56 , m_willValidateInitialized(false) | 57 , m_willValidateInitialized(false) |
57 , m_willValidate(true) | 58 , m_willValidate(true) |
58 , m_isValid(true) | 59 , m_isValid(true) |
59 , m_wasChangedSinceLastFormControlChangeEvent(false) | 60 , m_wasChangedSinceLastFormControlChangeEvent(false) |
60 , m_wasFocusedByMouse(false) | 61 , m_wasFocusedByMouse(false) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 115 } |
115 m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledF
ormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend()
)) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled; | 116 m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledF
ormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend()
)) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled; |
116 } | 117 } |
117 | 118 |
118 void HTMLFormControlElement::ancestorDisabledStateWasChanged() | 119 void HTMLFormControlElement::ancestorDisabledStateWasChanged() |
119 { | 120 { |
120 m_ancestorDisabledState = AncestorDisabledStateUnknown; | 121 m_ancestorDisabledState = AncestorDisabledStateUnknown; |
121 disabledAttributeChanged(); | 122 disabledAttributeChanged(); |
122 } | 123 } |
123 | 124 |
| 125 void HTMLFormControlElement::reset() |
| 126 { |
| 127 setAutofilled(false); |
| 128 resetImpl(); |
| 129 } |
| 130 |
124 void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
micString& value) | 131 void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
micString& value) |
125 { | 132 { |
126 if (name == formAttr) { | 133 if (name == formAttr) { |
127 formAttributeChanged(); | 134 formAttributeChanged(); |
128 UseCounter::count(&document(), UseCounter::FormAttribute); | 135 UseCounter::count(&document(), UseCounter::FormAttribute); |
129 } else if (name == disabledAttr) { | 136 } else if (name == disabledAttr) { |
130 bool oldDisabled = m_disabled; | 137 bool oldDisabled = m_disabled; |
131 m_disabled = !value.isNull(); | 138 m_disabled = !value.isNull(); |
132 if (oldDisabled != m_disabled) | 139 if (oldDisabled != m_disabled) |
133 disabledAttributeChanged(); | 140 disabledAttributeChanged(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return true; | 200 return true; |
194 if (hasTagName(keygenTag)) | 201 if (hasTagName(keygenTag)) |
195 return true; | 202 return true; |
196 if (hasTagName(buttonTag)) | 203 if (hasTagName(buttonTag)) |
197 return true; | 204 return true; |
198 if (isHTMLTextAreaElement(this)) | 205 if (isHTMLTextAreaElement(this)) |
199 return true; | 206 return true; |
200 return false; | 207 return false; |
201 } | 208 } |
202 | 209 |
| 210 void HTMLFormControlElement::setAutofilled(bool autofilled) |
| 211 { |
| 212 if (autofilled == m_isAutofilled) |
| 213 return; |
| 214 |
| 215 m_isAutofilled = autofilled; |
| 216 setNeedsStyleRecalc(); |
| 217 } |
| 218 |
203 static bool shouldAutofocusOnAttach(const HTMLFormControlElement* element) | 219 static bool shouldAutofocusOnAttach(const HTMLFormControlElement* element) |
204 { | 220 { |
205 if (!element->isAutofocusable()) | 221 if (!element->isAutofocusable()) |
206 return false; | 222 return false; |
207 if (element->hasAutofocused()) | 223 if (element->hasAutofocused()) |
208 return false; | 224 return false; |
209 if (element->document().isSandboxed(SandboxAutomaticFeatures)) { | 225 if (element->document().isSandboxed(SandboxAutomaticFeatures)) { |
210 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 226 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
211 element->document().addConsoleMessage(SecurityMessageSource, ErrorMessag
eLevel, "Blocked autofocusing on a form control because the form's frame is sand
boxed and the 'allow-scripts' permission is not set."); | 227 element->document().addConsoleMessage(SecurityMessageSource, ErrorMessag
eLevel, "Blocked autofocusing on a form control because the form's frame is sand
boxed and the 'allow-scripts' permission is not set."); |
212 return false; | 228 return false; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 HTMLFormControlElement* HTMLFormControlElement::enclosingFormControlElement(Node
* node) | 506 HTMLFormControlElement* HTMLFormControlElement::enclosingFormControlElement(Node
* node) |
491 { | 507 { |
492 for (; node; node = node->parentNode()) { | 508 for (; node; node = node->parentNode()) { |
493 if (node->isElementNode() && toElement(node)->isFormControlElement()) | 509 if (node->isElementNode() && toElement(node)->isFormControlElement()) |
494 return toHTMLFormControlElement(node); | 510 return toHTMLFormControlElement(node); |
495 } | 511 } |
496 return 0; | 512 return 0; |
497 } | 513 } |
498 | 514 |
499 } // namespace Webcore | 515 } // namespace Webcore |
OLD | NEW |