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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 m_isValid(true), | 59 m_isValid(true), |
60 m_validityIsDirty(false), | 60 m_validityIsDirty(false), |
61 m_wasFocusedByMouse(false) { | 61 m_wasFocusedByMouse(false) { |
62 setHasCustomStyleCallbacks(); | 62 setHasCustomStyleCallbacks(); |
63 associateByParser(form); | 63 associateByParser(form); |
64 } | 64 } |
65 | 65 |
66 HTMLFormControlElement::~HTMLFormControlElement() {} | 66 HTMLFormControlElement::~HTMLFormControlElement() {} |
67 | 67 |
68 DEFINE_TRACE(HTMLFormControlElement) { | 68 DEFINE_TRACE(HTMLFormControlElement) { |
69 FormAssociatedElement::trace(visitor); | 69 ListedElement::trace(visitor); |
70 LabelableElement::trace(visitor); | 70 LabelableElement::trace(visitor); |
71 } | 71 } |
72 | 72 |
73 String HTMLFormControlElement::formAction() const { | 73 String HTMLFormControlElement::formAction() const { |
74 const AtomicString& action = fastGetAttribute(formactionAttr); | 74 const AtomicString& action = fastGetAttribute(formactionAttr); |
75 if (action.isEmpty()) | 75 if (action.isEmpty()) |
76 return document().url(); | 76 return document().url(); |
77 return document().completeURL(stripLeadingAndTrailingHTMLSpaces(action)); | 77 return document().completeURL(stripLeadingAndTrailingHTMLSpaces(action)); |
78 } | 78 } |
79 | 79 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // close on the layoutObject. | 238 // close on the layoutObject. |
239 layoutObject()->updateFromElement(); | 239 layoutObject()->updateFromElement(); |
240 | 240 |
241 // FIXME: Autofocus handling should be moved to insertedInto according to | 241 // FIXME: Autofocus handling should be moved to insertedInto according to |
242 // the standard. | 242 // the standard. |
243 if (shouldAutofocusOnAttach(this)) | 243 if (shouldAutofocusOnAttach(this)) |
244 document().setAutofocusElement(this); | 244 document().setAutofocusElement(this); |
245 } | 245 } |
246 | 246 |
247 void HTMLFormControlElement::didMoveToNewDocument(Document& oldDocument) { | 247 void HTMLFormControlElement::didMoveToNewDocument(Document& oldDocument) { |
248 FormAssociatedElement::didMoveToNewDocument(oldDocument); | 248 ListedElement::didMoveToNewDocument(oldDocument); |
249 HTMLElement::didMoveToNewDocument(oldDocument); | 249 HTMLElement::didMoveToNewDocument(oldDocument); |
250 } | 250 } |
251 | 251 |
252 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto( | 252 Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto( |
253 ContainerNode* insertionPoint) { | 253 ContainerNode* insertionPoint) { |
254 m_ancestorDisabledState = AncestorDisabledStateUnknown; | 254 m_ancestorDisabledState = AncestorDisabledStateUnknown; |
255 m_dataListAncestorState = Unknown; | 255 m_dataListAncestorState = Unknown; |
256 setNeedsWillValidateCheck(); | 256 setNeedsWillValidateCheck(); |
257 HTMLElement::insertedInto(insertionPoint); | 257 HTMLElement::insertedInto(insertionPoint); |
258 FormAssociatedElement::insertedInto(insertionPoint); | 258 ListedElement::insertedInto(insertionPoint); |
259 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); | 259 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); |
260 | 260 |
261 // Trigger for elements outside of forms. | 261 // Trigger for elements outside of forms. |
262 if (!formOwner() && insertionPoint->isConnected()) | 262 if (!formOwner() && insertionPoint->isConnected()) |
263 document().didAssociateFormControl(this); | 263 document().didAssociateFormControl(this); |
264 | 264 |
265 return InsertionDone; | 265 return InsertionDone; |
266 } | 266 } |
267 | 267 |
268 void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) { | 268 void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) { |
269 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); | 269 fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); |
270 hideVisibleValidationMessage(); | 270 hideVisibleValidationMessage(); |
271 m_hasValidationMessage = false; | 271 m_hasValidationMessage = false; |
272 m_ancestorDisabledState = AncestorDisabledStateUnknown; | 272 m_ancestorDisabledState = AncestorDisabledStateUnknown; |
273 m_dataListAncestorState = Unknown; | 273 m_dataListAncestorState = Unknown; |
274 setNeedsWillValidateCheck(); | 274 setNeedsWillValidateCheck(); |
275 HTMLElement::removedFrom(insertionPoint); | 275 HTMLElement::removedFrom(insertionPoint); |
276 FormAssociatedElement::removedFrom(insertionPoint); | 276 ListedElement::removedFrom(insertionPoint); |
277 } | 277 } |
278 | 278 |
279 void HTMLFormControlElement::willChangeForm() { | 279 void HTMLFormControlElement::willChangeForm() { |
280 FormAssociatedElement::willChangeForm(); | 280 ListedElement::willChangeForm(); |
281 formOwnerSetNeedsValidityCheck(); | 281 formOwnerSetNeedsValidityCheck(); |
282 if (formOwner() && canBeSuccessfulSubmitButton()) | 282 if (formOwner() && canBeSuccessfulSubmitButton()) |
283 formOwner()->invalidateDefaultButtonStyle(); | 283 formOwner()->invalidateDefaultButtonStyle(); |
284 } | 284 } |
285 | 285 |
286 void HTMLFormControlElement::didChangeForm() { | 286 void HTMLFormControlElement::didChangeForm() { |
287 FormAssociatedElement::didChangeForm(); | 287 ListedElement::didChangeForm(); |
288 formOwnerSetNeedsValidityCheck(); | 288 formOwnerSetNeedsValidityCheck(); |
289 if (formOwner() && isConnected() && canBeSuccessfulSubmitButton()) | 289 if (formOwner() && isConnected() && canBeSuccessfulSubmitButton()) |
290 formOwner()->invalidateDefaultButtonStyle(); | 290 formOwner()->invalidateDefaultButtonStyle(); |
291 } | 291 } |
292 | 292 |
293 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() { | 293 void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() { |
294 if (HTMLFormElement* form = formOwner()) { | 294 if (HTMLFormElement* form = formOwner()) { |
295 form->pseudoStateChanged(CSSSelector::PseudoValid); | 295 form->pseudoStateChanged(CSSSelector::PseudoValid); |
296 form->pseudoStateChanged(CSSSelector::PseudoInvalid); | 296 form->pseudoStateChanged(CSSSelector::PseudoInvalid); |
297 } | 297 } |
(...skipping 10 matching lines...) Expand all Loading... |
308 fieldSet->pseudoStateChanged(CSSSelector::PseudoValid); | 308 fieldSet->pseudoStateChanged(CSSSelector::PseudoValid); |
309 fieldSet->pseudoStateChanged(CSSSelector::PseudoInvalid); | 309 fieldSet->pseudoStateChanged(CSSSelector::PseudoInvalid); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 void HTMLFormControlElement::dispatchChangeEvent() { | 313 void HTMLFormControlElement::dispatchChangeEvent() { |
314 dispatchScopedEvent(Event::createBubble(EventTypeNames::change)); | 314 dispatchScopedEvent(Event::createBubble(EventTypeNames::change)); |
315 } | 315 } |
316 | 316 |
317 HTMLFormElement* HTMLFormControlElement::formOwner() const { | 317 HTMLFormElement* HTMLFormControlElement::formOwner() const { |
318 return FormAssociatedElement::form(); | 318 return ListedElement::form(); |
319 } | 319 } |
320 | 320 |
321 bool HTMLFormControlElement::isDisabledFormControl() const { | 321 bool HTMLFormControlElement::isDisabledFormControl() const { |
322 if (fastHasAttribute(disabledAttr)) | 322 if (fastHasAttribute(disabledAttr)) |
323 return true; | 323 return true; |
324 | 324 |
325 if (m_ancestorDisabledState == AncestorDisabledStateUnknown) | 325 if (m_ancestorDisabledState == AncestorDisabledStateUnknown) |
326 updateAncestorDisabledState(); | 326 updateAncestorDisabledState(); |
327 return m_ancestorDisabledState == AncestorDisabledStateDisabled; | 327 return m_ancestorDisabledState == AncestorDisabledStateDisabled; |
328 } | 328 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 // Updates only if this control already has a validation message. | 580 // Updates only if this control already has a validation message. |
581 if (isValidationMessageVisible()) { | 581 if (isValidationMessageVisible()) { |
582 // Calls updateVisibleValidationMessage() even if m_isValid is not | 582 // Calls updateVisibleValidationMessage() even if m_isValid is not |
583 // changed because a validation message can be changed. | 583 // changed because a validation message can be changed. |
584 updateVisibleValidationMessage(); | 584 updateVisibleValidationMessage(); |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 void HTMLFormControlElement::setCustomValidity(const String& error) { | 588 void HTMLFormControlElement::setCustomValidity(const String& error) { |
589 FormAssociatedElement::setCustomValidity(error); | 589 ListedElement::setCustomValidity(error); |
590 setNeedsValidityCheck(); | 590 setNeedsValidityCheck(); |
591 } | 591 } |
592 | 592 |
593 void HTMLFormControlElement::dispatchBlurEvent( | 593 void HTMLFormControlElement::dispatchBlurEvent( |
594 Element* newFocusedElement, | 594 Element* newFocusedElement, |
595 WebFocusType type, | 595 WebFocusType type, |
596 InputDeviceCapabilities* sourceCapabilities) { | 596 InputDeviceCapabilities* sourceCapabilities) { |
597 if (type != WebFocusTypePage) | 597 if (type != WebFocusTypePage) |
598 m_wasFocusedByMouse = false; | 598 m_wasFocusedByMouse = false; |
599 HTMLElement::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities); | 599 HTMLElement::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities); |
(...skipping 21 matching lines...) Expand all Loading... |
621 return trimmedName; | 621 return trimmedName; |
622 } | 622 } |
623 | 623 |
624 void HTMLFormControlElement::copyNonAttributePropertiesFromElement( | 624 void HTMLFormControlElement::copyNonAttributePropertiesFromElement( |
625 const Element& source) { | 625 const Element& source) { |
626 HTMLElement::copyNonAttributePropertiesFromElement(source); | 626 HTMLElement::copyNonAttributePropertiesFromElement(source); |
627 setNeedsValidityCheck(); | 627 setNeedsValidityCheck(); |
628 } | 628 } |
629 | 629 |
630 } // namespace blink | 630 } // namespace blink |
OLD | NEW |