|
|
|
|
| 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 |
*/ |
|
|
| 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; |
|
|
| 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; |
|
|
| 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? |
|
|
| 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 |
|
|
|
| 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 |
} |
|
|
| 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 |
} |
|
|
| 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; |
|
|
| 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 |
} |
|
|
| 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 |
} |
|
|
| 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); |
|
|
| 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; |
|
|
| 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 |
|
|
|
| 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 |
} |
|
|
| 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; |
|
|
| 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 |
|
|
|
| 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; |
|
|
| 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; |
|
|
| 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 |
} |