b=433086, improve nsDOMWindowUtils::Redraw; r+sr=roc

This commit is contained in:
Vladimir Vukicevic 2008-06-03 17:00:37 -07:00
Родитель 35bb6388f9
Коммит 919ab99fb8
3 изменённых файлов: 28 добавлений и 7 удалений

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

@ -47,7 +47,7 @@
interface nsIDOMElement;
[scriptable, uuid(1cfc1a0a-e348-4b18-b61b-935c192f85c4)]
[scriptable, uuid(993da427-2ac3-4766-8485-21a236d258e4)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -87,9 +87,12 @@ interface nsIDOMWindowUtils : nsISupports {
AString getDocumentMetadata(in AString aName);
/**
* Force an immediate redraw of this window.
* Force an immediate redraw of this window. The parameter specifies
* the number of times to redraw, and the return value is the length,
* in milliseconds, that the redraws took. If aCount is not specified
* or is 0, it is taken to be 1.
*/
void redraw();
unsigned long redraw([optional] in unsigned long aCount);
/** Synthesize a mouse event for a window. The event types supported
* are:

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

@ -145,3 +145,10 @@ DEFINES += -DMOZ_JSDEBUGGER
endif
include $(topsrcdir)/config/rules.mk
ifdef MOZ_X11
ifdef MOZ_ENABLE_GTK2
CXXFLAGS += $(TK_CFLAGS)
LDFLAGS += $(TK_LIBS)
endif
endif

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

@ -55,7 +55,8 @@
#include "nsIParser.h"
#include "nsJSEnvironment.h"
#ifdef MOZ_ENABLE_GTK2
#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK2)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#endif
@ -154,10 +155,13 @@ nsDOMWindowUtils::GetDocumentMetadata(const nsAString& aName,
}
NS_IMETHODIMP
nsDOMWindowUtils::Redraw()
nsDOMWindowUtils::Redraw(PRUint32 aCount, PRUint32 *aDurationOut)
{
nsresult rv;
if (aCount == 0)
aCount = 1;
nsCOMPtr<nsIDocShell> docShell = mWindow->GetDocShell();
if (docShell) {
nsCOMPtr<nsIPresShell> presShell;
@ -168,11 +172,18 @@ nsDOMWindowUtils::Redraw()
if (rootFrame) {
nsRect r(nsPoint(0, 0), rootFrame->GetSize());
rootFrame->Invalidate(r, PR_TRUE);
#ifdef MOZ_ENABLE_GTK2
PRIntervalTime iStart = PR_IntervalNow();
for (PRUint32 i = 0; i < aCount; i++)
rootFrame->Invalidate(r, PR_TRUE);
#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK2)
XSync(GDK_DISPLAY(), False);
#endif
*aDurationOut = PR_IntervalToMilliseconds(PR_IntervalNow() - iStart);
return NS_OK;
}
}