Backout 564144b09c4b, 049ba0a8823f, 608feeb4539c, d2e6a61338cc (Bug 695275) to investigate Android Crashtests permaorange.

This commit is contained in:
Marco Bonardo 2011-10-21 14:19:22 +02:00
parent 961b15bdb6
commit 5eb5a7a0aa
10 changed files with 12 additions and 131 deletions

View File

@ -1941,24 +1941,3 @@ nsDOMWindowUtils::GetMayHaveTouchEventListeners(bool* aResult)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsDOMWindowUtils::CheckAndClearPaintedState(nsIDOMElement* aElement, bool* aResult)
{
if (!aElement) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsIFrame* frame = content->GetPrimaryFrame();
if (!frame) {
*aResult = false;
return NS_OK;
}
*aResult = frame->CheckAndClearPaintedState();
return NS_OK;
}

View File

@ -68,7 +68,7 @@ interface nsIDOMWindow;
interface nsIDOMFile; interface nsIDOMFile;
interface nsIFile; interface nsIFile;
[scriptable, uuid(910484d7-219c-4c72-b999-7a7e9c954646)] [scriptable, uuid(bc6c156a-c41f-43dd-ace3-e3bca9894ed1)]
interface nsIDOMWindowUtils : nsISupports { interface nsIDOMWindowUtils : nsISupports {
/** /**
@ -919,11 +919,4 @@ interface nsIDOMWindowUtils : nsISupports {
* true if the (current inner) window may have event listeners for touch events. * true if the (current inner) window may have event listeners for touch events.
*/ */
readonly attribute boolean mayHaveTouchEventListeners; readonly attribute boolean mayHaveTouchEventListeners;
/**
* Check if any ThebesLayer painting has been done for this element,
* clears the painted flags if they have.
*/
boolean checkAndClearPaintedState(in nsIDOMElement aElement);
}; };

View File

