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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
9 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 m_needsToUpdateViewValue = true; 480 m_needsToUpdateViewValue = true;
481 m_inputTypeView->updateView(); 481 m_inputTypeView->updateView();
482 482
483 if (didRespectHeightAndWidth != 483 if (didRespectHeightAndWidth !=
484 m_inputType->shouldRespectHeightAndWidthAttributes()) { 484 m_inputType->shouldRespectHeightAndWidthAttributes()) {
485 DCHECK(elementData()); 485 DCHECK(elementData());
486 AttributeCollection attributes = attributesWithoutUpdate(); 486 AttributeCollection attributes = attributesWithoutUpdate();
487 if (const Attribute* height = attributes.find(heightAttr)) { 487 if (const Attribute* height = attributes.find(heightAttr)) {
488 TextControlElement::attributeChanged( 488 TextControlElement::attributeChanged(AttributeModificationParams(
489 heightAttr, height->value(), height->value(), 489 heightAttr, height->value(), height->value(),
490 AttributeModificationReason::kDirectly); 490 AttributeModificationReason::kDirectly));
491 } 491 }
492 if (const Attribute* width = attributes.find(widthAttr)) { 492 if (const Attribute* width = attributes.find(widthAttr)) {
493 TextControlElement::attributeChanged( 493 TextControlElement::attributeChanged(
494 widthAttr, width->value(), width->value(), 494 AttributeModificationParams(widthAttr, width->value(), width->value(),
495 AttributeModificationReason::kDirectly); 495 AttributeModificationReason::kDirectly));
496 } 496 }
497 if (const Attribute* align = attributes.find(alignAttr)) { 497 if (const Attribute* align = attributes.find(alignAttr)) {
498 TextControlElement::attributeChanged( 498 TextControlElement::attributeChanged(
499 alignAttr, align->value(), align->value(), 499 AttributeModificationParams(alignAttr, align->value(), align->value(),
500 AttributeModificationReason::kDirectly); 500 AttributeModificationReason::kDirectly));
501 } 501 }
502 } 502 }
503 503
504 if (document().focusedElement() == this) 504 if (document().focusedElement() == this)
505 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); 505 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore);
506 506
507 setTextAsOfLastFormControlChangeEvent(value()); 507 setTextAsOfLastFormControlChangeEvent(value());
508 setChangedSinceLastFormControlChangeEvent(false); 508 setChangedSinceLastFormControlChangeEvent(false);
509 509
510 addToRadioButtonGroup(); 510 addToRadioButtonGroup();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 addHTMLLengthToStyle(style, CSSPropertyHeight, value); 690 addHTMLLengthToStyle(style, CSSPropertyHeight, value);
691 } else if (name == borderAttr && 691 } else if (name == borderAttr &&
692 type() == InputTypeNames::image) { // FIXME: Remove type check. 692 type() == InputTypeNames::image) { // FIXME: Remove type check.
693 applyBorderAttributeToStyle(value, style); 693 applyBorderAttributeToStyle(value, style);
694 } else { 694 } else {
695 TextControlElement::collectStyleForPresentationAttribute(name, value, 695 TextControlElement::collectStyleForPresentationAttribute(name, value,
696 style); 696 style);
697 } 697 }
698 } 698 }
699 699
700 void HTMLInputElement::parseAttribute(const QualifiedName& name, 700 void HTMLInputElement::parseAttribute(
701 const AtomicString& oldValue, 701 const AttributeModificationParams& params) {
702 const AtomicString& value) {
703 DCHECK(m_inputType); 702 DCHECK(m_inputType);
704 DCHECK(m_inputTypeView); 703 DCHECK(m_inputTypeView);
704 const QualifiedName& name = params.name;
705 const AtomicString& value = params.newValue;
705 706
706 if (name == nameAttr) { 707 if (name == nameAttr) {
707 removeFromRadioButtonGroup(); 708 removeFromRadioButtonGroup();
708 m_name = value; 709 m_name = value;
709 addToRadioButtonGroup(); 710 addToRadioButtonGroup();
710 TextControlElement::parseAttribute(name, oldValue, value); 711 TextControlElement::parseAttribute(params);
711 } else if (name == autocompleteAttr) { 712 } else if (name == autocompleteAttr) {
712 if (equalIgnoringCase(value, "off")) { 713 if (equalIgnoringCase(value, "off")) {
713 m_autocomplete = Off; 714 m_autocomplete = Off;
714 } else { 715 } else {
715 if (value.isEmpty()) 716 if (value.isEmpty())
716 m_autocomplete = Uninitialized; 717 m_autocomplete = Uninitialized;
717 else 718 else
718 m_autocomplete = On; 719 m_autocomplete = On;
719 } 720 }
720 } else if (name == typeAttr) { 721 } else if (name == typeAttr) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 m_inputTypeView->multipleAttributeChanged(); 792 m_inputTypeView->multipleAttributeChanged();
792 setNeedsValidityCheck(); 793 setNeedsValidityCheck();
793 } else if (name == stepAttr) { 794 } else if (name == stepAttr) {
794 m_inputTypeView->stepAttributeChanged(); 795 m_inputTypeView->stepAttributeChanged();
795 setNeedsValidityCheck(); 796 setNeedsValidityCheck();
796 UseCounter::count(document(), UseCounter::StepAttribute); 797 UseCounter::count(document(), UseCounter::StepAttribute);
797 } else if (name == patternAttr) { 798 } else if (name == patternAttr) {
798 setNeedsValidityCheck(); 799 setNeedsValidityCheck();
799 UseCounter::count(document(), UseCounter::PatternAttribute); 800 UseCounter::count(document(), UseCounter::PatternAttribute);
800 } else if (name == readonlyAttr) { 801 } else if (name == readonlyAttr) {
801 TextControlElement::parseAttribute(name, oldValue, value); 802 TextControlElement::parseAttribute(params);
802 m_inputTypeView->readonlyAttributeChanged(); 803 m_inputTypeView->readonlyAttributeChanged();
803 } else if (name == listAttr) { 804 } else if (name == listAttr) {
804 m_hasNonEmptyList = !value.isEmpty(); 805 m_hasNonEmptyList = !value.isEmpty();
805 if (m_hasNonEmptyList) { 806 if (m_hasNonEmptyList) {
806 resetListAttributeTargetObserver(); 807 resetListAttributeTargetObserver();
807 listAttributeTargetChanged(); 808 listAttributeTargetChanged();
808 } 809 }
809 UseCounter::count(document(), UseCounter::ListAttribute); 810 UseCounter::count(document(), UseCounter::ListAttribute);
810 } else if (name == webkitdirectoryAttr) { 811 } else if (name == webkitdirectoryAttr) {
811 TextControlElement::parseAttribute(name, oldValue, value); 812 TextControlElement::parseAttribute(params);
812 UseCounter::count(document(), UseCounter::PrefixedDirectoryAttribute); 813 UseCounter::count(document(), UseCounter::PrefixedDirectoryAttribute);
813 } else { 814 } else {
814 if (name == formactionAttr) 815 if (name == formactionAttr)
815 logUpdateAttributeIfIsolatedWorldAndInDocument("input", formactionAttr, 816 logUpdateAttributeIfIsolatedWorldAndInDocument("input", params);
816 oldValue, value); 817 TextControlElement::parseAttribute(params);
817 TextControlElement::parseAttribute(name, oldValue, value);
818 } 818 }
819 m_inputTypeView->attributeChanged(); 819 m_inputTypeView->attributeChanged();
820 } 820 }
821 821
822 void HTMLInputElement::parserDidSetAttributes() { 822 void HTMLInputElement::parserDidSetAttributes() {
823 DCHECK(m_parsingInProgress); 823 DCHECK(m_parsingInProgress);
824 initializeTypeInParsing(); 824 initializeTypeInParsing();
825 } 825 }
826 826
827 void HTMLInputElement::finishParsingChildren() { 827 void HTMLInputElement::finishParsingChildren() {
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 1888
1889 bool HTMLInputElement::hasFallbackContent() const { 1889 bool HTMLInputElement::hasFallbackContent() const {
1890 return m_inputTypeView->hasFallbackContent(); 1890 return m_inputTypeView->hasFallbackContent();
1891 } 1891 }
1892 1892
1893 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) { 1893 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) {
1894 return m_inputType->setFilesFromPaths(paths); 1894 return m_inputType->setFilesFromPaths(paths);
1895 } 1895 }
1896 1896
1897 } // namespace blink 1897 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.h ('k') | third_party/WebKit/Source/core/html/HTMLLIElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698