Commit 995765c6 authored by tkent@chromium.org's avatar tkent@chromium.org

2010-12-07 Kenichi Ishibashi <bashi@google.com>

        Reviewed by Kent Tamura.

        Let HTMLObjectElement be a form associated element
        https://bugs.webkit.org/show_bug.cgi?id=48821

        Introduces FormAssociatedElement class which would be a super class
        of form assocated elements. Some of member functions and variables of
        HTMLFormControlElement are migrated into this class.
        Following the HTML5 spec, HTMLFormControlElement class and
        HTMLObjectElement class are subclasses of it for now.

        Test: fast/forms/form-collection-elements-order.html

        * Android.mk: Added FormAssociatedElement.cpp
        * CMakeLists.txt: Ditto.
        * GNUmakefile.am: Added FormAssociatedElement.{cpp,h}
        * WebCore.exp.in: Added the symbol for toHTMLElement(FormAssociatedElement*)
        * WebCore.gypi: Added FormAssociatedElement.{cpp,h}
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * dom/CheckedRadioButtons.h: Fixed class forward declaration order.
        * dom/Document.cpp:
        (WebCore::Document::registerFormElementWithFormAttribute): Modified to
        use FormAssociatedElement instead of HTMLFormControlElement
        (WebCore::Document::unregisterFormElementWithFormAttribute): Ditto.
        (WebCore::Document::resetFormElementsOwner):
        * dom/Document.h: Ditto.
        * html/DOMFormData.cpp: Ditto.
        (WebCore::DOMFormData::DOMFormData):
        * html/FormAssociatedElement.cpp: Copied and renamed from WebCore/html/HTMLFormControlElement.cpp.
        (WebCore::FormAssociatedElement::FormAssociatedElement):
        (WebCore::FormAssociatedElement::~FormAssociatedElement):
        (WebCore::FormAssociatedElement::validity):
        (WebCore::FormAssociatedElement::insertedIntoTree):
        (WebCore::FormAssociatedElement::removedFromTree):
        (WebCore::FormAssociatedElement::removeFromForm):
        (WebCore::FormAssociatedElement::resetFormOwner):
        (WebCore::FormAssociatedElement::formAttributeChanged):
        (WebCore::toHTMLElement):
        * html/FormAssociatedElement.h: Ditto.
        (WebCore::FormAssociatedElement::ref):
        (WebCore::FormAssociatedElement::deref):
        (WebCore::FormAssociatedElement::formDestroyed):
        (WebCore::FormAssociatedElement::setForm):
        * html/HTMLElement.h: Changed the access level of findFormAncestor().
        * html/HTMLFormCollection.cpp:
        (WebCore::HTMLFormCollection::item): Modified to use FormAssociatedElement
        instead of HTMLFormControlElement.
        (WebCore::HTMLFormCollection::getNamedFormItem): Ditto.
        (WebCore::HTMLFormCollection::updateNameCache): Ditto.
        * html/HTMLFormControlElement.cpp: Modified regarding with the change of class
        hierarchy.
        (WebCore::HTMLFormControlElement::HTMLFormControlElement):
        (WebCore::HTMLFormControlElement::~HTMLFormControlElement):
        (WebCore::HTMLFormControlElement::insertedIntoTree):
        (WebCore::HTMLFormControlElement::removedFromTree):
        (WebCore::HTMLFormControlElement::supportsFocus):
        (WebCore::HTMLFormControlElement::checkValidity):
        (WebCore::HTMLFormControlElement::virtualForm):
        (WebCore::HTMLFormControlElement::isDefaultButtonForForm):
        (WebCore::HTMLFormControlElement::attributeChanged):
        * html/HTMLFormControlElement.h: Ditto.
        (WebCore::HTMLFormControlElement::form):
        (WebCore::HTMLFormControlElement::disabled):
        (WebCore::HTMLFormControlElement::type):
        (WebCore::HTMLFormControlElement::refFormAssociatedElement):
        (WebCore::HTMLFormControlElement::derefFormAssociatedElement):
        * html/HTMLFormElement.cpp: Modified to use FormAssociatedElement
        instead of HTMLFormControlElement.
        (WebCore::HTMLFormElement::submitImplicitly):
        (WebCore::HTMLFormElement::validateInteractively):
        (WebCore::HTMLFormElement::submit):
        (WebCore::HTMLFormElement::reset):
        (WebCore::HTMLFormElement::formElementIndexWithFormAttribute):
        (WebCore::HTMLFormElement::formElementIndex):
        (WebCore::HTMLFormElement::registerFormElement):
        (WebCore::HTMLFormElement::removeFormElement):
        (WebCore::HTMLFormElement::defaultButton):
        (WebCore::HTMLFormElement::checkValidity):
        (WebCore::HTMLFormElement::collectUnhandledInvalidControls):
        (WebCore::HTMLFormElement::documentDidBecomeActive):
        * html/HTMLFormElement.h: Ditto.
        (WebCore::HTMLFormElement::associatedElements):
        * html/HTMLInputElement.cpp: Ditto.
        (WebCore::HTMLInputElement::updateCheckedRadioButtons):
        * html/HTMLObjectElement.cpp: Modified regarding with the change of class
        hierarchy.
        (WebCore::HTMLObjectElement::HTMLObjectElement):
        (WebCore::HTMLObjectElement::~HTMLObjectElement):
        (WebCore::HTMLObjectElement::create):
        (WebCore::HTMLObjectElement::attributeChanged):
        (WebCore::HTMLObjectElement::insertedIntoTree):
        (WebCore::HTMLObjectElement::removedFromTree):
        (WebCore::HTMLObjectElement::appendFormData):
        (WebCore::HTMLObjectElement::formControlName):
        * html/HTMLObjectElement.h: Ditto.
        (WebCore::HTMLObjectElement::form):
        (WebCore::HTMLObjectElement::isFormControlElement):
        (WebCore::HTMLObjectElement::isEnumeratable):
        (WebCore::HTMLObjectElement::refFormAssociatedElement):
        (WebCore::HTMLObjectElement::derefFormAssociatedElement):
        * html/HTMLTagNames.in: Added constructorNeedsFormElement to object tag.
        * html/ValidationMessage.cpp: Modified to use FormAssociatedElement
        instead of HTMLFormControlElement.
        (WebCore::ValidationMessage::ValidationMessage):
        (WebCore::ValidationMessage::create):
        * html/ValidationMessage.h: Ditto.
        * html/ValidityState.cpp: Ditto.
        (WebCore::ValidityState::validationMessage):
        (WebCore::ValidityState::setCustomErrorMessage):
        (WebCore::ValidityState::valueMissing):
        (WebCore::ValidityState::typeMismatch):
        (WebCore::ValidityState::patternMismatch):
        (WebCore::ValidityState::tooLong):
        (WebCore::ValidityState::rangeUnderflow):
        (WebCore::ValidityState::rangeOverflow):
        (WebCore::ValidityState::stepMismatch):
        * html/ValidityState.h: Ditto.
        (WebCore::ValidityState::create):
        (WebCore::ValidityState::ValidityState):
        * loader/FormSubmission.cpp: Ditto.
        (WebCore::FormSubmission::create):

