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

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

Issue 547823002: Track reasons for |Node::SetNeedsStyleRecalc| (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use AtomicString Created 6 years, 2 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
« no previous file with comments | « Source/core/html/HTMLFrameSetElement.cpp ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 m_autocomplete = Uninitialized; 648 m_autocomplete = Uninitialized;
649 else 649 else
650 m_autocomplete = On; 650 m_autocomplete = On;
651 } 651 }
652 } else if (name == typeAttr) 652 } else if (name == typeAttr)
653 updateType(); 653 updateType();
654 else if (name == valueAttr) { 654 else if (name == valueAttr) {
655 // We only need to setChanged if the form is looking at the default valu e right now. 655 // We only need to setChanged if the form is looking at the default valu e right now.
656 if (!hasDirtyValue()) { 656 if (!hasDirtyValue()) {
657 updatePlaceholderVisibility(false); 657 updatePlaceholderVisibility(false);
658 setNeedsStyleRecalc(SubtreeStyleChange); 658 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :fromAttribute(valueAttr));
659 } 659 }
660 m_needsToUpdateViewValue = true; 660 m_needsToUpdateViewValue = true;
661 setNeedsValidityCheck(); 661 setNeedsValidityCheck();
662 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; 662 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress;
663 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); 663 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value);
664 m_inputTypeView->valueAttributeChanged(); 664 m_inputTypeView->valueAttributeChanged();
665 } else if (name == checkedAttr) { 665 } else if (name == checkedAttr) {
666 // Another radio button in the same group might be checked by state 666 // Another radio button in the same group might be checked by state
667 // restore. We shouldn't call setChecked() even if this has the checked 667 // restore. We shouldn't call setChecked() even if this has the checked
668 // attribute. So, delay the setChecked() call until 668 // attribute. So, delay the setChecked() call until
(...skipping 19 matching lines...) Expand all
688 } else if (name == onsearchAttr) { 688 } else if (name == onsearchAttr) {
689 // Search field and slider attributes all just cause updateFromElement t o be called through style recalcing. 689 // Search field and slider attributes all just cause updateFromElement t o be called through style recalcing.
690 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi stener(this, name, value, eventParameterName())); 690 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi stener(this, name, value, eventParameterName()));
691 } else if (name == resultsAttr) { 691 } else if (name == resultsAttr) {
692 int oldResults = m_maxResults; 692 int oldResults = m_maxResults;
693 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults ) : -1; 693 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults ) : -1;
694 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right 694 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right
695 // time to relayout for this change. 695 // time to relayout for this change.
696 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) ) 696 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) )
697 lazyReattachIfAttached(); 697 lazyReattachIfAttached();
698 setNeedsStyleRecalc(SubtreeStyleChange); 698 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fro mAttribute(resultsAttr));
699 UseCounter::count(document(), UseCounter::ResultsAttribute); 699 UseCounter::count(document(), UseCounter::ResultsAttribute);
700 } else if (name == incrementalAttr) { 700 } else if (name == incrementalAttr) {
701 setNeedsStyleRecalc(SubtreeStyleChange); 701 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fro mAttribute(incrementalAttr));
702 UseCounter::count(document(), UseCounter::IncrementalAttribute); 702 UseCounter::count(document(), UseCounter::IncrementalAttribute);
703 } else if (name == minAttr) { 703 } else if (name == minAttr) {
704 m_inputTypeView->minOrMaxAttributeChanged(); 704 m_inputTypeView->minOrMaxAttributeChanged();
705 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); 705 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange();
706 setNeedsValidityCheck(); 706 setNeedsValidityCheck();
707 UseCounter::count(document(), UseCounter::MinAttribute); 707 UseCounter::count(document(), UseCounter::MinAttribute);
708 } else if (name == maxAttr) { 708 } else if (name == maxAttr) {
709 m_inputTypeView->minOrMaxAttributeChanged(); 709 m_inputTypeView->minOrMaxAttributeChanged();
710 setNeedsValidityCheck(); 710 setNeedsValidityCheck();
711 UseCounter::count(document(), UseCounter::MaxAttribute); 711 UseCounter::count(document(), UseCounter::MaxAttribute);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 { 952 {
953 return m_suggestedValue; 953 return m_suggestedValue;
954 } 954 }
955 955
956 void HTMLInputElement::setSuggestedValue(const String& value) 956 void HTMLInputElement::setSuggestedValue(const String& value)
957 { 957 {
958 if (!m_inputType->canSetSuggestedValue()) 958 if (!m_inputType->canSetSuggestedValue())
959 return; 959 return;
960 m_needsToUpdateViewValue = true; 960 m_needsToUpdateViewValue = true;
961 m_suggestedValue = sanitizeValue(value); 961 m_suggestedValue = sanitizeValue(value);
962 setNeedsStyleRecalc(SubtreeStyleChange); 962 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::ControlValue));
963 m_inputTypeView->updateView(); 963 m_inputTypeView->updateView();
964 } 964 }
965 965
966 void HTMLInputElement::setEditingValue(const String& value) 966 void HTMLInputElement::setEditingValue(const String& value)
967 { 967 {
968 if (!renderer() || !isTextField()) 968 if (!renderer() || !isTextField())
969 return; 969 return;
970 setInnerEditorValue(value); 970 setInnerEditorValue(value);
971 subtreeHasChanged(); 971 subtreeHasChanged();
972 972
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 { 1586 {
1587 int maxLength; 1587 int maxLength;
1588 if (!parseHTMLInteger(value, maxLength)) 1588 if (!parseHTMLInteger(value, maxLength))
1589 maxLength = maximumLength; 1589 maxLength = maximumLength;
1590 if (maxLength < 0 || maxLength > maximumLength) 1590 if (maxLength < 0 || maxLength > maximumLength)
1591 maxLength = maximumLength; 1591 maxLength = maximumLength;
1592 int oldMaxLength = m_maxLength; 1592 int oldMaxLength = m_maxLength;
1593 m_maxLength = maxLength; 1593 m_maxLength = maxLength;
1594 if (oldMaxLength != maxLength) 1594 if (oldMaxLength != maxLength)
1595 updateValueIfNeeded(); 1595 updateValueIfNeeded();
1596 setNeedsStyleRecalc(SubtreeStyleChange); 1596 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAtt ribute(maxlengthAttr));
1597 setNeedsValidityCheck(); 1597 setNeedsValidityCheck();
1598 } 1598 }
1599 1599
1600 void HTMLInputElement::updateValueIfNeeded() 1600 void HTMLInputElement::updateValueIfNeeded()
1601 { 1601 {
1602 String newValue = sanitizeValue(m_valueIfDirty); 1602 String newValue = sanitizeValue(m_valueIfDirty);
1603 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); 1603 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull());
1604 if (newValue != m_valueIfDirty) 1604 if (newValue != m_valueIfDirty)
1605 setValue(newValue); 1605 setValue(newValue);
1606 } 1606 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 { 1804 {
1805 listAttributeTargetChanged(); 1805 listAttributeTargetChanged();
1806 } 1806 }
1807 1807
1808 AXObject* HTMLInputElement::popupRootAXObject() 1808 AXObject* HTMLInputElement::popupRootAXObject()
1809 { 1809 {
1810 return m_inputTypeView->popupRootAXObject(); 1810 return m_inputTypeView->popupRootAXObject();
1811 } 1811 }
1812 1812
1813 } // namespace 1813 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameSetElement.cpp ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698