Back out eb80ab6ee07b (bug 721627) and 06d02e7132b2 (bug 721294) for orange and red

This commit is contained in:
Phil Ringnalda 2012-01-27 20:31:29 -08:00
Родитель 3c919a6380
Коммит a620ddc416
8 изменённых файлов: 67 добавлений и 45 удалений

Просмотреть файл

@ -219,7 +219,7 @@ protected:
* supports being optimized to an ImageLayer (TYPE_RASTER only) returns
* an ImageContainer for the image.
*/
already_AddRefed<ImageContainer> CanOptimizeImageLayer(LayerManager* aManager);
nsRefPtr<ImageContainer> CanOptimizeImageLayer(LayerManager* aManager);
/**
* The region of visible content in the layer, relative to the
@ -968,7 +968,7 @@ ContainerState::FindOpaqueBackgroundColorFor(PRInt32 aThebesLayerIndex)
return NS_RGBA(0,0,0,0);
}
already_AddRefed<ImageContainer>
nsRefPtr<ImageContainer>
ContainerState::ThebesLayerData::CanOptimizeImageLayer(LayerManager* aManager)
{
if (!mImage || !mImageClip.mRoundedClipRects.IsEmpty()) {

Просмотреть файл

@ -143,8 +143,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0x87acd089, 0x8da7, 0x4438, \
{ 0xa5, 0xcd, 0x90, 0x1e, 0x5d, 0x8f, 0xd8, 0x19 } }
{ 0x3ab5b116, 0x2d73, 0x431c, \
{ 0x9a, 0x4b, 0x6c, 0x91, 0x9e, 0x42, 0x45, 0xc3 } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -1145,21 +1145,13 @@ public:
virtual void Paint(nsIView* aViewToPaint, nsIWidget* aWidget,
const nsRegion& aDirtyRegion, const nsIntRegion& aIntDirtyRegion,
bool aWillSendDidPaint) = 0;
bool aPaintDefaultBackground, bool aWillSendDidPaint) = 0;
virtual nsresult HandleEvent(nsIFrame* aFrame,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus) = 0;
virtual bool ShouldIgnoreInvalidation() = 0;
/**
* Notify that the NS_WILL_PAINT event was received. Fires on every
* visible presshell in the document tree.
*/
virtual void WillPaint(bool aWillSendDidPaint) = 0;
/**
* Notify that the NS_DID_PAINT event was received. Only fires on the
* root pres shell.
*/
virtual void DidPaint() = 0;
virtual void ScheduleViewManagerFlush() = 0;
virtual void ClearMouseCaptureOnView(nsIView* aView) = 0;

Просмотреть файл