2010-12-07  Kenichi Ishibashi  <bashi@google.com>

        Reviewed by Kent Tamura.

        Let HTMLObjectElement be a form associated element
        https://bugs.webkit.org/show_bug.cgi?id=48821

        Modified to use FormAssociatedElement instead of HTMLFormControlElement.

        * src/WebFormElement.cpp: 
        (WebKit::WebFormElement::getFormControlElements): Modified to use
        FormAssociatedElement instead of HTMLFormControlElement.
        * src/WebPasswordFormUtils.cpp:
        (WebKit::findPasswordFormFields): Ditto.
        * src/WebSearchableFormData.cpp:
        (WebCore::GetButtonToActivate): Ditto.
        (WebCore::HasSuitableTextElement): Ditto.

2010-12-07  Kenichi Ishibashi  <bashi@google.com>

        Reviewed by Kent Tamura.

        Let HTMLObjectElement be a form associated element
        https://bugs.webkit.org/show_bug.cgi?id=48821

        Modified to use FormAssociatedElement instead of HTMLFormControlElement.

        * WebFrame.cpp:
        (WebFrame::elementWithName): Modified to use FormAssociatedElement
        instead of HTMLFormControlElement.
        (WebFrame::controlsInForm): Ditto.

2010-12-07  Kenichi Ishibashi  <bashi@google.com>

        Reviewed by Kent Tamura.

        Let HTMLObjectElement be a form associated element
        https://bugs.webkit.org/show_bug.cgi?id=48821

        Modified to use FormAssociatedElement instead of HTMLFormControlElement.

        * WebView/WebHTMLRepresentation.mm:
        (-[WebHTMLRepresentation elementWithName:inForm:]): Modified to use
        FormAssociatedElement instead of HTMLFormControlElement.
        (-[WebHTMLRepresentation controlsInForm:]): Ditto.

