Attachment #70019: new patch for bug #91516

View | Details | Raw Unified | Return to bug 91516
Collapse All | Expand All

(-)content/base/src/nsDocumentViewer.cpp (-2 / +52 lines)
Line     Link Here 
 Lines 4276-4289    Link Here 
4276
  rv = CallCreateInstance(kViewCID, &mView);
4276
  rv = CallCreateInstance(kViewCID, &mView);
4277
  if (NS_FAILED(rv))
4277
  if (NS_FAILED(rv))
4278
    return rv;
4278
    return rv;
4279
  rv = mView->Init(mViewManager, tbounds, nsnull);
4279
4280
  // if aParentWidget has a view, we'll hook our view manager up to its view tree
4281
  void* clientData;
4282
  nsIView* containerView = nsnull;
4283
  if (NS_SUCCEEDED(aParentWidget->GetClientData(clientData))) {
4284
    nsISupports* data = (nsISupports*)clientData;
4285
    
4286
    if (nsnull != data) {
4287
      data->QueryInterface(NS_GET_IID(nsIView), (void **)&containerView);
4288
    }
4289
  }
4290
4291
  if (nsnull != containerView) {
4292
    // see if the containerView has already been hooked into a foreign view manager hierarchy
4293
    // if it has, then we have to hook into the hierarchy too otherwise bad things will happen.
4294
    nsCOMPtr<nsIViewManager> containerVM;
4295
    containerView->GetViewManager(*getter_AddRefs(containerVM));
4296
    nsCOMPtr<nsIViewManager> checkVM;
4297
    nsIView* pView = containerView;
4298
    do {
4299
      pView->GetParent(pView);
4300
    } while (pView != nsnull
4301
             && NS_SUCCEEDED(pView->GetViewManager(*getter_AddRefs(checkVM))) && checkVM == containerVM);
4302
4303
    if (nsnull == pView) {
4304
      // OK, so the container is not already hooked up into a foreign view manager hierarchy.
4305
      // That means we can choose not to hook ourselves up.
4306
      //
4307
      // If the parent container is a chrome shell, or a frameset, then we won't hook into its view
4308
      // tree. This will improve performance a little bit (especially given scrolling/painting perf bugs)
4309
      // but is really just for peace of mind. This check can be removed if we want to support fancy 
4310
      // chrome effects like transparent controls floating over content, transparent Web browsers, and
4311
      // things like that, and the perf bugs are fixed.
4312
      nsCOMPtr<nsIDocShellTreeItem> container(do_QueryInterface(mContainer));
4313
      nsCOMPtr<nsIDocShellTreeItem> parentContainer;
4314
      PRInt32 itemType;
4315
      if (nsnull == container
4316
          || NS_FAILED(container->GetParent(getter_AddRefs(parentContainer)))
4317
          || nsnull == parentContainer
4318
          || NS_FAILED(parentContainer->GetItemType(&itemType))
4319
          || itemType != nsIDocShellTreeItem::typeContent) {
4320
        containerView = nsnull;
4321
      } else {
4322
        nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(parentContainer));
4323
        if (nsnull == webShell || IsWebShellAFrameSet(webShell)) {
4324
          containerView = nsnull;
4325
        }
4326
      }
4327
    }
4328
  }
4329
4330
  rv = mView->Init(mViewManager, tbounds, containerView);
4280
  if (NS_FAILED(rv))
4331
  if (NS_FAILED(rv))
4281
    return rv;
4332
    return rv;
4282
4333
4283
  rv = mView->CreateWidget(kWidgetCID, nsnull,
4334
  rv = mView->CreateWidget(kWidgetCID, nsnull,
4284
                           aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
4335
                           aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
4285
                           PR_TRUE, PR_FALSE);
4336
                           PR_TRUE, PR_FALSE);
4286
4287
  if (rv != NS_OK)
4337
  if (rv != NS_OK)
4288
    return rv;
4338
    return rv;
4289
4339
(-)layout/html/base/src/nsContainerFrame.cpp (-2 / +14 lines)
Line     Link Here 
 Lines 410-416    Link Here 
410
    nsCOMPtr<nsIViewManager> vm;
410
    nsCOMPtr<nsIViewManager> vm;
411
    view->GetViewManager(*getter_AddRefs(vm));
411
    view->GetViewManager(*getter_AddRefs(vm));
