@@ -616,53 +616,6 @@ void nsViewManager::DispatchEvent(WidgetGUIEvent* aEvent, nsView* aView,
616
616
*aStatus = nsEventStatus_eIgnore;
617
617
}
618
618
619
- // Recursively reparent widgets if necessary
620
-
621
- void nsViewManager::ReparentChildWidgets (nsView* aView, nsIWidget* aNewWidget) {
622
- MOZ_ASSERT (aNewWidget, " null widget" );
623
-
624
- if (nsIWidget* widget = aView->GetWidget ()) {
625
- // Check to see if the parent widget is the
626
- // same as the new parent. If not then reparent
627
- // the widget, otherwise there is nothing more
628
- // to do for the view and its descendants
629
- if (widget->GetParent () != aNewWidget) {
630
- widget->SetParent (aNewWidget);
631
- }
632
- return ;
633
- }
634
-
635
- // Need to check each of the views children to see
636
- // if they have a widget and reparent it.
637
-
638
- for (nsView* kid = aView->GetFirstChild (); kid; kid = kid->GetNextSibling ()) {
639
- ReparentChildWidgets (kid, aNewWidget);
640
- }
641
- }
642
-
643
- // Reparent a view and its descendant views widgets if necessary
644
-
645
- void nsViewManager::ReparentWidgets (nsView* aView, nsView* aParent) {
646
- MOZ_ASSERT (aParent, " Must have a parent" );
647
- MOZ_ASSERT (aView, " Must have a view" );
648
-
649
- // Quickly determine whether the view has pre-existing children or a
650
- // widget. In most cases the view will not have any pre-existing
651
- // children when this is called. Only in the case
652
- // where a view has been reparented by removing it from
653
- // a reinserting it into a new location in the view hierarchy do we
654
- // have to consider reparenting the existing widgets for the view and
655
- // it's descendants.
656
- if (aView->HasWidget () || aView->GetFirstChild ()) {
657
- nsIWidget* parentWidget = aParent->GetNearestWidget (nullptr );
658
- if (parentWidget) {
659
- ReparentChildWidgets (aView, parentWidget);
660
- return ;
661
- }
662
- NS_WARNING (" Can not find a widget for the parent view" );
663
- }
664
- }
665
-
666
619
void nsViewManager::InsertChild (nsView* aParent, nsView* aChild,
667
620
nsView* aSibling, bool aAfter) {
668
621
MOZ_ASSERT (nullptr != aParent, " null ptr" );
@@ -682,7 +635,6 @@ void nsViewManager::InsertChild(nsView* aParent, nsView* aChild,
682
635
// insert at end of document order, i.e., before first view
683
636
// this is the common case, by far
684
637
aParent->InsertChild (aChild, nullptr );
685
- ReparentWidgets (aChild, aParent);
686
638
} else {
687
639
// insert at beginning of document order, i.e., after last view
688
640
nsView* kid = aParent->GetFirstChild ();
@@ -693,7 +645,6 @@ void nsViewManager::InsertChild(nsView* aParent, nsView* aChild,
693
645
}
694
646
// prev is last view or null if there are no children
695
647
aParent->InsertChild (aChild, prev);
696
- ReparentWidgets (aChild, aParent);
697
648
}
698
649
} else {
699
650
nsView* kid = aParent->GetFirstChild ();
@@ -707,11 +658,9 @@ void nsViewManager::InsertChild(nsView* aParent, nsView* aChild,
707
658
if (aAfter) {
708
659
// insert after 'kid' in document order, i.e. before in view order
709
660
aParent->InsertChild (aChild, prev);
710
- ReparentWidgets (aChild, aParent);
711
661
} else {
712
662
// insert before 'kid' in document order, i.e. after in view order
713
663
aParent->InsertChild (aChild, kid);
714
- ReparentWidgets (aChild, aParent);
715
664
}
716
665
}
717
666
}
0 commit comments