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

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

Issue 152623002: Make StyleChange parameter explicit in setNeedsStyleRecalc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 m_autocomplete = Uninitialized; 642 m_autocomplete = Uninitialized;
643 else 643 else
644 m_autocomplete = On; 644 m_autocomplete = On;
645 } 645 }
646 } else if (name == typeAttr) 646 } else if (name == typeAttr)
647 updateType(); 647 updateType();
648 else if (name == valueAttr) { 648 else if (name == valueAttr) {
649 // We only need to setChanged if the form is looking at the default valu e right now. 649 // We only need to setChanged if the form is looking at the default valu e right now.
650 if (!hasDirtyValue()) { 650 if (!hasDirtyValue()) {
651 updatePlaceholderVisibility(false); 651 updatePlaceholderVisibility(false);
652 setNeedsStyleRecalc(); 652 setNeedsStyleRecalc(SubtreeStyleChange);
653 } 653 }
654 setFormControlValueMatchesRenderer(false); 654 setFormControlValueMatchesRenderer(false);
655 setNeedsValidityCheck(); 655 setNeedsValidityCheck();
656 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; 656 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress;
657 m_inputTypeView->valueAttributeChanged(); 657 m_inputTypeView->valueAttributeChanged();
658 } else if (name == checkedAttr) { 658 } else if (name == checkedAttr) {
659 // Another radio button in the same group might be checked by state 659 // Another radio button in the same group might be checked by state
660 // restore. We shouldn't call setChecked() even if this has the checked 660 // restore. We shouldn't call setChecked() even if this has the checked
661 // attribute. So, delay the setChecked() call until 661 // attribute. So, delay the setChecked() call until
662 // finishParsingChildren() is called if parsing is in progress. 662 // finishParsingChildren() is called if parsing is in progress.
(...skipping 18 matching lines...) Expand all
681 } else if (name == onsearchAttr) { 681 } else if (name == onsearchAttr) {
682 // Search field and slider attributes all just cause updateFromElement t o be called through style recalcing. 682 // Search field and slider attributes all just cause updateFromElement t o be called through style recalcing.
683 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi stener(this, name, value)); 683 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi stener(this, name, value));
684 } else if (name == resultsAttr) { 684 } else if (name == resultsAttr) {
685 int oldResults = m_maxResults; 685 int oldResults = m_maxResults;
686 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults ) : -1; 686 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults ) : -1;
687 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right 687 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right
688 // time to relayout for this change. 688 // time to relayout for this change.
689 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) ) 689 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) )
690 lazyReattachIfAttached(); 690 lazyReattachIfAttached();
691 setNeedsStyleRecalc(); 691 setNeedsStyleRecalc(SubtreeStyleChange);
692 UseCounter::count(document(), UseCounter::ResultsAttribute); 692 UseCounter::count(document(), UseCounter::ResultsAttribute);
693 } else if (name == incrementalAttr) { 693 } else if (name == incrementalAttr) {
694 setNeedsStyleRecalc(); 694 setNeedsStyleRecalc(SubtreeStyleChange);
695 UseCounter::count(document(), UseCounter::IncrementalAttribute); 695 UseCounter::count(document(), UseCounter::IncrementalAttribute);
696 } else if (name == minAttr) { 696 } else if (name == minAttr) {
697 m_inputTypeView->minOrMaxAttributeChanged(); 697 m_inputTypeView->minOrMaxAttributeChanged();
698 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); 698 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange();
699 setNeedsValidityCheck(); 699 setNeedsValidityCheck();
700 UseCounter::count(document(), UseCounter::MinAttribute); 700 UseCounter::count(document(), UseCounter::MinAttribute);
701 } else if (name == maxAttr) { 701 } else if (name == maxAttr) {
702 m_inputTypeView->minOrMaxAttributeChanged(); 702 m_inputTypeView->minOrMaxAttributeChanged();
703 setNeedsValidityCheck(); 703 setNeedsValidityCheck();
704 UseCounter::count(document(), UseCounter::MaxAttribute); 704 UseCounter::count(document(), UseCounter::MaxAttribute);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 return m_inputType->isTextType(); 859 return m_inputType->isTextType();
860 } 860 }
861 861
862 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) 862 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior)
863 { 863 {
864 if (checked() == nowChecked) 864 if (checked() == nowChecked)
865 return; 865 return;
866 866
867 m_reflectsCheckedAttribute = false; 867 m_reflectsCheckedAttribute = false;
868 m_isChecked = nowChecked; 868 m_isChecked = nowChecked;
869 setNeedsStyleRecalc(); 869 setNeedsStyleRecalc(SubtreeStyleChange);
870 870
871 if (CheckedRadioButtons* buttons = checkedRadioButtons()) 871 if (CheckedRadioButtons* buttons = checkedRadioButtons())
872 buttons->updateCheckedState(this); 872 buttons->updateCheckedState(this);
873 if (renderer() && renderer()->style()->hasAppearance()) 873 if (renderer() && renderer()->style()->hasAppearance())
874 RenderTheme::theme().stateChanged(renderer(), CheckedState); 874 RenderTheme::theme().stateChanged(renderer(), CheckedState);
875 875
876 setNeedsValidityCheck(); 876 setNeedsValidityCheck();
877 877
878 // Ideally we'd do this from the render tree (matching 878 // Ideally we'd do this from the render tree (matching
879 // RenderTextView), but it's not possible to do it at the moment 879 // RenderTextView), but it's not possible to do it at the moment
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 { 971 {
972 return m_suggestedValue; 972 return m_suggestedValue;
973 } 973 }
974 974
975 void HTMLInputElement::setSuggestedValue(const String& value) 975 void HTMLInputElement::setSuggestedValue(const String& value)
976 { 976 {
977 if (!m_inputType->canSetSuggestedValue()) 977 if (!m_inputType->canSetSuggestedValue())
978 return; 978 return;
979 setFormControlValueMatchesRenderer(false); 979 setFormControlValueMatchesRenderer(false);
980 m_suggestedValue = sanitizeValue(value); 980 m_suggestedValue = sanitizeValue(value);
981 setNeedsStyleRecalc(); 981 setNeedsStyleRecalc(SubtreeStyleChange);
982 m_inputTypeView->updateView(); 982 m_inputTypeView->updateView();
983 } 983 }
984 984
985 void HTMLInputElement::setEditingValue(const String& value) 985 void HTMLInputElement::setEditingValue(const String& value)
986 { 986 {
987 if (!renderer() || !isTextField()) 987 if (!renderer() || !isTextField())
988 return; 988 return;
989 setInnerTextValue(value); 989 setInnerTextValue(value);
990 subtreeHasChanged(); 990 subtreeHasChanged();
991 991
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 { 1658 {
1659 int maxLength; 1659 int maxLength;
1660 if (!parseHTMLInteger(value, maxLength)) 1660 if (!parseHTMLInteger(value, maxLength))
1661 maxLength = maximumLength; 1661 maxLength = maximumLength;
1662 if (maxLength < 0 || maxLength > maximumLength) 1662 if (maxLength < 0 || maxLength > maximumLength)
1663 maxLength = maximumLength; 1663 maxLength = maximumLength;
1664 int oldMaxLength = m_maxLength; 1664 int oldMaxLength = m_maxLength;
1665 m_maxLength = maxLength; 1665 m_maxLength = maxLength;
1666 if (oldMaxLength != maxLength) 1666 if (oldMaxLength != maxLength)
1667 updateValueIfNeeded(); 1667 updateValueIfNeeded();
1668 setNeedsStyleRecalc(); 1668 setNeedsStyleRecalc(SubtreeStyleChange);
1669 setNeedsValidityCheck(); 1669 setNeedsValidityCheck();
1670 } 1670 }
1671 1671
1672 void HTMLInputElement::updateValueIfNeeded() 1672 void HTMLInputElement::updateValueIfNeeded()
1673 { 1673 {
1674 String newValue = sanitizeValue(m_valueIfDirty); 1674 String newValue = sanitizeValue(m_valueIfDirty);
1675 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); 1675 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull());
1676 if (newValue != m_valueIfDirty) 1676 if (newValue != m_valueIfDirty)
1677 setValue(newValue); 1677 setValue(newValue);
1678 } 1678 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 } 1872 }
1873 1873
1874 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1874 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1875 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1875 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1876 { 1876 {
1877 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1877 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1878 } 1878 }
1879 #endif 1879 #endif
1880 1880
1881 } // namespace 1881 } // 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