Title: [104747] trunk
Revision
104747
Author
[email protected]
Date
2012-01-11 14:35:52 -0800 (Wed, 11 Jan 2012)

Log Message

Rename HTMLInputElement::setDefaultName to setInitialName.
https://bugs.webkit.org/show_bug.cgi?id=76039

Reviewed by Darin Adler.

Source/WebCore:

Rename setDefaultName to setInitialName, make it protected, and add two
assertions.

This change should not change any behavior.

Test: fast/forms/isindex-name.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setInitialName):
- Renamed from setDefaultName.
- Add assertions.
* html/HTMLInputElement.h:
Rename setDefaultName to setInitialName, and move it to protected.
* html/HTMLIsIndexElement.cpp:
(WebCore::HTMLIsIndexElement::HTMLIsIndexElement):
Update a setDefaultName callsite.
(WebCore::HTMLIsIndexElement::parseMappedAttribute):
A style fix.

LayoutTests:

* fast/forms/isindex-name-expected.txt: Added.
* fast/forms/isindex-name.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104746 => 104747)


--- trunk/LayoutTests/ChangeLog	2012-01-11 22:13:24 UTC (rev 104746)
+++ trunk/LayoutTests/ChangeLog	2012-01-11 22:35:52 UTC (rev 104747)
@@ -1,3 +1,13 @@
+2012-01-11  Kent Tamura  <[email protected]>
+
+        Rename HTMLInputElement::setDefaultName to setInitialName.
+        https://bugs.webkit.org/show_bug.cgi?id=76039
+
+        Reviewed by Darin Adler.
+
+        * fast/forms/isindex-name-expected.txt: Added.
+        * fast/forms/isindex-name.html: Added.
+
 2012-01-11  Raymond Toy  <[email protected]>
 
         Webaudio layout tests need to override the WebKitWebAudioEnabled

Added: trunk/LayoutTests/fast/forms/isindex-name-expected.txt (0 => 104747)


--- trunk/LayoutTests/fast/forms/isindex-name-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/isindex-name-expected.txt	2012-01-11 22:35:52 UTC (rev 104747)
@@ -0,0 +1,11 @@
+Initial name:
+PASS isindex.name is "isindex"
+Adding a name attribute:
+PASS isindex.setAttribute("name", "foo"); isindex.name is "foo"
+Removing the name attribute:
+PASS isindex.removeAttribute("name"); isindex.name is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This is a searchable index. Enter search keywords: 
+

Added: trunk/LayoutTests/fast/forms/isindex-name.html (0 => 104747)


--- trunk/LayoutTests/fast/forms/isindex-name.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/isindex-name.html	2012-01-11 22:35:52 UTC (rev 104747)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<isindex id=isindex1>
+<script>
+var isindex = document.getElementById('isindex1');
+debug('Initial name:');
+shouldBeEqualToString('isindex.name', 'isindex');
+
+debug('Adding a name attribute:');
+shouldBeEqualToString('isindex.setAttribute("name", "foo"); isindex.name', 'foo');
+
+debug('Removing the name attribute:');
+// This behavior is compatible with IE, Firefox, and Opera.
+shouldBeEqualToString('isindex.removeAttribute("name"); isindex.name', '');
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (104746 => 104747)


--- trunk/Source/WebCore/ChangeLog	2012-01-11 22:13:24 UTC (rev 104746)
+++ trunk/Source/WebCore/ChangeLog	2012-01-11 22:35:52 UTC (rev 104747)
@@ -1,3 +1,29 @@
+2012-01-11  Kent Tamura  <[email protected]>
+
+        Rename HTMLInputElement::setDefaultName to setInitialName.
+        https://bugs.webkit.org/show_bug.cgi?id=76039
+
+        Reviewed by Darin Adler.
+
+        Rename setDefaultName to setInitialName, make it protected, and add two
+        assertions.
+
+        This change should not change any behavior.
+
+        Test: fast/forms/isindex-name.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setInitialName):
+        - Renamed from setDefaultName.
+        - Add assertions.
+        * html/HTMLInputElement.h:
+        Rename setDefaultName to setInitialName, and move it to protected.
+        * html/HTMLIsIndexElement.cpp:
+        (WebCore::HTMLIsIndexElement::HTMLIsIndexElement):
+        Update a setDefaultName callsite.
+        (WebCore::HTMLIsIndexElement::parseMappedAttribute):
+        A style fix.
+
 2012-01-11  Adam Treat  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=76088

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (104746 => 104747)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-01-11 22:13:24 UTC (rev 104746)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-01-11 22:35:52 UTC (rev 104747)
@@ -1300,8 +1300,10 @@
     setAttribute(valueAttr, value);
 }
 
-void HTMLInputElement::setDefaultName(const AtomicString& name)
+void HTMLInputElement::setInitialName(const AtomicString& name)
 {
+    ASSERT(hasTagName(isindexTag));
+    ASSERT(m_name.isNull());
     m_name = name;
 }
 

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (104746 => 104747)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2012-01-11 22:13:24 UTC (rev 104746)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2012-01-11 22:35:52 UTC (rev 104747)
@@ -188,8 +188,6 @@
     String defaultValue() const;
     void setDefaultValue(const String&);
 
-    void setDefaultName(const AtomicString&);
-
     Vector<String> acceptMIMETypes();
     String accept() const;
     String alt() const;
@@ -243,6 +241,7 @@
 protected:
     HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
     void createShadowSubtree();
+    void setInitialName(const AtomicString&);
     virtual void defaultEventHandler(Event*);
 
 private:

Modified: trunk/Source/WebCore/html/HTMLIsIndexElement.cpp (104746 => 104747)


--- trunk/Source/WebCore/html/HTMLIsIndexElement.cpp	2012-01-11 22:13:24 UTC (rev 104746)
+++ trunk/Source/WebCore/html/HTMLIsIndexElement.cpp	2012-01-11 22:35:52 UTC (rev 104747)
@@ -36,7 +36,7 @@
     : HTMLInputElement(tagName, document, form, false)
 {
     ASSERT(hasTagName(isindexTag));
-    setDefaultName(isindexTag.localName());
+    setInitialName(isindexTag.localName());
 }
 
 PassRefPtr<HTMLIsIndexElement> HTMLIsIndexElement::create(Document* document, HTMLFormElement* form)
@@ -59,10 +59,11 @@
         setValue(attr->value());
     else if (attr->name() == placeholderAttr)
         updatePlaceholderVisibility(true);
-    else
+    else {
         // don't call HTMLInputElement::parseMappedAttribute here, as it would
         // accept attributes this element does not support
         HTMLFormControlElement::parseMappedAttribute(attr);
+    }
 }
 
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to