412
412
413
    if (containingView != parentView) {
413
    // it's possible for the parentView to be nonnull but containingView to be
414
    // null, when the parent view doesn't belong to this frame tree but to
415
    // the frame tree of some enclosing document. We do nothing in that case,
416
    // but we have to check that containingView is nonnull or we will crash.
417
    if (nsnull != containingView && containingView != parentView) {
414
      // it is possible for parent view not to have a frame attached to it
418
      // it is possible for parent view not to have a frame attached to it
415
      // kind of an anonymous view. This happens with native scrollbars and
419
      // kind of an anonymous view. This happens with native scrollbars and
416
      // the clip view. To fix this we need to go up and parentView chain
420
      // the clip view. To fix this we need to go up and parentView chain
 Lines 546-554    Link Here 
546
    // See if the view should be hidden or visible
550
    // See if the view should be hidden or visible
547
    PRBool  viewIsVisible = PR_TRUE;
551
    PRBool  viewIsVisible = PR_TRUE;
548
    PRBool  viewHasTransparentContent =
552
    PRBool  viewHasTransparentContent =
549
        !isCanvas &&
550
        (!hasBG ||
553
        (!hasBG ||
551
         (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
554
         (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
555
    if (isCanvas && viewHasTransparentContent) {
556
      nsIView* rootView;
557
      vm->GetRootView(rootView);
558
      nsIView* rootParent;
559
      rootView->GetParent(rootParent);
560
      if (nsnull == rootParent) {
561
        viewHasTransparentContent = PR_FALSE;
562
      }
563
    }
552
564
553
    if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) {
565
    if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) {
554
      viewIsVisible = PR_FALSE;
566
      viewIsVisible = PR_FALSE;
(-)layout/html/document/src/nsFrameFrame.cpp (-8 / +16 lines)
Line     Link Here 
 Lines 326-342    Link Here 
326
  if (NS_FAILED(rv))
326
  if (NS_FAILED(rv))
327
    return rv;
327
    return rv;
328
328
329
  // nsHTMLFrameInnerFrame is going to create a view for its frame
330
  // right away, in the call to Init().  If we need a view for the
331
  // OuterFrame but we wait for the normal view creation path in
332
  // nsCSSFrameConstructor, then we will lose because the InnerFrame's
333
  // view's parent will already have been set to some outer view
334
  // (e.g., the canvas) when it really needs to have the OuterFrame's
335
  // view as its parent. So, create the OuterFrame's view right away
336
  // if we need it, and the InnerFrame's view will get it as the parent.
337
  nsIView* view = nsnull;
338
  GetView(aPresContext, &view);
339
  if (!view) {
340
    nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,nsnull,PR_TRUE); 
341
    GetView(aPresContext, &view);
342
  }
343
329
  const nsStyleDisplay* disp;
344
  const nsStyleDisplay* disp;
330
  aParent->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)disp));
345
  aParent->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)disp));
