Make associated IMG element list lazily.

HTMLFormElement::associate(HTMLImageElement&) and
disassociate(HTMLImageElement&) just set a dirty flag, and
HTMLFormElement::imageElements() builds the list of associated IMG elements
lazily.

imageElements() needs to traverse a DOM tree. We want to minimize
the scope of the traversal. So,
 - If the FORM elment has an element which was associated by HTML parser and is
   not a descendant of the FORM, we traverse over the document.
 - Otherwise (the FORM has only elements which are descendants of the FORM), we
   traverse over the FORM element.

We introduce m_hasElementsAssociatedByParser, m_didFinishParsingChildren, and
didAssociateByParser() to check if a FORM element has non-descendant associated
elmenets.

HTMLFormElement::removedFrom needs a special handling for imageElements()
because this function is called after the FORM was removed from a tree and we
might not have up-to-date m_imageElements.
 - If the FORM has no non-descendant associated elements, we have to do nothing.
   We don't need to call formRemovedFromTree for descendant associated elements.
 - If the FORM has up-to-date m_imageElements, we just iterate it.
 - Otherwise, we need to collect associated elements in a tree for the
   insertionPoint and a tree for the FORM element.

BUG=334556
TEST=none; no user-visible behavior changes.

Review URL: https://codereview.chromium.org/143243004

git-svn-id: svn://svn.chromium.org/blink/trunk@165719 bbb929c8-8fbe-4397-9dbb-9b2b20218538