2010-12-07  Kenichi Ishibashi  <bashi@google.com>

        Reviewed by Kent Tamura.

        Let HTMLObjectElement be a form associated element
        https://bugs.webkit.org/show_bug.cgi?id=48821

        Adds a test to ensure the order of form.elements attribute.
        Updates two tests to check whether object elements are handled
        correctly in form.elements attribute.

        * fast/forms/form-attribute-expected.txt: Updated.
        * fast/forms/form-collection-elements-order-expected.txt: Added.
        * fast/forms/form-collection-elements-order.html: Added.
        * fast/forms/script-tests/form-attribute.js: Updated.
        * fast/forms/script-tests/form-collection-elements-order.js: Added.
        (checkOrder):
        * fast/forms/script-tests/form-collection-elements.js: Updated.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73430 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 19874e0a
2010-12-07 Kenichi Ishibashi <bashi@google.com>
Reviewed by Kent Tamura.
Let HTMLObjectElement be a form associated element
https://bugs.webkit.org/show_bug.cgi?id=48821
Adds a test to ensure the order of form.elements attribute.
Updates two tests to check whether object elements are handled
correctly in form.elements attribute.
* fast/forms/form-attribute-expected.txt: Updated.
* fast/forms/form-collection-elements-order-expected.txt: Added.
* fast/forms/form-collection-elements-order.html: Added.
* fast/forms/script-tests/form-attribute.js: Updated.
* fast/forms/script-tests/form-collection-elements-order.js: Added.
(checkOrder):
* fast/forms/script-tests/form-collection-elements.js: Updated.
2010-12-06 Yuta Kitamura <yutak@chromium.org>
Unreviewed.
......
......@@ -4,14 +4,14 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
- Checks the existence of the form attribute for each form-associated elements.
FIXME: <label> and <object> don't support the form attribute for now.
FIXME: <label> doesn't support the form attribute for now.
PASS document.getElementsByTagName("button")[0].form is owner
PASS document.getElementsByTagName("fieldset")[0].form is owner
PASS document.getElementsByTagName("input")[0].form is owner
PASS document.getElementsByTagName("keygen")[0].form is owner
FAIL document.getElementsByTagName("label")[0].form should be [object HTMLFormElement]. Was null.
PASS document.getElementsByTagName("meter")[0].form is owner
FAIL document.getElementsByTagName("object")[0].form should be [object HTMLFormElement]. Was null.
PASS document.getElementsByTagName("object")[0].form is owner
PASS document.getElementsByTagName("output")[0].form is owner
PASS document.getElementsByTagName("progress")[0].form is owner
PASS document.getElementsByTagName("select")[0].form is owner
......
......@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
This test does not add object element as a listed element. Separate test will cover that.
PASS owner.elements.length is 22
PASS owner.elements.length is 23
PASS owner.elements[0].id is 'button1'
PASS owner.elements[1].id is 'fieldset1'
PASS owner.elements[2].id is 'inputhidden'
......@@ -24,9 +24,10 @@ PASS owner.elements[15].id is 'inputsubmit'
PASS owner.elements[16].id is 'inputreset'
PASS owner.elements[17].id is 'inputbutton'
PASS owner.elements[18].id is 'keygen1'
PASS owner.elements[19].id is 'output1'
PASS owner.elements[20].id is 'select1'
PASS owner.elements[21].id is 'textarea1'
PASS owner.elements[19].id is 'object1'
PASS owner.elements[20].id is 'output1'
PASS owner.elements[21].id is 'select1'
PASS owner.elements[22].id is 'textarea1'
PASS successfullyParsed is true
TEST COMPLETE
......
This test examines the order of form associated elements which are classified as 'listed'.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
- Checks the order of form associated elements.
PASS checkOrder([button, fieldset, input, keygen, object, output, select, textarea]) is "OK"
- Checks the order after some elements removed/inserted.
PASS checkOrder([button, fieldset, input, keygen, output, select, textarea]) is "OK"
PASS checkOrder([fieldset, input, keygen, output, select, textarea]) is "OK"
PASS checkOrder([object, fieldset, input, keygen, output, select, textarea]) is "OK"
PASS checkOrder([object, fieldset, input, keygen, output, select, textarea, button]) is "OK"
- Checks the order of form associated elements with form attribute.
PASS checkOrder([button, fieldset, input, keygen, object, output, select, textarea]) is "OK"
- Checks the order after some elements removed/inserted with form attribute.
PASS checkOrder([button, fieldset, input, keygen, output, select, textarea]) is "OK"
PASS checkOrder([fieldset, input, keygen, output, select, textarea]) is "OK"
PASS checkOrder([fieldset, input, keygen, output, select]) is "OK"
PASS checkOrder([fieldset, input, keygen, object, output, select]) is "OK"
PASS checkOrder([textarea, fieldset, input, keygen, object, output, select]) is "OK"
PASS checkOrder([textarea, fieldset, input, keygen, object, output, select, button]) is "OK"
PASS successfullyParsed is true
TEST COMPLETE
Test
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/form-collection-elements-order.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -4,7 +4,7 @@ var container = document.createElement('div');
document.body.appendChild(container);
debug('- Checks the existence of the form attribute for each form-associated elements.');
debug('FIXME: &lt;label&gt; and &lt;object&gt; don\'t support the form attribute for now.');
debug('FIXME: &lt;label&gt; doesn\'t support the form attribute for now.');
container.innerHTML = '<form id=owner></form>' +
'<button name=victim form=owner />' +
'<fieldset name=victim form=owner />' +
......
description("This test examines the order of form associated elements which are classified as 'listed'.");
var container = document.createElement('div');
document.body.appendChild(container);
var owner;
function checkOrder(victims) {
if (owner.elements.length != victims.length)
return 'length mismatch, elements.length = ' + owner.elements.length +
', expected length = ' + victims.length;
for (var i = 0; i < victims.length; ++i)
if (owner.elements[i] != victims[i])
return 'element mismatch at index ' + i;
return 'OK';
}
debug('- Checks the order of form associated elements.');
container.innerHTML = '<form id=owner>' +
'<button name=victim></button>' +
'<fieldset name=victim>Test</fieldset>' +
'<input name=victim/>' +
'<keygen name=victim></keygen>' +
'<label name=victim></label>' +
'<meter name=victim></meter>' +
'<object name=victim></object>' +
'<output name=victim></output>' +
'<progress name=victim></progress>' +
'<select name=victim></select>' +
'<textarea name=victim></textarea>'+
'</form>';
owner = document.getElementById('owner');
var button = document.getElementsByTagName('button')[0];
var fieldset = document.getElementsByTagName('fieldset')[0];
var input = document.getElementsByTagName('input')[0];
var keygen = document.getElementsByTagName('keygen')[0];
var label = document.getElementsByTagName('label')[0];
var meter = document.getElementsByTagName('meter')[0];
var object = document.getElementsByTagName('object')[0];
var output = document.getElementsByTagName('output')[0];
var progress = document.getElementsByTagName('progress')[0];
var select = document.getElementsByTagName('select')[0];
var textarea = document.getElementsByTagName('textarea')[0];
shouldBe('checkOrder([button, fieldset, input, keygen, object, output, select, textarea])', '"OK"');
debug('');
debug('- Checks the order after some elements removed/inserted.');
owner.removeChild(object);
shouldBe('checkOrder([button, fieldset, input, keygen, output, select, textarea])', '"OK"');
owner.removeChild(button);
shouldBe('checkOrder([fieldset, input, keygen, output, select, textarea])', '"OK"');
owner.insertBefore(object, fieldset);
shouldBe('checkOrder([object, fieldset, input, keygen, output, select, textarea])', '"OK"');
owner.appendChild(button);
shouldBe('checkOrder([object, fieldset, input, keygen, output, select, textarea, button])', '"OK"');
debug('');
debug('- Checks the order of form associated elements with form attribute.');
container.innerHTML = '<button name=victim form=owner></button>' +
'<fieldset name=victim form=owner>Test</fieldset>' +
'<input name=victim form=owner/>' +
'<keygen name=victim form=owner></keygen>' +
'<form id=owner>' +
'<label name=victim></label>' +
'<meter name=victim></meter>' +
'<object name=victim></object>' +
'</form>' +
'<output name=victim form=owner></output>' +
'<progress name=victim form=owner></progress>' +
'<select name=victim form=owner></select>' +
'<textarea name=victim form=owner></textarea>';
owner = document.getElementById('owner');
button = document.getElementsByTagName('button')[0];
fieldset = document.getElementsByTagName('fieldset')[0];
input = document.getElementsByTagName('input')[0];
keygen = document.getElementsByTagName('keygen')[0];
label = document.getElementsByTagName('label')[0];
meter = document.getElementsByTagName('meter')[0];
object = document.getElementsByTagName('object')[0];
output = document.getElementsByTagName('output')[0];
progress = document.getElementsByTagName('progress')[0];
select = document.getElementsByTagName('select')[0];
textarea = document.getElementsByTagName('textarea')[0];
shouldBe('checkOrder([button, fieldset, input, keygen, object, output, select, textarea])', '"OK"');
debug('');
debug('- Checks the order after some elements removed/inserted with form attribute.');
owner.removeChild(object);
shouldBe('checkOrder([button, fieldset, input, keygen, output, select, textarea])', '"OK"');
container.removeChild(button);
shouldBe('checkOrder([fieldset, input, keygen, output, select, textarea])', '"OK"');
container.removeChild(textarea);
shouldBe('checkOrder([fieldset, input, keygen, output, select])', '"OK"');
owner.appendChild(object);
shouldBe('checkOrder([fieldset, input, keygen, object, output, select])', '"OK"');
container.insertBefore(textarea, fieldset);
shouldBe('checkOrder([textarea, fieldset, input, keygen, object, output, select])', '"OK"');
container.appendChild(button);
shouldBe('checkOrder([textarea, fieldset, input, keygen, object, output, select, button])', '"OK"');
var successfullyParsed = true;
......@@ -27,6 +27,7 @@ container.innerHTML = '<form id="form1">' +
'<keygen id=keygen1></keygen>' +
'<label id=label1></label>' +
'<meter id=meter1></meter>' +
'<object id=object1></object>' +
'<output id=output1></output>' +
'<progress id=progress1></progress>' +
'<select id=select1>' +
......@@ -38,7 +39,7 @@ container.innerHTML = '<form id="form1">' +
var owner = document.getElementById('form1');
shouldBe('owner.elements.length', '22');
shouldBe('owner.elements.length', '23');
shouldBe('owner.elements[0].id', "'button1'");
shouldBe('owner.elements[1].id', "'fieldset1'");
shouldBe('owner.elements[2].id', "'inputhidden'");
......@@ -58,9 +59,10 @@ shouldBe('owner.elements[15].id', "'inputsubmit'");
shouldBe('owner.elements[16].id', "'inputreset'");
shouldBe('owner.elements[17].id', "'inputbutton'");
shouldBe('owner.elements[18].id', "'keygen1'");
shouldBe('owner.elements[19].id', "'output1'");
shouldBe('owner.elements[20].id', "'select1'");
shouldBe('owner.elements[21].id', "'textarea1'");
shouldBe('owner.elements[19].id', "'object1'");
shouldBe('owner.elements[20].id', "'output1'");
shouldBe('owner.elements[21].id', "'select1'");
shouldBe('owner.elements[22].id', "'textarea1'");
var successfullyParsed = true;
......@@ -277,6 +277,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
html/DateTimeLocalInputType.cpp \
html/EmailInputType.cpp \
html/FileInputType.cpp \
html/FormAssociatedElement.cpp \
html/FormDataList.cpp \
html/HTMLAllCollection.cpp \
html/HTMLCollection.cpp \
......
......@@ -991,6 +991,7 @@ SET(WebCore_SOURCES
html/EmailInputType.cpp
html/FTPDirectoryDocument.cpp
html/FileInputType.cpp
html/FormAssociatedElement.cpp
html/FormDataList.cpp
html/HTMLAllCollection.cpp
html/HTMLAnchorElement.cpp
......
2010-12-07 Kenichi Ishibashi <bashi@google.com>
Reviewed by Kent Tamura.
Let HTMLObjectElement be a form associated element
https://bugs.webkit.org/show_bug.cgi?id=48821
Introduces FormAssociatedElement class which would be a super class
of form assocated elements. Some of member functions and variables of
HTMLFormControlElement are migrated into this class.
Following the HTML5 spec, HTMLFormControlElement class and
HTMLObjectElement class are subclasses of it for now.
Test: fast/forms/form-collection-elements-order.html
* Android.mk: Added FormAssociatedElement.cpp
* CMakeLists.txt: Ditto.
* GNUmakefile.am: Added FormAssociatedElement.{cpp,h}
* WebCore.exp.in: Added the symbol for toHTMLElement(FormAssociatedElement*)
* WebCore.gypi: Added FormAssociatedElement.{cpp,h}
* WebCore.pro: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* dom/CheckedRadioButtons.h: Fixed class forward declaration order.
* dom/Document.cpp:
(WebCore::Document::registerFormElementWithFormAttribute): Modified to
use FormAssociatedElement instead of HTMLFormControlElement
(WebCore::Document::unregisterFormElementWithFormAttribute): Ditto.
(WebCore::Document::resetFormElementsOwner):
* dom/Document.h: Ditto.
* html/DOMFormData.cpp: Ditto.
(WebCore::DOMFormData::DOMFormData):
* html/FormAssociatedElement.cpp: Copied and renamed from WebCore/html/HTMLFormControlElement.cpp.
(WebCore::FormAssociatedElement::FormAssociatedElement):
(WebCore::FormAssociatedElement::~FormAssociatedElement):
(WebCore::FormAssociatedElement::validity):
(WebCore::FormAssociatedElement::insertedIntoTree):
(WebCore::FormAssociatedElement::removedFromTree):
(WebCore::FormAssociatedElement::removeFromForm):
(WebCore::FormAssociatedElement::resetFormOwner):
(WebCore::FormAssociatedElement::formAttributeChanged):
(WebCore::toHTMLElement):
* html/FormAssociatedElement.h: Ditto.
(WebCore::FormAssociatedElement::ref):
(WebCore::FormAssociatedElement::deref):
(WebCore::FormAssociatedElement::formDestroyed):
(WebCore::FormAssociatedElement::setForm):
* html/HTMLElement.h: Changed the access level of findFormAncestor().
* html/HTMLFormCollection.cpp:
(WebCore::HTMLFormCollection::item): Modified to use FormAssociatedElement
instead of HTMLFormControlElement.
(WebCore::HTMLFormCollection::getNamedFormItem): Ditto.
(WebCore::HTMLFormCollection::updateNameCache): Ditto.
* html/HTMLFormControlElement.cpp: Modified regarding with the change of class
hierarchy.
(WebCore::HTMLFormControlElement::HTMLFormControlElement):
(WebCore::HTMLFormControlElement::~HTMLFormControlElement):
(WebCore::HTMLFormControlElement::insertedIntoTree):
(WebCore::HTMLFormControlElement::removedFromTree):
(WebCore::HTMLFormControlElement::supportsFocus):
(WebCore::HTMLFormControlElement::checkValidity):
(WebCore::HTMLFormControlElement::virtualForm):
(WebCore::HTMLFormControlElement::isDefaultButtonForForm):
(WebCore::HTMLFormControlElement::attributeChanged):
* html/HTMLFormControlElement.h: Ditto.
(WebCore::HTMLFormControlElement::form):
(WebCore::HTMLFormControlElement::disabled):
(WebCore::HTMLFormControlElement::type):
(WebCore::HTMLFormControlElement::refFormAssociatedElement):
(WebCore::HTMLFormControlElement::derefFormAssociatedElement):
* html/HTMLFormElement.cpp: Modified to use FormAssociatedElement
instead of HTMLFormControlElement.
(WebCore::HTMLFormElement::submitImplicitly):
(WebCore::HTMLFormElement::validateInteractively):
(WebCore::HTMLFormElement::submit):
(WebCore::HTMLFormElement::reset):
(WebCore::HTMLFormElement::formElementIndexWithFormAttribute):
(WebCore::HTMLFormElement::formElementIndex):
(WebCore::HTMLFormElement::registerFormElement):
(WebCore::HTMLFormElement::removeFormElement):
(WebCore::HTMLFormElement::defaultButton):
(WebCore::HTMLFormElement::checkValidity):
(WebCore::HTMLFormElement::collectUnhandledInvalidControls):
(WebCore::HTMLFormElement::documentDidBecomeActive):
* html/HTMLFormElement.h: Ditto.
(WebCore::HTMLFormElement::associatedElements):
* html/HTMLInputElement.cpp: Ditto.
(WebCore::HTMLInputElement::updateCheckedRadioButtons):
* html/HTMLObjectElement.cpp: Modified regarding with the change of class
hierarchy.
(WebCore::HTMLObjectElement::HTMLObjectElement):
(WebCore::HTMLObjectElement::~HTMLObjectElement):
(WebCore::HTMLObjectElement::create):
(WebCore::HTMLObjectElement::attributeChanged):
(WebCore::HTMLObjectElement::insertedIntoTree):
(WebCore::HTMLObjectElement::removedFromTree):
(WebCore::HTMLObjectElement::appendFormData):
(WebCore::HTMLObjectElement::formControlName):
* html/HTMLObjectElement.h: Ditto.
(WebCore::HTMLObjectElement::form):
(WebCore::HTMLObjectElement::isFormControlElement):
(WebCore::HTMLObjectElement::isEnumeratable):
(WebCore::HTMLObjectElement::refFormAssociatedElement):
(WebCore::HTMLObjectElement::derefFormAssociatedElement):
* html/HTMLTagNames.in: Added constructorNeedsFormElement to object tag.
* html/ValidationMessage.cpp: Modified to use FormAssociatedElement
instead of HTMLFormControlElement.
(WebCore::ValidationMessage::ValidationMessage):
(WebCore::ValidationMessage::create):
* html/ValidationMessage.h: Ditto.
* html/ValidityState.cpp: Ditto.
(WebCore::ValidityState::validationMessage):
(WebCore::ValidityState::setCustomErrorMessage):
(WebCore::ValidityState::valueMissing):
(WebCore::ValidityState::typeMismatch):
(WebCore::ValidityState::patternMismatch):
(WebCore::ValidityState::tooLong):
(WebCore::ValidityState::rangeUnderflow):
(WebCore::ValidityState::rangeOverflow):
(WebCore::ValidityState::stepMismatch):
* html/ValidityState.h: Ditto.
(WebCore::ValidityState::create):
(WebCore::ValidityState::ValidityState):
* loader/FormSubmission.cpp: Ditto.
(WebCore::FormSubmission::create):
2010-12-06 Pavel Feldman <pfeldman@chromium.org>
Not reviewed. Rolling out r72988 for breaking iframes.
......
......@@ -1585,6 +1585,8 @@ webcore_sources += \
WebCore/html/EmailInputType.h \
WebCore/html/FileInputType.cpp \
WebCore/html/FileInputType.h \
WebCore/html/FormAssociatedElement.cpp \
WebCore/html/FormAssociatedElement.h \
WebCore/html/FormDataList.cpp \
WebCore/html/FormDataList.h \
WebCore/html/FTPDirectoryDocument.cpp \
......
......@@ -296,6 +296,7 @@ __ZN7WebCore13KeyboardEventC1ERKN3WTF12AtomicStringEbbPNS_9DOMWindowERKNS1_6Stri
__ZN7WebCore13TypingCommand39insertParagraphSeparatorInQuotedContentEPNS_8DocumentE
__ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE
__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
__ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE
__ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
__ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
__ZN7WebCore14CachedResource9addClientEPNS_20CachedResourceClientE
......
......@@ -1642,6 +1642,8 @@
'html/FTPDirectoryDocument.h',
'html/FileInputType.cpp',
'html/FileInputType.h',
'html/FormAssociatedElement.cpp',
'html/FormAssociatedElement.h',
'html/FormDataList.cpp',
'html/FormDataList.h',
'html/HTMLAllCollection.cpp',
......
......@@ -882,6 +882,7 @@ SOURCES += \
html/EmailInputType.cpp \
html/FTPDirectoryDocument.cpp \
html/FileInputType.cpp \
html/FormAssociatedElement.cpp \
html/FormDataList.cpp \
html/HTMLAllCollection.cpp \
html/HTMLAnchorElement.cpp \
......@@ -1795,6 +1796,7 @@ HEADERS += \
html/DOMFormData.h \
html/DOMSettableTokenList.h \
html/DOMTokenList.h \
html/FormAssociatedElement.h \
html/FormDataList.h \
html/FTPDirectoryDocument.h \
html/HTMLAllCollection.h \
......
......@@ -50365,6 +50365,14 @@
RelativePath="..\fileapi\Flags.h"
>
</File>
<File
RelativePath="..\html\FormAssociatedElement.cpp"
>
</File>
<File
RelativePath="..\html\FormAssociatedElement.h"
>
</File>
<File
RelativePath="..\html\FormDataList.cpp"
>
......@@ -1164,6 +1164,8 @@
49FFBF1D11C8550E006A7118 /* GraphicsContext3DMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FFBF1C11C8550E006A7118 /* GraphicsContext3DMac.mm */; };
49FFBF3F11C93EE3006A7118 /* WebGLLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */; };
49FFBF4011C93EE3006A7118 /* WebGLLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */; };
4A0DA2FE129B241900AB61E1 /* FormAssociatedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A0DA2FC129B241900AB61E1 /* FormAssociatedElement.cpp */; };
4A0DA2FF129B241900AB61E1 /* FormAssociatedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
4A8C96EB0BE69032004EEFF0 /* SelectionControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A8C96EA0BE69032004EEFF0 /* SelectionControllerMac.mm */; };
4ACBC0BE12713CBD0094F9B2 /* ClassList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACBC0BC12713CBD0094F9B2 /* ClassList.cpp */; };
4ACBC0BF12713CBD0094F9B2 /* ClassList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACBC0BD12713CBD0094F9B2 /* ClassList.h */; };
......@@ -7319,6 +7321,8 @@
49FFBF1C11C8550E006A7118 /* GraphicsContext3DMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GraphicsContext3DMac.mm; sourceTree = "<group>"; };
49FFBF3D11C93EE3006A7118 /* WebGLLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLLayer.h; sourceTree = "<group>"; };
49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLLayer.mm; sourceTree = "<group>"; };
4A0DA2FC129B241900AB61E1 /* FormAssociatedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormAssociatedElement.cpp; sourceTree = "<group>"; };
4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormAssociatedElement.h; sourceTree = "<group>"; };
4A8C96EA0BE69032004EEFF0 /* SelectionControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = SelectionControllerMac.mm; path = mac/SelectionControllerMac.mm; sourceTree = "<group>"; };
4ACBC0BC12713CBD0094F9B2 /* ClassList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassList.cpp; sourceTree = "<group>"; };
4ACBC0BD12713CBD0094F9B2 /* ClassList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassList.h; sourceTree = "<group>"; };
......@@ -14843,6 +14847,8 @@
F55B3D881251F12D003EF269 /* EmailInputType.h */,
F55B3D891251F12D003EF269 /* FileInputType.cpp */,
F55B3D8A1251F12D003EF269 /* FileInputType.h */,
4A0DA2FC129B241900AB61E1 /* FormAssociatedElement.cpp */,
4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */,
A8136D370973A8E700D74463 /* FormDataList.cpp */,
A8136D360973A8E700D74463 /* FormDataList.h */,
97205AAD123928CA00B17380 /* FTPDirectoryDocument.cpp */,
......@@ -19796,6 +19802,7 @@
3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */,
B734B183119B991D006587BD /* FontTranscoder.h in Headers */,
A80E6CED0A1989CA007FB8C5 /* FontValue.h in Headers */,
4A0DA2FF129B241900AB61E1 /* FormAssociatedElement.h in Headers */,
D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */,
514C76700CE923A1007EF3CD /* FormData.h in Headers */,
085B92BB0EFDE73D00E6123C /* FormDataBuilder.h in Headers */,
......@@ -22461,6 +22468,7 @@
B5320D6C122A24E9002D1440 /* FontPlatformDataCocoa.mm in Sources */,
B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */,
A80E6CF10A1989CA007FB8C5 /* FontValue.cpp in Sources */,
4A0DA2FE129B241900AB61E1 /* FormAssociatedElement.cpp in Sources */,
D05CED290A40BB2C00C5AF38 /* FormatBlockCommand.cpp in Sources */,
514C766F0CE923A1007EF3CD /* FormData.cpp in Sources */,
085B92BA0EFDE73D00E6123C /* FormDataBuilder.cpp in Sources */,
......@@ -27,8 +27,8 @@
namespace WebCore {
class HTMLInputElement;
class HTMLFormControlElement;
class HTMLInputElement;
class CheckedRadioButtons {
public:
......
......@@ -61,6 +61,7 @@
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FocusController.h"
#include "FormAssociatedElement.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
......@@ -4388,23 +4389,23 @@ void Document::setIconURL(const String& iconURL, const String& type)
f->loader()->setIconURL(m_iconURL);
}
void Document::registerFormElementWithFormAttribute(Element* control)
void Document::registerFormElementWithFormAttribute(FormAssociatedElement* element)
{
ASSERT(control->fastHasAttribute(formAttr));
m_formElementsWithFormAttribute.add(control);
ASSERT(toHTMLElement(element)->fastHasAttribute(formAttr));
m_formElementsWithFormAttribute.add(element);
}
void Document::unregisterFormElementWithFormAttribute(Element* control)
void Document::unregisterFormElementWithFormAttribute(FormAssociatedElement* element)
{
m_formElementsWithFormAttribute.remove(control);
m_formElementsWithFormAttribute.remove(element);
}
void Document::resetFormElementsOwner(HTMLFormElement* form)
{
typedef FormElementListHashSet::iterator Iterator;
typedef FormAssociatedElementListHashSet::iterator Iterator;
Iterator end = m_formElementsWithFormAttribute.end();
for (Iterator it = m_formElementsWithFormAttribute.begin(); it != end; ++it)
static_cast<HTMLFormControlElement*>(*it)->resetFormOwner(form);
(*it)->resetFormOwner(form);
}
void Document::setUseSecureKeyboardEntryWhenActive(bool usesSecureKeyboard)
......
......@@ -77,6 +77,7 @@ class Element;
class EntityReference;
class Event;
class EventListener;
class FormAssociatedElement;
class Frame;
class FrameView;
class HTMLCanvasElement;
......@@ -491,8 +492,8 @@ public:
bool hasStateForNewFormElements() const;
bool takeStateForFormElement(AtomicStringImpl* name, AtomicStringImpl* type, String& state);
void registerFormElementWithFormAttribute(Element*);
void unregisterFormElementWithFormAttribute(Element*);
void registerFormElementWithFormAttribute(FormAssociatedElement*);
void unregisterFormElementWithFormAttribute(FormAssociatedElement*);
void resetFormElementsOwner(HTMLFormElement*);
FrameView* view() const; // can be NULL
......@@ -1216,7 +1217,8 @@ private:
typedef ListHashSet<Element*, 64> FormElementListHashSet;
FormElementListHashSet m_formElementsWithState;
FormElementListHashSet m_formElementsWithFormAttribute;
typedef ListHashSet<FormAssociatedElement*, 32> FormAssociatedElementListHashSet;
FormAssociatedElementListHashSet m_formElementsWithFormAttribute;
typedef HashMap<FormElementKey, Vector<String>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
FormElementStateMap m_stateForNewFormElements;
......
......@@ -51,9 +51,9 @@ DOMFormData::DOMFormData(HTMLFormElement* form)
return;
for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
HTMLFormControlElement* control = form->associatedElements()[i];
if (!control->disabled())
control->appendFormData(*this, true);
FormAssociatedElement* element = form->associatedElements()[i];
if (!toHTMLElement(element)->disabled())
element->appendFormData(*this, true);
}
}
......
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
* (C) 2006 Alexey Proskuryakov (ap@nypop.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to