Back out bug 594774 because of reftest failures and crashtest assertions

This commit is contained in:
Ehsan Akhgari 2010-09-15 12:28:29 -04:00
parent 4882abde52
commit 1a6476699d
12 changed files with 18 additions and 139 deletions

@ -44,7 +44,6 @@
#include "BasicLayers.h"
#include "nsSubDocumentFrame.h"
#include "nsCSSRendering.h"
#include "nsCSSFrameConstructor.h"
#ifdef DEBUG
#include <stdio.h>
@ -361,17 +360,6 @@ PRUint8 gLayerManagerUserData;
} // anonymous namespace
FrameLayerBuilder::FrameLayerBuilder() :
mRetainingManager(nsnull),
mDetectedDOMModification(PR_FALSE),
mInvalidateAllThebesContent(PR_FALSE),
mInvalidateAllLayers(PR_FALSE)
{
mNewDisplayItemData.Init();
mThebesLayerItems.Init();
mInitialDOMGeneration = nsCSSFrameConstructor::GetDOMGeneration();
}
PRBool
FrameLayerBuilder::DisplayItemDataEntry::HasContainerLayer()
{
@ -1552,10 +1540,6 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
{
nsDisplayListBuilder* builder = static_cast<nsDisplayListBuilder*>
(aCallbackData);
if (builder->LayerBuilder()->CheckDOMModified())
return;
nsTArray<ClippedDisplayItem> items;
nsIFrame* containerLayerFrame;
{
@ -1685,9 +1669,6 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
} else {
cdi->mItem->Paint(builder, rc);
}
if (builder->LayerBuilder()->CheckDOMModified())
break;
}
if (setClipRect) {
@ -1695,23 +1676,6 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
}
}
PRBool
FrameLayerBuilder::CheckDOMModified()
{
if (mInitialDOMGeneration == nsCSSFrameConstructor::GetDOMGeneration())
return PR_FALSE;
if (mDetectedDOMModification) {
// Don't spam the console with extra warnings
return PR_TRUE;
}
mDetectedDOMModification = PR_TRUE;
// Painting is not going to complete properly. There's not much
// we can do here though. Invalidating the window to get another repaint
// is likely to lead to an infinite repaint loop.
NS_WARNING("Detected DOM modification during paint, bailing out!");
return PR_TRUE;
}
#ifdef DEBUG
void
FrameLayerBuilder::DumpRetainedLayerTree()

@ -94,7 +94,14 @@ public:
typedef layers::ThebesLayer ThebesLayer;
typedef layers::LayerManager LayerManager;
FrameLayerBuilder();
FrameLayerBuilder() :
mRetainingManager(nsnull),
mInvalidateAllThebesContent(PR_FALSE),
mInvalidateAllLayers(PR_FALSE)
{
mNewDisplayItemData.Init();
mThebesLayerItems.Init();
}
/**
* Call this to notify that we are about to start a transaction on the
@ -402,13 +409,6 @@ protected:
static PLDHashOperator StoreNewDisplayItemData(DisplayItemDataEntry* aEntry,
void* aUserArg);
/**
* Returns true if the DOM has been modified since we started painting,
* in which case we should bail out and not paint anymore. This should
* never happen, but plugins can trigger it in some cases.
*/
PRBool CheckDOMModified();
/**
* The layer manager belonging to the widget that is being retained
* across paints.
@ -424,15 +424,6 @@ protected:
* clipping data) to be rendered in the layer.
*/
nsTHashtable<ThebesLayerItemsEntry> mThebesLayerItems;
/**
* Saved generation counter so we can detect DOM changes.
*/
PRUint32 mInitialDOMGeneration;
/**
* Set to true if we have detected and reported DOM modification during
* the current paint.
*/
PRPackedBool mDetectedDOMModification;
/**
* Indicates that the contents of all ThebesLayers should be rerendered
* during this paint.

@ -235,7 +235,6 @@ NS_NewSVGLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
// Global object maintenance
nsIXBLService * nsCSSFrameConstructor::gXBLService = nsnull;
PRUint32 nsCSSFrameConstructor::gDOMGeneration = 0;
#ifdef DEBUG
// Set the environment variable GECKO_FRAMECTOR_DEBUG_FLAGS to one or
@ -8189,7 +8188,6 @@ nsCSSFrameConstructor::BeginUpdate() {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a script blocker");
++gDOMGeneration;
++mUpdateCount;
}

@ -274,10 +274,6 @@ public:
// itself.
nsresult ProcessRestyledFrames(nsStyleChangeList& aRestyleArray);
// The DOMGeneration is updated every time we're notified of a DOM change
// that could cause frame construction or destruction
static PRUint32 GetDOMGeneration() { return gDOMGeneration; }
private:
friend class mozilla::css::RestyleTracker;
@ -1840,7 +1836,6 @@ private:
RestyleTracker mPendingAnimationRestyles;
static nsIXBLService * gXBLService;
static PRUint32 gDOMGeneration;
};
#endif /* nsCSSFrameConstructor_h___ */

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<script>
var doingTest = false;
function onPaint() {
if (!doingTest)
return;
var d = document.getElementById("d");
if (d) {
document.body.removeChild(d);
}
document.documentElement.removeAttribute("class");
}
function runTest() {
doingTest = true;
// Force a repaint of the entire page
document.body.style.backgroundColor = "lime";
}
window.addEventListener("MozReftestInvalidate", runTest, false);
</script>
</head>
<body>
<embed type="application/x-test" paintscript="onPaint()"
style="position:absolute; top:20px; left:20px; width:200px; height:200px;"></embed>
<div id="d" style="position:absolute; top:50px; left:50px; width:100px; height:100px">
Hello Kitty
</div>
</body>
</html>

