webengine/osswebengine/WebCore/page/Frame.cpp
branchRCL_3
changeset 47 e1bea15f9a39
parent 5 10e98eab6f85
child 48 79859ed3eea9
equal deleted inserted replaced
46:30342f40acbf 47:e1bea15f9a39
   435     return String();
   435     return String();
   436 }
   436 }
   437 
   437 
   438 String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element* element)
   438 String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element* element)
   439 {
   439 {
   440     RegularExpression* regExp = regExpForLabels(labels);
   440     OwnPtr<RegularExpression> regExp( regExpForLabels(labels) );
   441     // We stop searching after we've seen this many chars
   441     // We stop searching after we've seen this many chars
   442     const unsigned int charsSearchedThreshold = 500;
   442     const unsigned int charsSearchedThreshold = 500;
   443     // This is the absolute max we search.  We allow a little more slop than
   443     // This is the absolute max we search.  We allow a little more slop than
   444     // charsSearchedThreshold, to make it more likely that we'll search whole nodes.
   444     // charsSearchedThreshold, to make it more likely that we'll search whole nodes.
   445     const unsigned int maxCharsSearched = 600;
   445     const unsigned int maxCharsSearched = 600;
   461             // We hit another form element or the start of the form - bail out
   461             // We hit another form element or the start of the form - bail out
   462             break;
   462             break;
   463         } else if (n->hasTagName(tdTag) && !startingTableCell) {
   463         } else if (n->hasTagName(tdTag) && !startingTableCell) {
   464             startingTableCell = static_cast<HTMLTableCellElement*>(n);
   464             startingTableCell = static_cast<HTMLTableCellElement*>(n);
   465         } else if (n->hasTagName(trTag) && startingTableCell) {
   465         } else if (n->hasTagName(trTag) && startingTableCell) {
   466             String result = searchForLabelsAboveCell(regExp, startingTableCell);
   466             String result = searchForLabelsAboveCell(regExp.get(), startingTableCell);
   467             if (!result.isEmpty())
   467             if (!result.isEmpty())
   468                 return result;
   468                 return result;
   469             searchedCellAbove = true;
   469             searchedCellAbove = true;
   470         } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
   470         } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
   471             // For each text chunk, run the regexp
   471             // For each text chunk, run the regexp
   482     }
   482     }
   483 
   483 
   484     // If we started in a cell, but bailed because we found the start of the form or the
   484     // If we started in a cell, but bailed because we found the start of the form or the
   485     // previous element, we still might need to search the row above us for a label.
   485     // previous element, we still might need to search the row above us for a label.
   486     if (startingTableCell && !searchedCellAbove) {
   486     if (startingTableCell && !searchedCellAbove) {
   487          return searchForLabelsAboveCell(regExp, startingTableCell);
   487          return searchForLabelsAboveCell(regExp.get(), startingTableCell);
   488     }
   488     }
   489     return String();
   489     return String();
   490 }
   490 }
   491 
   491 
   492 String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* element)
   492 String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* element)
   494     DeprecatedString name = element->getAttribute(nameAttr).deprecatedString();
   494     DeprecatedString name = element->getAttribute(nameAttr).deprecatedString();
   495     // Make numbers and _'s in field names behave like word boundaries, e.g., "address2"
   495     // Make numbers and _'s in field names behave like word boundaries, e.g., "address2"
   496     name.replace(RegularExpression("[[:digit:]]"), " ");
   496     name.replace(RegularExpression("[[:digit:]]"), " ");
   497     name.replace('_', ' ');
   497     name.replace('_', ' ');
   498     
   498     
   499     RegularExpression* regExp = regExpForLabels(labels);
   499     OwnPtr<RegularExpression> regExp( regExpForLabels(labels) );
   500     // Use the largest match we can find in the whole name string
   500     // Use the largest match we can find in the whole name string
   501     int pos;
   501     int pos;
   502     int length;
   502     int length;
   503     int bestPos = -1;
   503     int bestPos = -1;
   504     int bestLength = -1;
   504     int bestLength = -1;
  1772     if (d->m_jscript && d->m_jscript->haveInterpreter())
  1772     if (d->m_jscript && d->m_jscript->haveInterpreter())
  1773         if (Window* w = Window::retrieveWindow(this))
  1773         if (Window* w = Window::retrieveWindow(this))
  1774             w->disconnectFrame();
  1774             w->disconnectFrame();
  1775 
  1775 
  1776     d->m_page = 0;
  1776     d->m_page = 0;
       
  1777     if(d->m_lifeSupportTimer.isActive()){
       
  1778         //m_lifeSupportTimer is still active. It is not going to get triggered. So the frame needs to be dereferenced   
       
  1779         deref();   
       
  1780         d->m_lifeSupportTimer.stop();
       
  1781 #ifndef NDEBUG
       
  1782         keepAliveSet().remove(this);
       
  1783 #endif  
       
  1784     }
  1777 }
  1785 }
  1778 
  1786 
  1779 void Frame::disconnectOwnerElement()
  1787 void Frame::disconnectOwnerElement()
  1780 {
  1788 {
  1781     if (d->m_ownerElement) {
  1789     if (d->m_ownerElement) {