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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLButtonElement.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, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights 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 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const QualifiedName& name) const { 78 const QualifiedName& name) const {
79 if (name == alignAttr) { 79 if (name == alignAttr) {
80 // Don't map 'align' attribute. This matches what Firefox and IE do, but 80 // Don't map 'align' attribute. This matches what Firefox and IE do, but
81 // not Opera. See http://bugs.webkit.org/show_bug.cgi?id=12071 81 // not Opera. See http://bugs.webkit.org/show_bug.cgi?id=12071
82 return false; 82 return false;
83 } 83 }
84 84
85 return HTMLFormControlElement::isPresentationAttribute(name); 85 return HTMLFormControlElement::isPresentationAttribute(name);
86 } 86 }
87 87
88 void HTMLButtonElement::parseAttribute(const QualifiedName& name, 88 void HTMLButtonElement::parseAttribute(
89 const AtomicString& oldValue, 89 const AttributeModificationParams& params) {
90 const AtomicString& value) { 90 if (params.name == typeAttr) {
91 if (name == typeAttr) { 91 if (equalIgnoringCase(params.newValue, "reset"))
92 if (equalIgnoringCase(value, "reset"))
93 m_type = RESET; 92 m_type = RESET;
94 else if (equalIgnoringCase(value, "button")) 93 else if (equalIgnoringCase(params.newValue, "button"))
95 m_type = BUTTON; 94 m_type = BUTTON;
96 else 95 else
97 m_type = SUBMIT; 96 m_type = SUBMIT;
98 setNeedsWillValidateCheck(); 97 setNeedsWillValidateCheck();
99 if (formOwner() && isConnected()) 98 if (formOwner() && isConnected())
100 formOwner()->invalidateDefaultButtonStyle(); 99 formOwner()->invalidateDefaultButtonStyle();
101 } else { 100 } else {
102 if (name == formactionAttr) 101 if (params.name == formactionAttr)
103 logUpdateAttributeIfIsolatedWorldAndInDocument("button", formactionAttr, 102 logUpdateAttributeIfIsolatedWorldAndInDocument("button", params);
104 oldValue, value); 103 HTMLFormControlElement::parseAttribute(params);
105 HTMLFormControlElement::parseAttribute(name, oldValue, value);
106 } 104 }
107 } 105 }
108 106
109 void HTMLButtonElement::defaultEventHandler(Event* event) { 107 void HTMLButtonElement::defaultEventHandler(Event* event) {
110 if (event->type() == EventTypeNames::DOMActivate && 108 if (event->type() == EventTypeNames::DOMActivate &&
111 !isDisabledFormControl()) { 109 !isDisabledFormControl()) {
112 if (form() && m_type == SUBMIT) { 110 if (form() && m_type == SUBMIT) {
113 form()->prepareForSubmission(event, this); 111 form()->prepareForSubmission(event, this);
114 event->setDefaultHandled(); 112 event->setDefaultHandled();
115 } 113 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 Node::InsertionNotificationRequest HTMLButtonElement::insertedInto( 210 Node::InsertionNotificationRequest HTMLButtonElement::insertedInto(
213 ContainerNode* insertionPoint) { 211 ContainerNode* insertionPoint) {
214 InsertionNotificationRequest request = 212 InsertionNotificationRequest request =
215 HTMLFormControlElement::insertedInto(insertionPoint); 213 HTMLFormControlElement::insertedInto(insertionPoint);
216 logAddElementIfIsolatedWorldAndInDocument("button", typeAttr, formmethodAttr, 214 logAddElementIfIsolatedWorldAndInDocument("button", typeAttr, formmethodAttr,
217 formactionAttr); 215 formactionAttr);
218 return request; 216 return request;
219 } 217 }
220 218
221 } // namespace blink 219 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLButtonElement.h ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698