@ -970,12 +970,6 @@ ContainerState::PopThebesLayerData()
nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer(); nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer();
imageLayer->SetContainer(imageContainer); imageLayer->SetContainer(imageContainer);
data->mImage->ConfigureLayer(imageLayer); data->mImage->ConfigureLayer(imageLayer);
if (mParameters.mInActiveTransformedSubtree) {
// The layer's current transform is applied first, then the result is scaled.
gfx3DMatrix transform = imageLayer->GetTransform()*
gfx3DMatrix::ScalingMatrix(mParameters.mXScale, mParameters.mYScale, 1.0f);
imageLayer->SetTransform(transform);
}
NS_ASSERTION(data->mImageClip.mRoundedClipRects.IsEmpty(), NS_ASSERTION(data->mImageClip.mRoundedClipRects.IsEmpty(),
"How did we get rounded clip rects here?"); "How did we get rounded clip rects here?");
if (data->mImageClip.mHaveClipRect) { if (data->mImageClip.mHaveClipRect) {
@ -1130,17 +1124,6 @@ ContainerState::ThebesLayerData::Accumulate(ContainerState* aState,
{ {
nscolor uniformColor; nscolor uniformColor;
bool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor); bool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor);
/* Mark as available for conversion to image layer if this is a nsDisplayImage and
* we are the first visible item in the ThebesLayerData object.
*/
if (aItem->GetType() == nsDisplayItem::TYPE_IMAGE && mVisibleRegion.IsEmpty()) {
mImage = static_cast<nsDisplayImage*>(aItem);
mImageClip = aClip;
} else {
mImage = nsnull;
}
// Some display items have to exist (so they can set forceTransparentSurface // Some display items have to exist (so they can set forceTransparentSurface
// below) but don't draw anything. They'll return true for isUniform but // below) but don't draw anything. They'll return true for isUniform but
// a color with opacity 0. // a color with opacity 0.
@ -1169,6 +1152,16 @@ ContainerState::ThebesLayerData::Accumulate(ContainerState* aState,
mDrawRegion.Or(mDrawRegion, aDrawRect); mDrawRegion.Or(mDrawRegion, aDrawRect);
mDrawRegion.SimplifyOutward(4); mDrawRegion.SimplifyOutward(4);
} }
/* Mark as available for conversion to image layer if this is a nsDisplayImage and
* we are the first visible item in the ThebesLayerData object.
*/
if (aItem->GetType() == nsDisplayItem::TYPE_IMAGE && mVisibleRegion.IsEmpty()) {
mImage = static_cast<nsDisplayImage*>(aItem);
mImageClip = aClip;
} else {
mImage = nsnull;
}
bool forceTransparentSurface = false; bool forceTransparentSurface = false;
nsRegion opaque = aItem->GetOpaqueRegion(aState->mBuilder, &forceTransparentSurface); nsRegion opaque = aItem->GetOpaqueRegion(aState->mBuilder, &forceTransparentSurface);
@ -2113,10 +2106,6 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
if (cdi->mInactiveLayer) { if (cdi->mInactiveLayer) {
PaintInactiveLayer(builder, cdi->mItem, aContext); PaintInactiveLayer(builder, cdi->mItem, aContext);
} else { } else {
nsIFrame* frame = cdi->mItem->GetUnderlyingFrame();
if (frame) {
frame->AddStateBits(NS_FRAME_PAINTED_THEBES);
}
cdi->mItem->Paint(builder, rc); cdi->mItem->Paint(builder, rc);
} }

View File

@ -65,9 +65,6 @@ _TEST_FILES = \
border_radius_hit_testing_iframe.html \ border_radius_hit_testing_iframe.html \
test_preserve3d_sorting_hit_testing.html \ test_preserve3d_sorting_hit_testing.html \
preserve3d_sorting_hit_testing_iframe.html \ preserve3d_sorting_hit_testing_iframe.html \
test_image_layers.html \
image_rgrg-256x256.png \
image_rrgg-256x256.png \
bug369950-subframe.xml \ bug369950-subframe.xml \
decoration_line_rendering.js \ decoration_line_rendering.js \
test_after_paint_pref.html \ test_after_paint_pref.html \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

View File

@ -1,46 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test that images that are the only item in ThebesLayers get put into ImageLayers</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="changeImage()">
<div>
<img id="image" src="./image_rgrg-256x256.png" style="-moz-transform: translatex(1px)"></img>
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var image = document.getElementById("image");
var lastPaintCount;
function changeImage() {
lastPaintCount = window.mozPaintCount;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.checkAndClearPaintedState(image);
image.src = "./image_rrgg-256x256.png";
checkDone();
}
function checkDone() {
if (window.mozPaintCount == lastPaintCount) {
setTimeout(checkDone, 30);
return;
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
ok(!utils.checkAndClearPaintedState(image), "Should not paint any thebes layers for our image!");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -282,25 +282,6 @@ nsIFrame::MarkAsAbsoluteContainingBlock() {
Properties().Set(AbsoluteContainingBlockProperty(), new nsAbsoluteContainingBlock(GetAbsoluteListID())); Properties().Set(AbsoluteContainingBlockProperty(), new nsAbsoluteContainingBlock(GetAbsoluteListID()));
} }
bool
nsIFrame::CheckAndClearPaintedState()
{
bool result = (GetStateBits() & NS_FRAME_PAINTED_THEBES);
RemoveStateBits(NS_FRAME_PAINTED_THEBES);
nsIFrame::ChildListIterator lists(this);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
if (child->CheckAndClearPaintedState()) {
result = true;
}
}
}
return result;
}
static bool ApplyOverflowClipping(nsDisplayListBuilder* aBuilder, static bool ApplyOverflowClipping(nsDisplayListBuilder* aBuilder,
const nsIFrame* aFrame, const nsIFrame* aFrame,
const nsStyleDisplay* aDisp, const nsStyleDisplay* aDisp,

View File

@ -290,9 +290,6 @@ typedef PRUint64 nsFrameState;
// Frame can accept absolutely positioned children. // Frame can accept absolutely positioned children.
#define NS_FRAME_HAS_ABSPOS_CHILDREN NS_FRAME_STATE_BIT(37) #define NS_FRAME_HAS_ABSPOS_CHILDREN NS_FRAME_STATE_BIT(37)
// A display item for this frame has been painted as part of a ThebesLayer.
#define NS_FRAME_PAINTED_THEBES NS_FRAME_STATE_BIT(38)
// The lower 20 bits and upper 32 bits of the frame state are reserved // The lower 20 bits and upper 32 bits of the frame state are reserved
// by this API. // by this API.
#define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED #define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
@ -2756,10 +2753,6 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::EmbeddingLevelProperty()))
// Child frame types override this function to select their own child list name // Child frame types override this function to select their own child list name
virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const { return kAbsoluteList; } virtual mozilla::layout::FrameChildListID GetAbsoluteListID() const { return kAbsoluteList; }
// Checks if we (or any of our descendents) have NS_FRAME_PAINTED_THEBES set, and
// clears this bit if so.
bool CheckAndClearPaintedState();
protected: protected:
// Members // Members
nsRect mRect; nsRect mRect;

View File

@ -544,7 +544,6 @@ nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage)
*/ */
nsPresContext *presContext = PresContext(); nsPresContext *presContext = PresContext();
aImage->SetAnimationMode(presContext->ImageAnimationMode()); aImage->SetAnimationMode(presContext->ImageAnimationMode());
mImageContainer = nsnull;
if (IsPendingLoad(aRequest)) { if (IsPendingLoad(aRequest)) {
// We don't care // We don't care
@ -622,7 +621,6 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest,
nsPresContext *presContext = PresContext(); nsPresContext *presContext = PresContext();
nsIPresShell *presShell = presContext->GetPresShell(); nsIPresShell *presShell = presContext->GetPresShell();
NS_ASSERTION(presShell, "No PresShell."); NS_ASSERTION(presShell, "No PresShell.");
mImageContainer = nsnull;
// Check what request type we're dealing with // Check what request type we're dealing with
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent); nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
@ -1239,10 +1237,7 @@ nsDisplayImage::ConfigureLayer(ImageLayer* aLayer)
nsRefPtr<ImageContainer> nsRefPtr<ImageContainer>
nsImageFrame::GetContainer(LayerManager* aManager, imgIContainer* aImage) nsImageFrame::GetContainer(LayerManager* aManager, imgIContainer* aImage)
{ {
if (mImageContainer && if (mImageContainer && mImageContainer->Manager() == aManager) {
(mImageContainer->Manager() == aManager ||
(!mImageContainer->Manager() &&
(mImageContainer->GetBackendType() == aManager->GetBackendType())))) {
return mImageContainer; return mImageContainer;
} }