void Internals::setFormControlStateOfPreviousHistoryItem(PassRefPtr<DOMStringList> state, ExceptionCode& ec) { HistoryItem* mainItem = frame()->loader()->history()->previousItem(); if (!state || !mainItem) { ec = INVALID_ACCESS_ERR; return; } String uniqueName = frame()->tree()->uniqueName(); if (mainItem->target() == uniqueName) mainItem->setDocumentState(*state.get()); else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) subItem->setDocumentState(*state.get()); else ec = INVALID_ACCESS_ERR; }
// Does a non-recursive check that this item and its immediate children have the // same frames as the other item. bool HistoryItem::hasSameFrames(HistoryItem& otherItem) const { if (target() != otherItem.target()) return false; if (children().size() != otherItem.children().size()) return false; for (size_t i = 0; i < children().size(); i++) { if (!otherItem.childItemWithTarget(children()[i]->target())) return false; } return true; }
PassRefPtr<DOMStringList> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec) { HistoryItem* mainItem = frame()->loader()->history()->previousItem(); if (!mainItem) { ec = INVALID_ACCESS_ERR; return 0; } String uniqueName = frame()->tree()->uniqueName(); if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) { ec = INVALID_ACCESS_ERR; return 0; } const Vector<String>& state = mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState(); RefPtr<DOMStringList> stringList = DOMStringList::create(); for (unsigned i = 0; i < state.size(); ++i) stringList->append(state[i]); return stringList.release(); }