src/3rdparty/webkit/WebCore/html/HTMLImageElement.cpp
changeset 19 fcece45ef507
parent 0 1918ee327afb
child 30 5dc02b23752f
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
   207     }
   207     }
   208 
   208 
   209     HTMLElement::removedFromDocument();
   209     HTMLElement::removedFromDocument();
   210 }
   210 }
   211 
   211 
       
   212 void HTMLImageElement::insertedIntoTree(bool deep)
       
   213 {
       
   214     if (!m_form) {
       
   215         // m_form can be non-null if it was set in constructor.
       
   216         for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
       
   217             if (ancestor->hasTagName(formTag)) {
       
   218                 m_form = static_cast<HTMLFormElement*>(ancestor);
       
   219                 m_form->registerImgElement(this);
       
   220                 break;
       
   221             }
       
   222         }
       
   223     }
       
   224 
       
   225     HTMLElement::insertedIntoTree(deep);
       
   226 }
       
   227 
       
   228 void HTMLImageElement::removedFromTree(bool deep)
       
   229 {
       
   230     if (m_form)
       
   231         m_form->removeImgElement(this);
       
   232     m_form = 0;
       
   233     HTMLElement::removedFromTree(deep);
       
   234 }
       
   235 
   212 int HTMLImageElement::width(bool ignorePendingStylesheets) const
   236 int HTMLImageElement::width(bool ignorePendingStylesheets) const
   213 {
   237 {
   214     if (!renderer()) {
   238     if (!renderer()) {
   215         // check the attribute first for an explicit pixel value
   239         // check the attribute first for an explicit pixel value
   216         bool ok;
   240         bool ok;