@ -5427,6 +5427,7 @@ PresShell::Paint(nsIView* aViewToPaint,
nsIWidget* aWidgetToPaint,
const nsRegion& aDirtyRegion,
const nsIntRegion& aIntDirtyRegion,
bool aPaintDefaultBackground,
bool aWillSendDidPaint)
{
#ifdef NS_FUNCTION_TIMER
@ -5448,7 +5449,7 @@ PresShell::Paint(nsIView* aViewToPaint,
nsPresContext* presContext = GetPresContext();
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
nsIFrame* frame = aViewToPaint->GetFrame();
nsIFrame* frame = aPaintDefaultBackground ? nsnull : aViewToPaint->GetFrame();
bool isRetainingManager;
LayerManager* layerManager =
@ -5487,6 +5488,9 @@ PresShell::Paint(nsIView* aViewToPaint,
frame->BeginDeferringInvalidatesForDisplayRoot(aDirtyRegion);
// We can paint directly into the widget using its layer manager.
// When we get rid of child widgets, this will be the only path we
// need. (aPaintDefaultBackground will never be needed since the
// chrome can always paint a default background.)
nsLayoutUtils::PaintFrame(nsnull, frame, aDirtyRegion, bgcolor,
nsLayoutUtils::PAINT_WIDGET_LAYERS |
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
@ -7204,11 +7208,10 @@ PresShell::DidPaint()
return;
}
NS_ASSERTION(mPresContext->IsRoot(), "Should only call DidPaint on root presshells");
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
// This should only be called on root presshells, but maybe if a document
// tree is torn down we might not be a root presshell...
if (!rootPresContext) {
return;
}
if (rootPresContext == mPresContext) {
rootPresContext->UpdatePluginGeometry();
}

Просмотреть файл

@ -316,7 +316,7 @@ public:
virtual void Paint(nsIView* aViewToPaint, nsIWidget* aWidget,
const nsRegion& aDirtyRegion, const nsIntRegion& aIntDirtyRegion,
bool aWillSendDidPaint);
bool aPaintDefaultBackground, bool aWillSendDidPaint);
virtual nsresult HandleEvent(nsIFrame* aFrame,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,

Просмотреть файл

@ -1210,13 +1210,19 @@ nsDisplayImage::Paint(nsDisplayListBuilder* aBuilder,
: (PRUint32) imgIContainer::FLAG_NONE);
}
already_AddRefed<ImageContainer>
nsCOMPtr<imgIContainer>
nsDisplayImage::GetImage()
{
return mImage;
}
nsRefPtr<ImageContainer>
nsDisplayImage::GetContainer(LayerManager* aManager)
{
nsRefPtr<ImageContainer> container;
nsresult rv = mImage->GetImageContainer(aManager, getter_AddRefs(container));
NS_ENSURE_SUCCESS(rv, nsnull);
return container.forget();
ImageContainer* container;
nsresult rv = mImage->GetImageContainer(aManager, &container);
NS_ENSURE_SUCCESS(rv, NULL);
return container;
}
void

Просмотреть файл

@ -386,12 +386,13 @@ public:
}
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx);
nsCOMPtr<imgIContainer> GetImage();
/**
* Returns an ImageContainer for this image if the image type
* supports it (TYPE_RASTER only).
*/
already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager);
nsRefPtr<ImageContainer> GetContainer(LayerManager* aManager);
/**
* Configure an ImageLayer for this display item.

Просмотреть файл

@ -337,8 +337,7 @@ nsIView* nsIViewManager::GetDisplayRootFor(nsIView* aView)
rendering.
*/
void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
const nsIntRegion& aRegion,
bool aWillSendDidPaint)
const nsIntRegion& aRegion)
{
NS_ASSERTION(aView == nsView::GetViewFor(aWidget), "view widget mismatch");
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
@ -369,14 +368,7 @@ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
nsAutoScriptBlocker scriptBlocker;
SetPainting(true);
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
"Widgets that we paint must all be display roots");
if (mPresShell) {
mPresShell->Paint(aView, aWidget, damageRegion, aRegion,
aWillSendDidPaint);
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
}
RenderViews(aView, aWidget, damageRegion, aRegion, false, false);
SetPainting(false);
}
@ -387,6 +379,23 @@ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
}
}
// aRC and aRegion are in view coordinates
void nsViewManager::RenderViews(nsView *aView, nsIWidget *aWidget,
const nsRegion& aRegion,
const nsIntRegion& aIntRegion,
bool aPaintDefaultBackground,
bool aWillSendDidPaint)
{
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
"Widgets that we paint must all be display roots");
if (mPresShell) {
mPresShell->Paint(aView, aWidget, aRegion, aIntRegion,
aPaintDefaultBackground, aWillSendDidPaint);
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
}
}
void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
bool aFlushDirtyRegion)
{
@ -810,14 +819,14 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
break;
// Paint.
Refresh(view, event->widget, event->region, event->willSendDidPaint);
Refresh(view, event->widget, event->region);
break;
}
case NS_DID_PAINT: {
nsRefPtr<nsViewManager> rootVM = RootViewManager();
rootVM->CallDidPaintOnObserver();
rootVM->CallDidPaintOnObservers();
break;
}
@ -1388,14 +1397,21 @@ nsViewManager::CallWillPaintOnObservers(bool aWillSendDidPaint)
}
void
nsViewManager::CallDidPaintOnObserver()
nsViewManager::CallDidPaintOnObservers()
{
NS_PRECONDITION(IsRootVM(), "Must be root VM for this to be called!");
if (mRootView && mRootView->IsEffectivelyVisible()) {
nsCOMPtr<nsIPresShell> shell = GetPresShell();
if (shell) {
shell->DidPaint();
PRInt32 index;
for (index = 0; index < mVMCount; index++) {
nsViewManager* vm = (nsViewManager*)gViewManagers->ElementAt(index);
if (vm->RootViewManager() == this) {
// One of our kids.
if (vm->mRootView && vm->mRootView->IsEffectivelyVisible()) {
nsCOMPtr<nsIPresShell> shell = vm->GetPresShell();
if (shell) {
shell->DidPaint();
}
}
}
}
}

Просмотреть файл

@ -153,7 +153,7 @@ private:
* Call WillPaint() on all view observers under this vm root.
*/
void CallWillPaintOnObservers(bool aWillSendDidPaint);
void CallDidPaintOnObserver();
void CallDidPaintOnObservers();
void ReparentChildWidgets(nsIView* aView, nsIWidget *aNewWidget);
void ReparentWidgets(nsIView* aView, nsIView *aParent);
void InvalidateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedRegion);
@ -161,8 +161,12 @@ private:
void InvalidateViews(nsView *aView);
// aView is the view for aWidget and aRegion is relative to aWidget.
void Refresh(nsView *aView, nsIWidget *aWidget, const nsIntRegion& aRegion,
bool aWillSendDidPaint);
void Refresh(nsView *aView, nsIWidget *aWidget, const nsIntRegion& aRegion);
// aRootView is the view for aWidget, aRegion is relative to aRootView, and
// aIntRegion is relative to aWidget.
void RenderViews(nsView *aRootView, nsIWidget *aWidget,
const nsRegion& aRegion, const nsIntRegion& aIntRegion,
bool aPaintDefaultBackground, bool aWillSendDidPaint);
void InvalidateRectDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut);
void InvalidateHorizontalBandDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut,