| 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, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 501 |
| 502 if (document().focusedElement() == this) | 502 if (document().focusedElement() == this) |
| 503 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); | 503 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); |
| 504 | 504 |
| 505 setTextAsOfLastFormControlChangeEvent(value()); | 505 setTextAsOfLastFormControlChangeEvent(value()); |
| 506 setChangedSinceLastFormControlChangeEvent(false); | 506 setChangedSinceLastFormControlChangeEvent(false); |
| 507 | 507 |
| 508 addToRadioButtonGroup(); | 508 addToRadioButtonGroup(); |
| 509 | 509 |
| 510 setNeedsValidityCheck(); | 510 setNeedsValidityCheck(); |
| 511 if ((couldBeSuccessfulSubmitButton || canBeSuccessfulSubmitButton()) && form
Owner() && inShadowIncludingDocument()) | 511 if ((couldBeSuccessfulSubmitButton || canBeSuccessfulSubmitButton()) && form
Owner() && isConnected()) |
| 512 formOwner()->invalidateDefaultButtonStyle(); | 512 formOwner()->invalidateDefaultButtonStyle(); |
| 513 notifyFormStateChanged(); | 513 notifyFormStateChanged(); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void HTMLInputElement::subtreeHasChanged() | 516 void HTMLInputElement::subtreeHasChanged() |
| 517 { | 517 { |
| 518 m_inputTypeView->subtreeHasChanged(); | 518 m_inputTypeView->subtreeHasChanged(); |
| 519 // When typing in an input field, childrenChanged is not called, so we need
to force the directionality check. | 519 // When typing in an input field, childrenChanged is not called, so we need
to force the directionality check. |
| 520 calculateAndAdjustDirectionality(); | 520 calculateAndAdjustDirectionality(); |
| 521 } | 521 } |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 m_dirtyCheckedness = false; | 866 m_dirtyCheckedness = false; |
| 867 } | 867 } |
| 868 | 868 |
| 869 bool HTMLInputElement::isTextField() const | 869 bool HTMLInputElement::isTextField() const |
| 870 { | 870 { |
| 871 return m_inputType->isTextField(); | 871 return m_inputType->isTextField(); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void HTMLInputElement::dispatchChangeEventIfNeeded() | 874 void HTMLInputElement::dispatchChangeEventIfNeeded() |
| 875 { | 875 { |
| 876 if (inShadowIncludingDocument() && m_inputType->shouldSendChangeEventAfterCh
eckedChanged()) | 876 if (isConnected() && m_inputType->shouldSendChangeEventAfterCheckedChanged()
) |
| 877 dispatchChangeEvent(); | 877 dispatchChangeEvent(); |
| 878 } | 878 } |
| 879 | 879 |
| 880 bool HTMLInputElement::checked() const | 880 bool HTMLInputElement::checked() const |
| 881 { | 881 { |
| 882 m_inputType->readingChecked(); | 882 m_inputType->readingChecked(); |
| 883 return m_isChecked; | 883 return m_isChecked; |
| 884 } | 884 } |
| 885 | 885 |
| 886 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) | 886 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 904 if (layoutObject()) { | 904 if (layoutObject()) { |
| 905 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa
che()) | 905 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa
che()) |
| 906 cache->checkedStateChanged(this); | 906 cache->checkedStateChanged(this); |
| 907 } | 907 } |
| 908 | 908 |
| 909 // Only send a change event for items in the document (avoid firing during | 909 // Only send a change event for items in the document (avoid firing during |
| 910 // parsing) and don't send a change event for a radio button that's getting | 910 // parsing) and don't send a change event for a radio button that's getting |
| 911 // unchecked to match other browsers. DOM is not a useful standard for this | 911 // unchecked to match other browsers. DOM is not a useful standard for this |
| 912 // because it says only to fire change events at "lose focus" time, which is | 912 // because it says only to fire change events at "lose focus" time, which is |
| 913 // definitely wrong in practice for these types of elements. | 913 // definitely wrong in practice for these types of elements. |
| 914 if (eventBehavior != DispatchNoEvent && inShadowIncludingDocument() && m_inp
utType->shouldSendChangeEventAfterCheckedChanged()) { | 914 if (eventBehavior != DispatchNoEvent && isConnected() && m_inputType->should
SendChangeEventAfterCheckedChanged()) { |
| 915 setTextAsOfLastFormControlChangeEvent(String()); | 915 setTextAsOfLastFormControlChangeEvent(String()); |
| 916 if (eventBehavior == DispatchInputAndChangeEvent) | 916 if (eventBehavior == DispatchInputAndChangeEvent) |
| 917 dispatchFormControlInputEvent(); | 917 dispatchFormControlInputEvent(); |
| 918 } | 918 } |
| 919 | 919 |
| 920 pseudoStateChanged(CSSSelector::PseudoChecked); | 920 pseudoStateChanged(CSSSelector::PseudoChecked); |
| 921 } | 921 } |
| 922 | 922 |
| 923 void HTMLInputElement::setIndeterminate(bool newValue) | 923 void HTMLInputElement::setIndeterminate(bool newValue) |
| 924 { | 924 { |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 | 1473 |
| 1474 void HTMLInputElement::didChangeForm() | 1474 void HTMLInputElement::didChangeForm() |
| 1475 { | 1475 { |
| 1476 HTMLTextFormControlElement::didChangeForm(); | 1476 HTMLTextFormControlElement::didChangeForm(); |
| 1477 addToRadioButtonGroup(); | 1477 addToRadioButtonGroup(); |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode*
insertionPoint) | 1480 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode*
insertionPoint) |
| 1481 { | 1481 { |
| 1482 HTMLTextFormControlElement::insertedInto(insertionPoint); | 1482 HTMLTextFormControlElement::insertedInto(insertionPoint); |
| 1483 if (insertionPoint->inShadowIncludingDocument() && !form()) | 1483 if (insertionPoint->isConnected() && !form()) |
| 1484 addToRadioButtonGroup(); | 1484 addToRadioButtonGroup(); |
| 1485 resetListAttributeTargetObserver(); | 1485 resetListAttributeTargetObserver(); |
| 1486 logAddElementIfIsolatedWorldAndInDocument("input", typeAttr, formactionAttr)
; | 1486 logAddElementIfIsolatedWorldAndInDocument("input", typeAttr, formactionAttr)
; |
| 1487 return InsertionShouldCallDidNotifySubtreeInsertions; | 1487 return InsertionShouldCallDidNotifySubtreeInsertions; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) | 1490 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) |
| 1491 { | 1491 { |
| 1492 m_inputTypeView->closePopupView(); | 1492 m_inputTypeView->closePopupView(); |
| 1493 if (insertionPoint->inShadowIncludingDocument() && !form()) | 1493 if (insertionPoint->isConnected() && !form()) |
| 1494 removeFromRadioButtonGroup(); | 1494 removeFromRadioButtonGroup(); |
| 1495 HTMLTextFormControlElement::removedFrom(insertionPoint); | 1495 HTMLTextFormControlElement::removedFrom(insertionPoint); |
| 1496 ASSERT(!inShadowIncludingDocument()); | 1496 ASSERT(!isConnected()); |
| 1497 resetListAttributeTargetObserver(); | 1497 resetListAttributeTargetObserver(); |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) | 1500 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) |
| 1501 { | 1501 { |
| 1502 if (imageLoader()) | 1502 if (imageLoader()) |
| 1503 imageLoader()->elementDidMoveToNewDocument(); | 1503 imageLoader()->elementDidMoveToNewDocument(); |
| 1504 | 1504 |
| 1505 // FIXME: Remove type check. | 1505 // FIXME: Remove type check. |
| 1506 if (type() == InputTypeNames::radio) | 1506 if (type() == InputTypeNames::radio) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 | 1585 |
| 1586 void HTMLInputElement::setListAttributeTargetObserver(ListAttributeTargetObserve
r* newObserver) | 1586 void HTMLInputElement::setListAttributeTargetObserver(ListAttributeTargetObserve
r* newObserver) |
| 1587 { | 1587 { |
| 1588 if (m_listAttributeTargetObserver) | 1588 if (m_listAttributeTargetObserver) |
| 1589 m_listAttributeTargetObserver->unregister(); | 1589 m_listAttributeTargetObserver->unregister(); |
| 1590 m_listAttributeTargetObserver = newObserver; | 1590 m_listAttributeTargetObserver = newObserver; |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 void HTMLInputElement::resetListAttributeTargetObserver() | 1593 void HTMLInputElement::resetListAttributeTargetObserver() |
| 1594 { | 1594 { |
| 1595 if (inShadowIncludingDocument()) | 1595 if (isConnected()) |
| 1596 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG
etAttribute(listAttr), this)); | 1596 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG
etAttribute(listAttr), this)); |
| 1597 else | 1597 else |
| 1598 setListAttributeTargetObserver(nullptr); | 1598 setListAttributeTargetObserver(nullptr); |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 void HTMLInputElement::listAttributeTargetChanged() | 1601 void HTMLInputElement::listAttributeTargetChanged() |
| 1602 { | 1602 { |
| 1603 m_inputTypeView->listAttributeTargetChanged(); | 1603 m_inputTypeView->listAttributeTargetChanged(); |
| 1604 } | 1604 } |
| 1605 | 1605 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 return nullptr; | 1717 return nullptr; |
| 1718 } | 1718 } |
| 1719 | 1719 |
| 1720 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const | 1720 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const |
| 1721 { | 1721 { |
| 1722 // FIXME: Remove type check. | 1722 // FIXME: Remove type check. |
| 1723 if (type() != InputTypeNames::radio) | 1723 if (type() != InputTypeNames::radio) |
| 1724 return nullptr; | 1724 return nullptr; |
| 1725 if (HTMLFormElement* formElement = form()) | 1725 if (HTMLFormElement* formElement = form()) |
| 1726 return &formElement->radioButtonGroupScope(); | 1726 return &formElement->radioButtonGroupScope(); |
| 1727 if (inShadowIncludingDocument()) | 1727 if (isConnected()) |
| 1728 return &treeScope().radioButtonGroupScope(); | 1728 return &treeScope().radioButtonGroupScope(); |
| 1729 return nullptr; | 1729 return nullptr; |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 unsigned HTMLInputElement::sizeOfRadioGroup() const | 1732 unsigned HTMLInputElement::sizeOfRadioGroup() const |
| 1733 { | 1733 { |
| 1734 RadioButtonGroupScope* scope = radioButtonGroupScope(); | 1734 RadioButtonGroupScope* scope = radioButtonGroupScope(); |
| 1735 if (!scope) | 1735 if (!scope) |
| 1736 return 0; | 1736 return 0; |
| 1737 return scope->groupSizeFor(this); | 1737 return scope->groupSizeFor(this); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 { | 1914 { |
| 1915 return m_inputTypeView->hasFallbackContent(); | 1915 return m_inputTypeView->hasFallbackContent(); |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) | 1918 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) |
| 1919 { | 1919 { |
| 1920 return m_inputType->setFilesFromPaths(paths); | 1920 return m_inputType->setFilesFromPaths(paths); |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 } // namespace blink | 1923 } // namespace blink |
| OLD | NEW |