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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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
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, 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 527
528 if (document().focusedElement() == this) 528 if (document().focusedElement() == this)
529 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); 529 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore);
530 530
531 setTextAsOfLastFormControlChangeEvent(value()); 531 setTextAsOfLastFormControlChangeEvent(value());
532 setChangedSinceLastFormControlChangeEvent(false); 532 setChangedSinceLastFormControlChangeEvent(false);
533 533
534 addToRadioButtonGroup(); 534 addToRadioButtonGroup();
535 535
536 setNeedsValidityCheck(); 536 setNeedsValidityCheck();
537 if ((couldBeSuccessfulSubmitButton || canBeSuccessfulSubmitButton()) && form Owner() && inDocument()) 537 if ((couldBeSuccessfulSubmitButton || canBeSuccessfulSubmitButton()) && form Owner() && inShadowIncludingDocument())
538 formOwner()->invalidateDefaultButtonStyle(); 538 formOwner()->invalidateDefaultButtonStyle();
539 notifyFormStateChanged(); 539 notifyFormStateChanged();
540 } 540 }
541 541
542 void HTMLInputElement::subtreeHasChanged() 542 void HTMLInputElement::subtreeHasChanged()
543 { 543 {
544 m_inputTypeView->subtreeHasChanged(); 544 m_inputTypeView->subtreeHasChanged();
545 // When typing in an input field, childrenChanged is not called, so we need to force the directionality check. 545 // When typing in an input field, childrenChanged is not called, so we need to force the directionality check.
546 calculateAndAdjustDirectionality(); 546 calculateAndAdjustDirectionality();
547 } 547 }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 m_reflectsCheckedAttribute = true; 903 m_reflectsCheckedAttribute = true;
904 } 904 }
905 905
906 bool HTMLInputElement::isTextField() const 906 bool HTMLInputElement::isTextField() const
907 { 907 {
908 return m_inputType->isTextField(); 908 return m_inputType->isTextField();
909 } 909 }
910 910
911 void HTMLInputElement::dispatchChangeEventIfNeeded() 911 void HTMLInputElement::dispatchChangeEventIfNeeded()
912 { 912 {
913 if (inDocument() && m_inputType->shouldSendChangeEventAfterCheckedChanged()) 913 if (inShadowIncludingDocument() && m_inputType->shouldSendChangeEventAfterCh eckedChanged())
914 dispatchChangeEvent(); 914 dispatchChangeEvent();
915 } 915 }
916 916
917 bool HTMLInputElement::checked() const 917 bool HTMLInputElement::checked() const
918 { 918 {
919 m_inputType->readingChecked(); 919 m_inputType->readingChecked();
920 return m_isChecked; 920 return m_isChecked;
921 } 921 }
922 922
923 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) 923 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior)
(...skipping 18 matching lines...) Expand all
942 if (layoutObject()) { 942 if (layoutObject()) {
943 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) 943 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che())
944 cache->checkedStateChanged(this); 944 cache->checkedStateChanged(this);
945 } 945 }
946 946
947 // Only send a change event for items in the document (avoid firing during 947 // Only send a change event for items in the document (avoid firing during
948 // parsing) and don't send a change event for a radio button that's getting 948 // parsing) and don't send a change event for a radio button that's getting
949 // unchecked to match other browsers. DOM is not a useful standard for this 949 // unchecked to match other browsers. DOM is not a useful standard for this
950 // because it says only to fire change events at "lose focus" time, which is 950 // because it says only to fire change events at "lose focus" time, which is
951 // definitely wrong in practice for these types of elements. 951 // definitely wrong in practice for these types of elements.
952 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS endChangeEventAfterCheckedChanged()) { 952 if (eventBehavior != DispatchNoEvent && inShadowIncludingDocument() && m_inp utType->shouldSendChangeEventAfterCheckedChanged()) {
953 setTextAsOfLastFormControlChangeEvent(String()); 953 setTextAsOfLastFormControlChangeEvent(String());
954 if (eventBehavior == DispatchInputAndChangeEvent) 954 if (eventBehavior == DispatchInputAndChangeEvent)
955 dispatchFormControlInputEvent(); 955 dispatchFormControlInputEvent();
956 } 956 }
957 957
958 pseudoStateChanged(CSSSelector::PseudoChecked); 958 pseudoStateChanged(CSSSelector::PseudoChecked);
959 } 959 }
960 960
961 void HTMLInputElement::setIndeterminate(bool newValue) 961 void HTMLInputElement::setIndeterminate(bool newValue)
962 { 962 {
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 1519
1520 void HTMLInputElement::didChangeForm() 1520 void HTMLInputElement::didChangeForm()
1521 { 1521 {
1522 HTMLTextFormControlElement::didChangeForm(); 1522 HTMLTextFormControlElement::didChangeForm();
1523 addToRadioButtonGroup(); 1523 addToRadioButtonGroup();
1524 } 1524 }
1525 1525
1526 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode* insertionPoint) 1526 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode* insertionPoint)
1527 { 1527 {
1528 HTMLTextFormControlElement::insertedInto(insertionPoint); 1528 HTMLTextFormControlElement::insertedInto(insertionPoint);
1529 if (insertionPoint->inDocument() && !form()) 1529 if (insertionPoint->inShadowIncludingDocument() && !form())
1530 addToRadioButtonGroup(); 1530 addToRadioButtonGroup();
1531 resetListAttributeTargetObserver(); 1531 resetListAttributeTargetObserver();
1532 logAddElementIfIsolatedWorldAndInDocument("input", typeAttr, formactionAttr) ; 1532 logAddElementIfIsolatedWorldAndInDocument("input", typeAttr, formactionAttr) ;
1533 return InsertionShouldCallDidNotifySubtreeInsertions; 1533 return InsertionShouldCallDidNotifySubtreeInsertions;
1534 } 1534 }
1535 1535
1536 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) 1536 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint)
1537 { 1537 {
1538 m_inputTypeView->closePopupView(); 1538 m_inputTypeView->closePopupView();
1539 if (insertionPoint->inDocument() && !form()) 1539 if (insertionPoint->inShadowIncludingDocument() && !form())
1540 removeFromRadioButtonGroup(); 1540 removeFromRadioButtonGroup();
1541 HTMLTextFormControlElement::removedFrom(insertionPoint); 1541 HTMLTextFormControlElement::removedFrom(insertionPoint);
1542 ASSERT(!inDocument()); 1542 ASSERT(!inShadowIncludingDocument());
1543 resetListAttributeTargetObserver(); 1543 resetListAttributeTargetObserver();
1544 } 1544 }
1545 1545
1546 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) 1546 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument)
1547 { 1547 {
1548 if (imageLoader()) 1548 if (imageLoader())
1549 imageLoader()->elementDidMoveToNewDocument(); 1549 imageLoader()->elementDidMoveToNewDocument();
1550 1550
1551 // FIXME: Remove type check. 1551 // FIXME: Remove type check.
1552 if (type() == InputTypeNames::radio) 1552 if (type() == InputTypeNames::radio)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 1625
1626 void HTMLInputElement::setListAttributeTargetObserver(RawPtr<ListAttributeTarget Observer> newObserver) 1626 void HTMLInputElement::setListAttributeTargetObserver(RawPtr<ListAttributeTarget Observer> newObserver)
1627 { 1627 {
1628 if (m_listAttributeTargetObserver) 1628 if (m_listAttributeTargetObserver)
1629 m_listAttributeTargetObserver->unregister(); 1629 m_listAttributeTargetObserver->unregister();
1630 m_listAttributeTargetObserver = newObserver; 1630 m_listAttributeTargetObserver = newObserver;
1631 } 1631 }
1632 1632
1633 void HTMLInputElement::resetListAttributeTargetObserver() 1633 void HTMLInputElement::resetListAttributeTargetObserver()
1634 { 1634 {
1635 if (inDocument()) 1635 if (inShadowIncludingDocument())
1636 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG etAttribute(listAttr), this)); 1636 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG etAttribute(listAttr), this));
1637 else 1637 else
1638 setListAttributeTargetObserver(nullptr); 1638 setListAttributeTargetObserver(nullptr);
1639 } 1639 }
1640 1640
1641 void HTMLInputElement::listAttributeTargetChanged() 1641 void HTMLInputElement::listAttributeTargetChanged()
1642 { 1642 {
1643 m_inputTypeView->listAttributeTargetChanged(); 1643 m_inputTypeView->listAttributeTargetChanged();
1644 } 1644 }
1645 1645
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 return nullptr; 1757 return nullptr;
1758 } 1758 }
1759 1759
1760 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const 1760 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const
1761 { 1761 {
1762 // FIXME: Remove type check. 1762 // FIXME: Remove type check.
1763 if (type() != InputTypeNames::radio) 1763 if (type() != InputTypeNames::radio)
1764 return nullptr; 1764 return nullptr;
1765 if (HTMLFormElement* formElement = form()) 1765 if (HTMLFormElement* formElement = form())
1766 return &formElement->radioButtonGroupScope(); 1766 return &formElement->radioButtonGroupScope();
1767 if (inDocument()) 1767 if (inShadowIncludingDocument())
1768 return &treeScope().radioButtonGroupScope(); 1768 return &treeScope().radioButtonGroupScope();
1769 return nullptr; 1769 return nullptr;
1770 } 1770 }
1771 1771
1772 unsigned HTMLInputElement::sizeOfRadioGroup() const 1772 unsigned HTMLInputElement::sizeOfRadioGroup() const
1773 { 1773 {
1774 RadioButtonGroupScope* scope = radioButtonGroupScope(); 1774 RadioButtonGroupScope* scope = radioButtonGroupScope();
1775 if (!scope) 1775 if (!scope)
1776 return 0; 1776 return 0;
1777 return scope->groupSizeFor(this); 1777 return scope->groupSizeFor(this);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 void HTMLInputElement::ensurePrimaryContent() 1949 void HTMLInputElement::ensurePrimaryContent()
1950 { 1950 {
1951 m_inputTypeView->ensurePrimaryContent(); 1951 m_inputTypeView->ensurePrimaryContent();
1952 } 1952 }
1953 1953
1954 bool HTMLInputElement::hasFallbackContent() const 1954 bool HTMLInputElement::hasFallbackContent() const
1955 { 1955 {
1956 return m_inputTypeView->hasFallbackContent(); 1956 return m_inputTypeView->hasFallbackContent();
1957 } 1957 }
1958 } // namespace blink 1958 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLImageElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLLabelElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698