Bug 129084

Summary: m_ancestorDisabledState should never be unknown
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: FormsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, darin, kling, koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 129035    
Attachments:
Description Flags
Patch
none
Reverted erroneous xcworkspace chagnes
none
Updated per review comments benjamin: review+

Ryosuke Niwa
Reported 2014-02-19 23:06:32 PST
In order to resolve the bug 129035, we need to be notified whenever form control element's disabled-ness changes.
Attachments
Patch (25.64 KB, patch)
2014-02-19 23:51 PST, Ryosuke Niwa
no flags
Reverted erroneous xcworkspace chagnes (21.22 KB, patch)
2014-02-19 23:53 PST, Ryosuke Niwa
no flags
Updated per review comments (23.87 KB, patch)
2014-02-20 18:49 PST, Ryosuke Niwa
benjamin: review+
Ryosuke Niwa
Comment 1 2014-02-19 23:51:56 PST
Ryosuke Niwa
Comment 2 2014-02-19 23:53:32 PST
Created attachment 224724 [details] Reverted erroneous xcworkspace chagnes
Benjamin Poulain
Comment 3 2014-02-20 15:28:53 PST
Comment on attachment 224724 [details] Reverted erroneous xcworkspace chagnes View in context: https://bugs.webkit.org/attachment.cgi?id=224724&action=review Ok with the idea but I have some questions when you have time. > Source/WebCore/html/HTMLFieldSetElement.cpp:77 > + document().removeDisabledFieldsetElement(); Don't you also need this on document destruction? > Source/WebCore/html/HTMLFieldSetElement.cpp:89 > + updateFromControlElementsAncestorDisabledStateUnder(control, thisFieldsetIsDisabled); I am not following this. This loop will go over all the HTMLElements under the FieldSet. updateFromControlElementsAncestorDisabledStateUnder will again traverse the tree looking for any HTMLFormControlElement. Aren't we traversing twice? > Source/WebCore/html/HTMLFieldSetElement.cpp:104 > + while ((legend = Traversal<HTMLLegendElement>::nextSibling(legend))) I am not following here, why do check only the siblings instead of the whole tree after legend? > Source/WebCore/html/HTMLFormControlElement.cpp:118 > +void HTMLFormControlElement::setAncestorDisabled(bool isDisabled) > { > - m_ancestorDisabledState = AncestorDisabledStateUnknown; > - disabledAttributeChanged(); > + ASSERT(computeIsDisabledByFieldsetAncestor() == isDisabled); Shouldn't this be updateIsAncestorDisabled() called without arguments disabledAttributeChanged().
Ryosuke Niwa
Comment 4 2014-02-20 16:26:22 PST
(In reply to comment #3) > (From update of attachment 224724 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=224724&action=review > > Ok with the idea but I have some questions when you have time. > > > Source/WebCore/html/HTMLFieldSetElement.cpp:77 > > + document().removeDisabledFieldsetElement(); > > Don't you also need this on document destruction? We don't because all fieldset elements would have been removed at that point. > > Source/WebCore/html/HTMLFieldSetElement.cpp:89 > > + updateFromControlElementsAncestorDisabledStateUnder(control, thisFieldsetIsDisabled); > > I am not following this. This loop will go over all the HTMLElements under the FieldSet. updateFromControlElementsAncestorDisabledStateUnder will again traverse the tree looking for any HTMLFormControlElement. > Aren't we traversing twice? Here, I'm traversing over all child elements, and then for each child node and its descendants we update its internals states. We can't call updateFromControlElementsAncestorDisabledStateUnder on this here because we need to call it with isDisabled set to false when the child is the first legend element we saw. > > Source/WebCore/html/HTMLFieldSetElement.cpp:104 > > + while ((legend = Traversal<HTMLLegendElement>::nextSibling(legend))) > > I am not following here, why do check only the siblings instead of the whole tree after legend? See my change log description: Update disabled-ness of form controls under child legend elements because controls aren't disabled in the first legend element, and adding or removing child elements may have changed the first legend element. Removing or adding child nodes DO NOT change disabled-ness of elements outside of the new and the old first legend element. > > Source/WebCore/html/HTMLFormControlElement.cpp:118 > > +void HTMLFormControlElement::setAncestorDisabled(bool isDisabled) > > { > > - m_ancestorDisabledState = AncestorDisabledStateUnknown; > > - disabledAttributeChanged(); > > + ASSERT(computeIsDisabledByFieldsetAncestor() == isDisabled); > > Shouldn't this be updateIsAncestorDisabled() called without arguments disabledAttributeChanged(). I don't understand what you're saying here.
Ryosuke Niwa
Comment 5 2014-02-20 18:49:10 PST
Created attachment 224818 [details] Updated per review comments
Ryosuke Niwa
Comment 6 2014-02-20 22:34:53 PST
Note You need to log in before you can comment on or make changes to this bug.