331
  if (disp->mDisplay == NS_STYLE_DISPLAY_DECK) {
346
  if (disp->mDisplay == NS_STYLE_DISPLAY_DECK) {
332
    nsIView* view = nsnull;
333
    GetView(aPresContext, &view);
334
335
    if (!view) {
336
      nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,nsnull,PR_TRUE); 
337
      GetView(aPresContext, &view);
338
    }
339
340
    nsCOMPtr<nsIWidget> widget;
347
    nsCOMPtr<nsIWidget> widget;
341
    view->GetWidget(*getter_AddRefs(widget));
348
    view->GetWidget(*getter_AddRefs(widget));
342
349
 Lines 1239-1244    Link Here 
1239
  nsIView* view;
1246
  nsIView* view;
1240
  nsresult rv = nsComponentManager::CreateInstance(kCViewCID, nsnull, NS_GET_IID(nsIView),
1247
  nsresult rv = nsComponentManager::CreateInstance(kCViewCID, nsnull, NS_GET_IID(nsIView),
1241
                                        (void **)&view);
1248
                                        (void **)&view);
1249
1242
  if (NS_OK != rv) {
1250
  if (NS_OK != rv) {
1243
    NS_ASSERTION(0, "Could not create view for nsHTMLFrame");
1251
    NS_ASSERTION(0, "Could not create view for nsHTMLFrame");
1244
    return rv;
1252
    return rv;
(-)layout/html/forms/src/nsFormControlFrame.cpp (-2 / +17 lines)
Line     Link Here 
 Lines 981-1003    Link Here 
981
  float p2t;
981
  float p2t;
982
  aPresContext->GetTwipsToPixels(&t2p);
982
  aPresContext->GetTwipsToPixels(&t2p);
983
  aPresContext->GetPixelsToTwips(&p2t);
983
  aPresContext->GetPixelsToTwips(&p2t);
984
  
984
985
   // Add in frame's offset from it it's containing view
985
   // Add in frame's offset from it it's containing view
986
  nsIView *containingView = nsnull;
986
  nsIView *containingView = nsnull;
987
  nsPoint offset;
987
  nsPoint offset;
988
  rv = aFrame->GetOffsetFromView(aPresContext, offset, &containingView);
988
  rv = aFrame->GetOffsetFromView(aPresContext, offset, &containingView);
989
989
  if (NS_SUCCEEDED(rv) && (nsnull != containingView)) {
990
  if (NS_SUCCEEDED(rv) && (nsnull != containingView)) {
990
    aAbsoluteTwipsRect.x += offset.x;
991
    aAbsoluteTwipsRect.x += offset.x;
991
    aAbsoluteTwipsRect.y += offset.y;
992
    aAbsoluteTwipsRect.y += offset.y;
992
993
993
    nsPoint viewOffset;
994
    nsPoint viewOffset;
994
    containingView->GetPosition(&viewOffset.x, &viewOffset.y);
995
    containingView->GetPosition(&viewOffset.x, &viewOffset.y);
996
995
    nsIView * parent;
997
    nsIView * parent;
996
    containingView->GetParent(parent);
998
    containingView->GetParent(parent);
997
999
998
    // if we don't have a parent view then 
1000
    // if we don't have a parent view then 
999
    // check to see if we have a widget and adjust our offset for the widget
1001
    // check to see if we have a widget and adjust our offset for the widget
1000
    if (parent == nsnull) {
1002
    if (parent == nsnull) {
1003
      // account for space above and to the left of the containingView origin.
1004
      // the widget is aligned with containingView's bounds, not its origin
1005
      nsRect bounds;
1006
      containingView->GetBounds(bounds);
1007
      aAbsoluteTwipsRect.x += viewOffset.x - bounds.x;
1008
      aAbsoluteTwipsRect.y += viewOffset.y - bounds.y;
1009
1001
      nsIWidget * widget;
1010
      nsIWidget * widget;
1002
      containingView->GetWidget(widget);
1011
      containingView->GetWidget(widget);
1003
      if (nsnull != widget) {
1012
      if (nsnull != widget) {
 Lines 1012-1018    Link Here 
1012
      }
1021
      }
1013
      rv = NS_OK;
1022
      rv = NS_OK;
1014
    } else {
1023
    } else {
1015
1016
      while (nsnull != parent) {
1024
      while (nsnull != parent) {
1017
        nsPoint po;
1025
        nsPoint po;
1018
        parent->GetPosition(&po.x, &po.y);
1026
        parent->GetPosition(&po.x, &po.y);
 Lines 1029-1034    Link Here 
1029
        nsIWidget * widget;
1037
        nsIWidget * widget;
1030
        parent->GetWidget(widget);
1038
        parent->GetWidget(widget);
1031
        if (nsnull != widget) {
1039
        if (nsnull != widget) {
1040
          // account for space above and to the left of the containingView origin.
1041
          // the widget is aligned with containingView's bounds, not its origin
1042
          nsRect bounds;
1043
          parent->GetBounds(bounds);
1044
          aAbsoluteTwipsRect.x += po.x - bounds.x;
1045
          aAbsoluteTwipsRect.y += po.y - bounds.y;
1046
1032
          // Add in the absolute offset of the widget.
1047
          // Add in the absolute offset of the widget.
1033
          nsRect absBounds;
1048
          nsRect absBounds;
1034
          nsRect lc;
1049
          nsRect lc;
(-)layout/html/forms/src/nsListControlFrame.cpp (+6 lines)
Line     Link Here 
 Lines 2275-2280    Link Here 
2275
2275
2276
  parent = aView;
2276
  parent = aView;
2277
  while (nsnull != parent) {
2277
  while (nsnull != parent) {
2278
    nsCOMPtr<nsIViewManager> vm;
2279
    parent->GetViewManager(*getter_AddRefs(vm));
2280
    if (vm != aManager) {
2281
      break;
2282
    }
2283
2278
    nscoord x, y;
2284
    nscoord x, y;
2279
    parent->GetPosition(&x, &y);
2285
    parent->GetPosition(&x, &y);
2280
    aPoint.x += x;
2286
    aPoint.x += x;
(-)layout/html/style/src/nsCSSRendering.cpp (-6 / +14 lines)
Line     Link Here 
 Lines 2554-2571    Link Here 
2554
    return;
2554
    return;
2555
  }
2555
  }
2556
2556
2557
  // Ensure that we always paint a color for the root (in case there's
2558
  // no background at all or a partly transparent image).
2559
  nsStyleBackground canvasColor(*color);
2557
  nsStyleBackground canvasColor(*color);
2560
  if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
2561
    canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
2562
    aPresContext->GetDefaultBackgroundColor(&canvasColor.mBackgroundColor);
2563
  }
2564
2558
2565
  nsCOMPtr<nsIPresShell> shell;
2559
  nsCOMPtr<nsIPresShell> shell;
2566
  aPresContext->GetShell(getter_AddRefs(shell));
2560
  aPresContext->GetShell(getter_AddRefs(shell));
2567
  nsCOMPtr<nsIViewManager> vm;
2561
  nsCOMPtr<nsIViewManager> vm;
2568
  shell->GetViewManager(getter_AddRefs(vm));
2562
  shell->GetViewManager(getter_AddRefs(vm));
2563
2564
  if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
2565
    nsIView* rootView;
2566
    vm->GetRootView(rootView);
2567
    nsIView* rootParent;
2568
    rootView->GetParent(rootParent);
2569
    if (nsnull == rootParent) {
2570
      // Ensure that we always paint a color for the root (in case there's
2571
      // no background at all or a partly transparent image).
2572
      canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
2573
      aPresContext->GetDefaultBackgroundColor(&canvasColor.mBackgroundColor);
2574
    }
2575
  }
2576
2569
  vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
2577
  vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
2570
2578
2571
  // Since nsHTMLContainerFrame::CreateViewForFrame might have created
2579
  // Since nsHTMLContainerFrame::CreateViewForFrame might have created
(-)view/public/nsIViewManager.h (-1 / +1 lines)
Line     Link Here 
 Lines 83-89    Link Here 
83
83
84
  /**
84
  /**
85
   * Set the root of the view tree. Does not destroy the current root view.
85
   * Set the root of the view tree. Does not destroy the current root view.
86
   * One of following must be true:
86
   * At least one of following must be true:
87
   * a) the aWidget parameter is an nsIWidget instance to render into 
87
   * a) the aWidget parameter is an nsIWidget instance to render into 
88
   *    that is not owned by any view and aView has no widget, or
88
   *    that is not owned by any view and aView has no widget, or
89
   * b) aView has a nsIWidget instance and aWidget is null, or
89
   * b) aView has a nsIWidget instance and aWidget is null, or
(-)view/src/nsView.cpp (-10 / +15 lines)
Line     Link Here 
 Lines 103-109    Link Here 
103
103
104
  while (GetFirstChild() != nsnull)
104
  while (GetFirstChild() != nsnull)
105
  {
105
  {
106
    GetFirstChild()->Destroy();
106
    nsView* child = GetFirstChild();
107
    if (child->GetViewManager() == mViewManager) {
108
      child->Destroy();
109
    } else {
110
      // just unhook it. Someone else will want to destroy this.
111
      RemoveChild(child);
112
    }
107
  }
113
  }
108
114
109
  if (nsnull != mViewManager)
115
  if (nsnull != mViewManager)
 Lines 112-135    Link Here 
112
    
118
    
113
    if (nsnull != rootView)
119
    if (nsnull != rootView)
114
    {
120
    {
121
      // Root views can have parents!
122
      if (nsnull != mParent)
123
      {
124
        mViewManager->RemoveChild(this);
125
      }
126
115
      if (rootView == this)
127
      if (rootView == this)
116
      {
128
      {
117
        // Inform the view manager that the root view has gone away...
129
        // Inform the view manager that the root view has gone away...
118
        mViewManager->SetRootView(nsnull);
130
        mViewManager->SetRootView(nsnull);
119
      }
131
      }
120
      else
132
    }
121
      {
122
        if (nsnull != mParent)
123
        {
124
          mViewManager->RemoveChild(this);
125
        }
126
      }
127
    } 
128
    else if (nsnull != mParent)
133
    else if (nsnull != mParent)
129
    {
134
    {
130
      mParent->RemoveChild(this);
135
      mParent->RemoveChild(this);
131
    }
136
    }
132
137
    
133
    nsView* grabbingView = mViewManager->GetMouseEventGrabber(); //check to see if we are capturing!!!
138
    nsView* grabbingView = mViewManager->GetMouseEventGrabber(); //check to see if we are capturing!!!
134
    if (grabbingView == this)
139
    if (grabbingView == this)
135
    {
140
    {
(-)view/src/nsViewManager.cpp (-33 / +90 lines)
Line     Link Here 
 Lines 64-80    Link Here 
64
   XXX TODO XXX
64
   XXX TODO XXX
65
65
66
   DeCOMify newly private methods
66
   DeCOMify newly private methods
67
   Move event handling into nsViewManager
68
   Make event handling use CreateDisplayList
69
   Reverse storage order of views so that LAST view in document order is the LAST child
70
     of its parent view
71
   Audit users of nsIView::GetPosition and nsIView::GetBounds, then 
72
     fix nsContainerFrame::SyncFrameViewAfterReflow to size views to contain
73
     left-or-above content
74
   Remove nsIClipView stuff and just use the CLIPCHILDREN flag
75
   Put in support for hierarchy of viewmanagers (handle nsViewManager::SetRootView
76
     case where aWidget == null and aView has a non-null parent with a different view
77
     manager)
78
   Fix opacity model to conform to SVG (requires backbuffer stack)
67
   Fix opacity model to conform to SVG (requires backbuffer stack)
79
   Optimize view storage
68
   Optimize view storage
80
*/
69
*/
 Lines 530-535    Link Here 
530
519
531
  // case b) The aView has a nsIWidget instance
520
  // case b) The aView has a nsIWidget instance
532
  if (nsnull != mRootView) {
521
  if (nsnull != mRootView) {
522
    nsView* parent = mRootView->GetParent();
523
    if (nsnull != parent) {
524
      parent->InsertChild(mRootView, nsnull);
525
    }
526
527
    mRootView->SetZIndex(PR_FALSE, 0);
528
533
    mRootView->GetWidget(mRootWindow);
529
    mRootView->GetWidget(mRootWindow);
534
    if (nsnull != mRootWindow) {
530
    if (nsnull != mRootWindow) {
535
      return NS_OK;
531
      return NS_OK;
 Lines 1045-1050    Link Here 
1045
void nsViewManager::RenderViews(nsView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect, PRBool &aResult)
1041
void nsViewManager::RenderViews(nsView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect, PRBool &aResult)
1046
{
1042
{
1047
  BuildDisplayList(aRootView, aRect, PR_FALSE, PR_FALSE);
1043
  BuildDisplayList(aRootView, aRect, PR_FALSE, PR_FALSE);
1044
1048
  nsRect fakeClipRect;
1045
  nsRect fakeClipRect;
1049
  PRInt32 index = 0;
1046
  PRInt32 index = 0;
1050
  PRBool anyRendered;
1047
  PRBool anyRendered;
 Lines 1054-1059    Link Here 
1054
    
1051
    
1055
  OptimizeDisplayList(aRect, finalTransparentRect);
1052
  OptimizeDisplayList(aRect, finalTransparentRect);
1056
1053
1054
  // ShowDisplayList(mDisplayListCount);
1055
1057
  if (!finalTransparentRect.IsEmpty()) {
1056
  if (!finalTransparentRect.IsEmpty()) {
1058
    // There are some bits here that aren't going to be completely painted unless we do it now.
1057
    // There are some bits here that aren't going to be completely painted unless we do it now.
1059
    // XXX Which color should we use for these bits?
1058
    // XXX Which color should we use for these bits?
 Lines 1393-1399    Link Here 
1393
  // process pending updates in child view.
1392
  // process pending updates in child view.
1394
  nsView* childView = aView->GetFirstChild();
1393
  nsView* childView = aView->GetFirstChild();
1395
  while (nsnull != childView)  {
1394
  while (nsnull != childView)  {
1396
    ProcessPendingUpdates(childView);
1395
    if (childView->GetViewManager() == this) {
1396
      ProcessPendingUpdates(childView);
1397
    }
1397
    childView = childView->GetNextSibling();
1398
    childView = childView->GetNextSibling();
1398
  }
1399
  }
1399
1400
 Lines 1446-1452    Link Here 
1446
    return NS_OK;
1447
    return NS_OK;
1447
  }
1448
  }
1448
1449
1449
  UpdateAllCoveringWidgets(mRootView, view, damageRect, PR_FALSE);
1450
  nsView* realRoot = mRootView;
1451
  while (realRoot->GetParent() != nsnull) {
1452
    realRoot = realRoot->GetParent();
1453
  }
1454
1455
  UpdateAllCoveringWidgets(realRoot, view, damageRect, PR_FALSE);
1450
  Composite();
1456
  Composite();
1451
  return NS_OK;
1457
  return NS_OK;
1452
}
1458
}
 Lines 1499-1517    Link Here 
1499
  }
1505
  }
1500
1506
1501
  if (!childCovers && (!isBlittable || (hasWidget && !aRepaintOnlyUnblittableViews))) {
1507
  if (!childCovers && (!isBlittable || (hasWidget && !aRepaintOnlyUnblittableViews))) {
1502
    ++mUpdateCnt;
1508
    nsViewManager* vm = aView->GetViewManager();
1509
    ++vm->mUpdateCnt;
1503
1510
1504
    if (!mRefreshEnabled) {
1511
    if (!vm->mRefreshEnabled) {
1505
      // accumulate this rectangle in the view's dirty region, so we can process it later.
1512
      // accumulate this rectangle in the view's dirty region, so we can process it later.
1506
      AddRectToDirtyRegion(aView, bounds);
1513
      vm->AddRectToDirtyRegion(aView, bounds);
1507
      mHasPendingInvalidates = PR_TRUE;
1514
      vm->mHasPendingInvalidates = PR_TRUE;
1508
    } else {
1515
    } else {
1509
      nsView* widgetView = GetWidgetView(aView);
1516
      nsView* widgetView = GetWidgetView(aView);
1510
      if (widgetView != nsnull) {
1517
      if (widgetView != nsnull) {
1511
        ViewToWidget(aView, widgetView, bounds);
1518
        ViewToWidget(aView, widgetView, bounds);
1512
1519
1513
        nsCOMPtr<nsIWidget> widget;
1520
        nsCOMPtr<nsIWidget> widget;
1514
        GetWidgetForView(widgetView, getter_AddRefs(widget));
1521
        vm->GetWidgetForView(widgetView, getter_AddRefs(widget));
1515
        widget->Invalidate(bounds, PR_FALSE);
1522
        widget->Invalidate(bounds, PR_FALSE);
1516
      }
1523
      }
1517
    }
1524
    }
 Lines 1589-1595    Link Here 
1589
    damagedRect.x = origin.x;
1596
    damagedRect.x = origin.x;
1590
    damagedRect.y = origin.y;
1597
    damagedRect.y = origin.y;
1591
1598
1592
    UpdateAllCoveringWidgets(mRootView, nsnull, damagedRect, PR_FALSE);
1599
    nsView* realRoot = mRootView;
1600
    while (realRoot->GetParent() != nsnull) {
1601
      realRoot = realRoot->GetParent();
1602
    }
1603
1604
    UpdateAllCoveringWidgets(realRoot, nsnull, damagedRect, PR_FALSE);
1593
  }
1605
  }
1594
1606
1595
  ++mUpdateCnt;
1607
  ++mUpdateCnt;
 Lines 1620-1626    Link Here 
1620
  // update all children as well.
1632
  // update all children as well.
1621
  nsView* childView = aView->GetFirstChild();
1633
  nsView* childView = aView->GetFirstChild();
1622
  while (nsnull != childView)  {
1634
  while (nsnull != childView)  {
1623
    UpdateViews(childView, aUpdateFlags);
1635
    if (childView->GetViewManager() == this) {
1636
      UpdateViews(childView, aUpdateFlags);
1637
    }
1624
    childView = childView->GetNextSibling();
1638
    childView = childView->GetNextSibling();
1625
  }
1639
  }
1626
}
1640
}
 Lines 1805-1818    Link Here 
1805
            nsView *parent;
1819
            nsView *parent;
1806
1820
1807
            parent = baseView;
1821
            parent = baseView;
1808
            while (nsnull != parent) {
1822
            while (mRootView != parent) {
1809
              parent->ConvertToParentCoords(&offset.x, &offset.y);
1823
              parent->ConvertToParentCoords(&offset.x, &offset.y);
1810
              parent = parent->GetParent();
1824
              parent = parent->GetParent();
1811
            }
1825
            }
1812
1826
1813
            //Subtract back offset from root of view
1827
            //Subtract back offset from root of view
1814
            parent = view;
1828
            parent = view;
1815
            while (nsnull != parent) {
1829
            while (mRootView != parent) {
1816
              parent->ConvertFromParentCoords(&offset.x, &offset.y);
1830
              parent->ConvertFromParentCoords(&offset.x, &offset.y);
1817
              parent = parent->GetParent();
1831
              parent = parent->GetParent();
1818
            }
1832
            }
 Lines 1984-2000    Link Here 
1984
  }
1998
  }
1985
1999
1986
  nsAutoVoidArray targetViews;
2000
  nsAutoVoidArray targetViews;
2001
  nsAutoVoidArray heldRefCountsToOtherVMs;
1987
2002
1988
  // In fact, we only need to take this expensive path when the event is a mouse event ... riiiight?
2003
  // In fact, we only need to take this expensive path when the event is a mouse event ... riiiight?
1989
  BuildEventTargetList(targetViews, aView, aEvent, aCaptured);
2004
  BuildEventTargetList(targetViews, aView, aEvent, aCaptured);
1990
2005
1991
  nsEventStatus status = nsEventStatus_eIgnore;
2006
  nsEventStatus status = nsEventStatus_eIgnore;
1992
2007
1993
  for (PRInt32 i = 0; i < targetViews.Count(); i++) {
2008
  // get a death grip on any view managers' view observers (other than this one)
2009
  PRInt32 i;
2010
  for (i = 0; i < targetViews.Count(); i++) {
2011
    DisplayListElement2* element = NS_STATIC_CAST(DisplayListElement2*, targetViews.ElementAt(i));
2012
    nsView* v = element->mView;
2013
    nsViewManager* vVM = v->GetViewManager();
2014
    if (vVM != this) {
2015
      nsIViewObserver* vobs = nsnull;
2016
      vVM->GetViewObserver(vobs);
2017
      if (nsnull != vobs) {
2018
        heldRefCountsToOtherVMs.AppendElement(vobs);
2019
      }
2020
    }
2021
  }
2022
2023
  for (i = 0; i < targetViews.Count(); i++) {
1994
    DisplayListElement2* element = NS_STATIC_CAST(DisplayListElement2*, targetViews.ElementAt(i));
2024
    DisplayListElement2* element = NS_STATIC_CAST(DisplayListElement2*, targetViews.ElementAt(i));
1995
    nsView* v = element->mView;
2025
    nsView* v = element->mView;
1996
2026
1997
    if (nsnull != v->GetClientData() && nsnull != obs) {
2027
    if (nsnull != v->GetClientData()) {
1998
      PRBool handled = PR_FALSE;
2028
      PRBool handled = PR_FALSE;
1999
      nsRect r;
2029
      nsRect r;
2000
      v->GetDimensions(r);
2030
      v->GetDimensions(r);
 Lines 2005-2011    Link Here 
2005
      aEvent->point.x -= x;
2035
      aEvent->point.x -= x;
2006
      aEvent->point.y -= y;
2036
      aEvent->point.y -= y;
2007
2037
2008
      obs->HandleEvent(v, aEvent, &status, i == targetViews.Count() - 1, handled);
2038
      nsViewManager* vVM = v->GetViewManager();
2039
      if (vVM == this) {
2040
        if (nsnull != obs) {
2041
          obs->HandleEvent(v, aEvent, &status, i == targetViews.Count() - 1, handled);
2042
        }
2043
      } else {
2044
        nsIViewObserver* vobs = nsnull;
2045
        vVM->GetViewObserver(vobs);
2046
        if (nsnull != vobs) {
2047
          vobs->HandleEvent(v, aEvent, &status, i == targetViews.Count() - 1, handled);
2048
        }
2049
      }
2009
2050
2010
      aEvent->point.x += x;
2051
      aEvent->point.x += x;
2011
      aEvent->point.y += y;
2052
      aEvent->point.y += y;
 Lines 2025-2030    Link Here 
2025
    delete element;
2066
    delete element;
2026
  }
2067
  }
2027
2068
2069
  // release death grips
2070
  for (i = 0; i < heldRefCountsToOtherVMs.Count(); i++) {
2071
    nsIViewObserver* element = NS_STATIC_CAST(nsIViewObserver*, heldRefCountsToOtherVMs.ElementAt(i));
2072
    NS_RELEASE(element);
2073
  }  
2074
2028
  return status;
2075
  return status;
2029
}
2076
}
2030
2077
 Lines 2455-2460    Link Here 
2455
2502
2456
  NS_ASSERTION((view != nsnull), "no view");
2503
  NS_ASSERTION((view != nsnull), "no view");
2457
2504
2505
  // don't allow the root view's z-index to be changed. It should always be zero.
2506
  // This could be removed and replaced with a style rule, or just removed altogether, with interesting consequences
2507
  if (aView == mRootView) {
2508
    return rv;
2509
  }
2510
2458
  if (aAutoZIndex) {
2511
  if (aAutoZIndex) {
2459
    aZIndex = 0;
2512
    aZIndex = 0;
2460
  }
2513
  }
 Lines 2763-2769    Link Here 
2763
  mRootScrollable = aScrollable;
2816
  mRootScrollable = aScrollable;
2764
2817
2765
  //XXX this needs to go away when layout start setting this bit on it's own. MMP
2818
  //XXX this needs to go away when layout start setting this bit on it's own. MMP
2766
  if (mRootScrollable)
2819
  // We don't set ALWAYS_BLIT if this isn't the root of the view manager tree,
2820
  // because non-roots may not, in fact, always be able to blit
2821
  if (mRootScrollable && mRootView->GetParent() == nsnull)
2767
    mRootScrollable->SetScrollProperties(NS_SCROLL_PROPERTY_ALWAYS_BLIT);
2822
    mRootScrollable->SetScrollProperties(NS_SCROLL_PROPERTY_ALWAYS_BLIT);
2768
2823
2769
  return NS_OK;
2824
  return NS_OK;
 Lines 3373-3383    Link Here 
3373
3428
3374
    nest[nestcnt << 1] = 0;
3429
    nest[nestcnt << 1] = 0;
3375
3430
3376
    printf("%snsIView@%p{%d,%d,%d,%d @ %d,%d; p=%p, z=%d} [x=%d, y=%d, w=%d, h=%d, absX=%d, absY=%d]\n",
3431
    printf("%snsIView@%p{%d,%d,%d,%d @ %d,%d; p=%p,m=%p z=%d} [x=%d, y=%d, w=%d, h=%d, absX=%d, absY=%d]\n",
3377
           nest, (void*)view,
3432
           nest, (void*)view,
3378
           dim.x, dim.y, dim.width, dim.height,
3433
           dim.x, dim.y, dim.width, dim.height,
3379
           vx, vy,
3434
           vx, vy,
3380
           (void*)parent, zindex,
3435
           (void*)parent, (void*)view->GetViewManager(), zindex,
3381
           rect.x, rect.y, rect.width, rect.height,
3436
           rect.x, rect.y, rect.width, rect.height,
3382
           element->mAbsX, element->mAbsY);
3437
           element->mAbsX, element->mAbsY);
3383
3438
 Lines 3438-3444    Link Here 
3438
}
3493
}
3439
3494
3440
3495
3441
nsView* nsViewManager::GetWidgetView(nsView *aView) const
3496
nsView* nsViewManager::GetWidgetView(nsView *aView)
3442
{
3497
{
3443
  while (aView != nsnull) {
3498
  while (aView != nsnull) {
3444
    PRBool hasWidget;
3499
    PRBool hasWidget;
 Lines 3479-3485    Link Here 
3479
  nsIScrollableView* scrollingView;
3534
  nsIScrollableView* scrollingView;
3480
  GetRootScrollableView(&scrollingView);
3535
  GetRootScrollableView(&scrollingView);
3481
3536
3482
  if (scrollingView) {     
3537
  if (scrollingView) {   
3483
    // Determine the visible rect in the scrolled view's coordinate space.
3538
    // Determine the visible rect in the scrolled view's coordinate space.
3484
    // The size of the visible area is the clip view size
3539
    // The size of the visible area is the clip view size
3485
    const nsIView*  clipViewI;
3540
    const nsIView*  clipViewI;
 Lines 3651-3659    Link Here 
3651
3706
3652
  nsView *child = aView->GetFirstChild();
3707
  nsView *child = aView->GetFirstChild();
3653
  while (nsnull != child) {
3708
  while (nsnull != child) {
3654
    rv = ProcessWidgetChanges(child);
3709
    if (child->GetViewManager() == this) {
3655
    if (NS_FAILED(rv))
3710
      rv = ProcessWidgetChanges(child);
3656
      return rv;
3711
      if (NS_FAILED(rv))
3712
        return rv;
3713
    }
3657
3714
3658
    child = child->GetNextSibling();
3715
    child = child->GetNextSibling();
3659
  }
3716
  }
(-)view/src/nsViewManager.h (-1 / +1 lines)
Line     Link Here 
 Lines 309-315    Link Here 
309
   * Returns the nearest parent view with an attached widget. Can be the
309
   * Returns the nearest parent view with an attached widget. Can be the
310
   * same view as passed-in.
310
   * same view as passed-in.
311
   */
311
   */
312
  nsView* GetWidgetView(nsView *aView) const;
312
  static nsView* GetWidgetView(nsView *aView);
313
313
314
  /**
314
  /**
315
   * Transforms a rectangle from specified view's coordinate system to
315
   * Transforms a rectangle from specified view's coordinate system to

Return to bug 91516