@ -1,7 +1,7 @@
load 41276-1.html
load 48856-1.html
load 110650-1.html
load 522512-1.html
skip-if(cocoaWidget) script 539897-1.html
script 540114-1.html
load 570884.html

@ -130,13 +130,6 @@ with a boolean value, indicating whether the tests were successful.
NPN_PluginThreadAsyncCall. When finished, calls the script callback
with a boolean value, indicating whether the tests were successful.
* paintscript="..." content attribute
If the "paintscript" attribute is set on the plugin element during plugin
initialization, then every time the plugin paints it gets the contents of that
attribute and evaluates it as a script in the context of the plugin's DOM
window. This is useful for testing evil plugin code that might, for example,
modify the DOM during painting.
== Private browsing ==
The test plugin object supports the following scriptable methods:

@ -693,7 +693,6 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
instanceData->fileBuf = NULL;
instanceData->fileBufSize = 0;
instanceData->throwOnNextInvoke = false;
instanceData->runScriptOnPaint = false;
instanceData->testrange = NULL;
instanceData->hasWidget = false;
instanceData->npnNewStream = false;
@ -744,7 +743,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
requestWindow = true;
}
}
if (strcmp(argn[i], "streammode") == 0) {
if (strcmp(argn[i], "streammode") == 0) {
if (strcmp(argv[i], "normal") == 0) {
instanceData->streamMode = NP_NORMAL;
}
@ -758,7 +757,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
else if (strcmp(argv[i], "seek") == 0) {
instanceData->streamMode = NP_SEEK;
}
}
}
if (strcmp(argn[i], "streamchunksize") == 0) {
instanceData->streamChunkSize = atoi(argv[i]);
}
@ -812,9 +811,6 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
if (strcmp(argn[i], "newcrash") == 0) {
IntentionalCrash();
}
if (strcmp(argn[i], "paintscript") == 0) {
instanceData->runScriptOnPaint = true;
}
// "cleanupwidget" is only used with nptest_gtk, defaulting to true. It
// indicates whether the plugin should destroy its window in response to
// NPP_Destroy (or let the platform destroy the widget when the parent
@ -2394,33 +2390,6 @@ void notifyDidPaint(InstanceData* instanceData)
r.bottom = instanceData->window.height;
NPN_InvalidateRect(instanceData->npp, &r);
}
if (instanceData->runScriptOnPaint) {
NPObject* o = NULL;
NPN_GetValue(instanceData->npp, NPNVPluginElementNPObject, &o);
if (o) {
NPVariant param;
STRINGZ_TO_NPVARIANT("paintscript", param);
NPVariant result;
NPN_Invoke(instanceData->npp, o, NPN_GetStringIdentifier("getAttribute"),
&param, 1, &result);
if (NPVARIANT_IS_STRING(result)) {
NPObject* windowObject;
NPN_GetValue(instanceData->npp, NPNVWindowNPObject, &windowObject);
if (windowObject) {
NPVariant evalResult;
NPN_Evaluate(instanceData->npp, windowObject,
(NPString*)&NPVARIANT_TO_STRING(result), &evalResult);
NPN_ReleaseVariantValue(&evalResult);
NPN_ReleaseObject(windowObject);
}
}
NPN_ReleaseVariantValue(&result);
NPN_ReleaseObject(o);
}
}
}
static const NPClass kTestSharedNPClass = {

@ -99,7 +99,6 @@ typedef struct InstanceData {
bool hasWidget;
bool npnNewStream;
bool throwOnNextInvoke;
bool runScriptOnPaint;
uint32_t timerID[2];
bool timerTestResult;
bool asyncCallbackResult;

@ -165,14 +165,13 @@ pluginDrawWindow(InstanceData* instanceData, GdkDrawable* gdkWindow,
int y = instanceData->hasWidget ? 0 : window.y;
int width = window.width;
int height = window.height;
notifyDidPaint(instanceData);
if (instanceData->scriptableObject->drawMode == DM_SOLID_COLOR) {
// drawing a solid color for reftests
pluginDrawSolid(instanceData, gdkWindow,
invalidRect.x, invalidRect.y,
invalidRect.width, invalidRect.height);
notifyDidPaint(instanceData);
return;
}
@ -218,6 +217,8 @@ pluginDrawWindow(InstanceData* instanceData, GdkDrawable* gdkWindow,
g_object_unref(pangoTextLayout);
g_object_unref(gdkContext);
notifyDidPaint(instanceData);
}
static gboolean

@ -139,8 +139,6 @@ pluginDraw(InstanceData* instanceData, NPCocoaEvent* event)
if (!instanceData)
return;
notifyDidPaint(instanceData);
NPP npp = instanceData->npp;
if (!npp)
return;
@ -243,6 +241,8 @@ pluginDraw(InstanceData* instanceData, NPCocoaEvent* event)
break;
}
}
notifyDidPaint(instanceData);
}
int16_t

@ -202,8 +202,6 @@ pluginDraw(InstanceData* instanceData)
HDC hdc = NULL;
PAINTSTRUCT ps;
notifyDidPaint(instanceData);
if (instanceData->hasWidget)
hdc = ::BeginPaint((HWND)instanceData->window.window, &ps);
else
@ -229,6 +227,8 @@ pluginDraw(InstanceData* instanceData)
if (instanceData->hasWidget)
::EndPaint((HWND)instanceData->window.window, &ps);
notifyDidPaint(instanceData);
}
/* script interface */