while (widget = enumerator->Next()) { nsIWidget *child; if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) {  child->GetBounds(rect); printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height); NS_RELEASE(child); } NS_RELEASE(widget);
if (NS_SUCCEEDED(enumerator->CurrentItem(&widget))) { do { nsIWidget *child; if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) {  child->GetBounds(rect); printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height); NS_RELEASE(child); } NS_RELEASE(widget); } while (enumerator->Next());
void DumpRects(){#ifdef XP_PC  nsRect rect;  // print the main window position  window->GetBounds(rect);  printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);  // print all children's position  nsIEnumerator *enumerator = window->GetChildren();  nsISupports * widget;  while (widget = enumerator->Next()) {      nsIWidget *child;      if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) {          //          child->GetBounds(rect);          printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);          NS_RELEASE(child);      }      NS_RELEASE(widget);  }  NS_RELEASE(enumerator);  delete enumerator;#endif}