int AmayaWindowIterator::currentWindowId() { if (currentElement()) return ((AmayaWindow *)currentElement())->GetWindowId(); else return 0; }
PHierarchicalCluster THierarchicalClustering::restructure(TClusterW *root) { PIntList elementIndices = new TIntList(root->size); TIntList::iterator currentElement(elementIndices->begin()); int currentIndex = 0; return restructure(root, elementIndices, currentElement, currentIndex); }
void nsXFormsSwitchElement::SetFocus(nsIDOMElement* aDeselected, nsIDOMElement* aSelected) { if (aDeselected == aSelected) return; nsCOMPtr<nsIDOMDocument> domDoc; mElement->GetOwnerDocument(getter_AddRefs(domDoc)); nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc)); if (!doc) return; nsCOMPtr<nsPIDOMWindow> win = doc->GetWindow(); if (!win) return; nsIFocusController *focusController = win->GetRootFocusController(); if (!focusController) return; nsCOMPtr<nsIDOMElement> focused; focusController->GetFocusedElement(getter_AddRefs(focused)); if (!focused) return; PRBool hasFocus = PR_FALSE; nsCOMPtr<nsIDOMNode> current(do_QueryInterface(focused)); do { nsCOMPtr<nsIDOMElement> currentElement(do_QueryInterface(current)); if (aDeselected == current) { hasFocus = PR_TRUE; break; } nsCOMPtr<nsIDOMNode> parent; current->GetParentNode(getter_AddRefs(parent)); current.swap(parent); } while(current); if (hasFocus) { // Flush layout before moving focus. Otherwise focus controller might // (re)focus something in the deselected <case>. doc->FlushPendingNotifications(Flush_Layout); focusController->MoveFocus(PR_TRUE, mElement); } }
inline Document& HTMLConstructionSite::ownerDocumentForCurrentNode() { if (isHTMLTemplateElement(*currentNode())) return toHTMLTemplateElement(currentElement())->content()->document(); return currentNode()->document(); }