jaegermonkey. what. a=arewefastyet

This commit is contained in:
Robert Sayre 2010-09-11 15:07:27 -04:00
commit 251b81a19e
14 changed files with 107 additions and 75 deletions

View File

@ -343,6 +343,7 @@ user_pref("shell.checkDefaultClient", false);
user_pref("browser.warnOnQuit", false);
user_pref("accessibility.typeaheadfind.autostart", false);
user_pref("javascript.options.showInConsole", true);
user_pref("devtools.errorconsole.enabled", true);
user_pref("layout.debug.enable_data_xbl", true);
user_pref("browser.EULA.override", true);
user_pref("javascript.options.tracejit.content", true);

View File

@ -1850,6 +1850,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
// change the principals of a document for security reasons we'll have to
// refuse to go ahead with this call.
NS_WARNING("No caller doc for open call.");
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1869,6 +1870,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
PRBool equals = PR_FALSE;
if (NS_FAILED(callerPrincipal->Equals(NodePrincipal(), &equals)) ||
!equals) {
NS_WARNING("Principals unequal for open call.");
return NS_ERROR_DOM_SECURITY_ERR;
}

View File

@ -6484,9 +6484,7 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
// hook 'em up
if (viewer) {
viewer->SetContainer(static_cast<nsIContentViewerContainer *>(this));
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(blankDoc));
Embed(viewer, "", 0);
viewer->SetDOMDocument(domdoc);
SetCurrentURI(blankDoc->GetDocumentURI(), nsnull, PR_TRUE);
rv = mIsBeingDestroyed ? NS_ERROR_NOT_AVAILABLE : NS_OK;

View File

@ -7932,9 +7932,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
didInvalidate = PR_TRUE;
}
if (hint & nsChangeHint_UpdateCursor) {
nsIViewManager* viewMgr = mPresShell->GetViewManager();
if (viewMgr)
viewMgr->SynthesizeMouseMove(PR_FALSE);
mPresShell->SynthesizeMouseMove(PR_FALSE);
}
}
}

View File

@ -213,6 +213,10 @@ public:
* so that methods like GetFrameForPoint work when painting is suppressed.
*/
void IgnorePaintSuppression() { mIgnoreSuppression = PR_TRUE; }
/**
* @return Returns if this builder will ignore paint suppression.
*/
PRBool IsIgnoringPaintSuppression() { return mIgnoreSuppression; }
/**
* @return Returns if this builder had to ignore painting suppression on some
* document when building the display list.

View File

@ -139,8 +139,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0xe63a350c, 0x4e04, 0x4056, \
{ 0x8d, 0xa0, 0x51, 0xcc, 0x55, 0x68, 0x68, 0x42 } }
{ 0x28d10cd2, 0x90a9, 0x4416, \
{ 0x8e, 0x88, 0x2a, 0xe3, 0x3d, 0xb1, 0x73, 0xd4 } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -1053,6 +1053,13 @@ public:
*/
virtual LayerManager* GetLayerManager() = 0;
/**
* Dispatch a mouse move event based on the most recent mouse position if
* this PresShell is visible. This is used when the contents of the page
* moved (aFromScroll is false) or scrolled (aFromScroll is true).
*/
virtual void SynthesizeMouseMove(PRBool aFromScroll) = 0;
/**
* Refresh observer management.
*/

View File

@ -2392,6 +2392,33 @@ nsPresContext::CheckForInterrupt(nsIFrame* aFrame)
return mHasPendingInterrupt;
}
PRBool
nsPresContext::IsRootContentDocument()
{
// We are a root content document if: we are not chrome, we are a
// subdocument, and our parent is chrome.
if (IsChrome()) {
return PR_FALSE;
}
// We may not have a root frame, so use views.
nsIViewManager* vm = PresShell()->GetViewManager();
nsIView* view = nsnull;
if (NS_FAILED(vm->GetRootView(view)) || !view) {
return PR_FALSE;
}
view = view->GetParent(); // anonymous inner view
if (!view) {
return PR_FALSE;
}
view = view->GetParent(); // subdocumentframe's view
if (!view) {
return PR_FALSE;
}
nsIFrame* f = static_cast<nsIFrame*>(view->GetClientData());
return (f && f->PresContext()->IsChrome());
}
nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
nsPresContextType aType)
: nsPresContext(aDocument, aType),

View File

@ -983,6 +983,8 @@ public:
return result;
}
PRBool IsRootContentDocument();
protected:
friend class nsRunnableMethod<nsPresContext>;
NS_HIDDEN_(void) ThemeChangedInternal();

View File

@ -815,6 +815,8 @@ public:
virtual LayerManager* GetLayerManager();
virtual void SynthesizeMouseMove(PRBool aFromScroll);
//nsIViewObserver interface
NS_IMETHOD Paint(nsIView* aDisplayRoot,
@ -834,7 +836,6 @@ public:
nsIDOMEvent* aEvent,
nsEventStatus* aStatus);
NS_IMETHOD ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight);
NS_IMETHOD_(PRBool) IsVisible();
NS_IMETHOD_(PRBool) ShouldIgnoreInvalidation();
NS_IMETHOD_(void) WillPaint(PRBool aWillSendDidPaint);
NS_IMETHOD_(void) DidPaint();
@ -4558,8 +4559,8 @@ PresShell::UnsuppressAndInvalidate()
if (win)
win->SetReadyForFocus();
if (!mHaveShutDown && mViewManager)
mViewManager->SynthesizeMouseMove(PR_FALSE);
if (!mHaveShutDown)
SynthesizeMouseMove(PR_FALSE);
}
void
@ -5813,8 +5814,7 @@ void PresShell::UpdateCanvasBackground()
mCanvasBackgroundColor =
nsCSSRendering::DetermineBackgroundColor(mPresContext, bgStyle,
rootStyleFrame);
if (nsLayoutUtils::GetCrossDocParentFrame(FrameManager()->GetRootFrame()) &&
!nsContentUtils::IsChildOfSameType(mDocument) &&
if (GetPresContext()->IsRootContentDocument() &&
!IsTransparentContainerElement(mPresContext)) {
mCanvasBackgroundColor =
NS_ComposeColors(mPresContext->DefaultBackgroundColor(), mCanvasBackgroundColor);
@ -5863,6 +5863,13 @@ LayerManager* PresShell::GetLayerManager()
return nsnull;
}
void PresShell::SynthesizeMouseMove(PRBool aFromScroll)
{
if (mViewManager && !mPaintingSuppressed && mIsActive) {
mViewManager->SynthesizeMouseMove(aFromScroll);
}
}
static void DrawThebesLayer(ThebesLayer* aLayer,
gfxContext* aContext,
const nsIntRegion& aRegionToDraw,
@ -7182,18 +7189,6 @@ PresShell::ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight)
return ResizeReflow(aWidth, aHeight);
}
NS_IMETHODIMP_(PRBool)
PresShell::IsVisible()
{
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
nsCOMPtr<nsIBaseWindow> bw = do_QueryInterface(container);
if (!bw)
return PR_FALSE;
PRBool res = PR_TRUE;
bw->GetVisibility(&res);
return res;
}
NS_IMETHODIMP_(PRBool)
PresShell::ShouldIgnoreInvalidation()
{
@ -7203,9 +7198,9 @@ PresShell::ShouldIgnoreInvalidation()
NS_IMETHODIMP_(void)
PresShell::WillPaint(PRBool aWillSendDidPaint)
{
// Don't bother doing anything if some viewmanager in our tree is
// painting while we still have painting suppressed.
if (mPaintingSuppressed) {
// Don't bother doing anything if some viewmanager in our tree is painting
// while we still have painting suppressed or we are not active.
if (mPaintingSuppressed || !mIsActive) {
return;
}
@ -7374,8 +7369,6 @@ PresShell::Thaw()
if (mDocument)
mDocument->EnumerateSubDocuments(ThawSubDocument, nsnull);
UnsuppressPainting();
// Get the activeness of our presshell, as this might have changed
// while we were in the bfcache
QueryIsActive();
@ -7383,6 +7376,8 @@ PresShell::Thaw()
// We're now unfrozen
mFrozen = PR_FALSE;
UpdateImageLockingState();
UnsuppressPainting();
}
//--------------------------------------------------------
@ -7448,10 +7443,7 @@ PresShell::DidDoReflow(PRBool aInterruptible)
mFrameConstructor->EndUpdate();
HandlePostedReflowCallbacks(aInterruptible);
// Null-check mViewManager in case this happens during Destroy. See
// bugs 244435 and 238546.
if (!mPaintingSuppressed && mViewManager)
mViewManager->SynthesizeMouseMove(PR_FALSE);
SynthesizeMouseMove(PR_FALSE);
if (mCaret) {
// Update the caret's position now to account for any changes created by
// the reflow.

View File

@ -1580,8 +1580,7 @@ PRBool nsGfxScrollFrameInner::IsAlwaysActive() const
// child of a chrome document is always treated as "active".
// XXX maybe we should extend this so that IFRAMEs which are fill the
// entire viewport (like GMail!) are always active
return mIsRoot &&
!nsContentUtils::IsChildOfSameType(mOuter->GetContent()->GetCurrentDoc());
return mIsRoot && mOuter->PresContext()->IsRootContentDocument();
}
PRBool nsGfxScrollFrameInner::IsScrollingActive() const
@ -1697,7 +1696,7 @@ nsGfxScrollFrameInner::ScrollToImpl(nsPoint aPt)
// We pass in the amount to move visually
ScrollVisual(curPosDevPx - ptDevPx);
presContext->PresShell()->GetViewManager()->SynthesizeMouseMove(PR_TRUE);
presContext->PresShell()->SynthesizeMouseMove(PR_TRUE);
UpdateScrollbarPosition();
PostScrollEvent();
@ -1754,7 +1753,7 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// that's much larger than necessary. Creating independent layers for each
// scrollbar works around the problem.
PRBool createLayersForScrollbars = mIsRoot &&
!nsContentUtils::IsChildOfSameType(mOuter->GetContent()->GetCurrentDoc());
mOuter->PresContext()->IsRootContentDocument();
for (nsIFrame* kid = mOuter->GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) {
if (kid != mScrolledFrame) {
if (kid == mScrollCornerBox && hasResizer) {

View File

@ -263,25 +263,35 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (!subdocView)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell;
nsCOMPtr<nsIPresShell> presShell = nsnull;
nsIFrame* subdocRootFrame =
static_cast<nsIFrame*>(subdocView->GetClientData());
if (subdocRootFrame) {
presShell = subdocRootFrame->PresContext()->PresShell();
} else {
}
// If painting is suppressed in the presshell, we try to look for a better
// presshell to use.
if (!presShell || (presShell->IsPaintingSuppressed() &&
!aBuilder->IsIgnoringPaintSuppression())) {
// During page transition mInnerView will sometimes have two children, the
// first being the new page that may not have any frame, and the second
// being the old page that will probably have a frame.
nsIView* nextView = subdocView->GetNextSibling();
nsIFrame* frame = nsnull;
if (nextView) {
subdocRootFrame = static_cast<nsIFrame*>(nextView->GetClientData());
frame = static_cast<nsIFrame*>(nextView->GetClientData());
}
if (subdocRootFrame) {
subdocView = nextView;
presShell = subdocRootFrame->PresContext()->PresShell();
} else {
if (frame) {
nsIPresShell* ps = frame->PresContext()->PresShell();
if (!presShell || (ps && !ps->IsPaintingSuppressed())) {
subdocView = nextView;
subdocRootFrame = frame;
presShell = ps;
}
}
if (!presShell) {
// If we don't have a frame we use this roundabout way to get the pres shell.
if (!mFrameLoader)
return NS_OK;
@ -365,7 +375,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
new (aBuilder) nsDisplayZoom(aBuilder, subdocRootFrame, &childItems,
subdocAPD, parentAPD);
childItems.AppendToTop(zoomItem);
} else if (!nsContentUtils::IsChildOfSameType(presShell->GetDocument())) {
} else if (presContext->IsRootContentDocument()) {
// We always want top level content documents to be in their own layer.
// If we need a zoom item then we are good because it creates a layer. If
// not then create our own layer.

View File

@ -99,12 +99,17 @@
var _delayedOnLoad = function() {
gFindBar = document.getElementById("FindToolbar");
gBrowser = document.getElementById("content");
gBrowser.addEventListener("pageshow", onPageShow, false);
gBrowser.addEventListener("pageshow", _delayedOnPageShow, false);
gBrowser.loadURI("data:text/html,<h2 id='h2'>" + SEARCH_TEXT + "</h2><h2><a href='" + SAMPLE_URL + "'>Link Test</a></h2><input id='text' type='text' value='" + SAMPLE_TEXT + "'></input><input id='button' type='button'></input><img id='img' width='50' height='50'/>");
}
setTimeout(_delayedOnLoad, 1000);
}
function _delayedOnPageShow() {
// setTimeout to the test runs after painting suppression ends
setTimeout(onPageShow, 0);
}
function onPageShow() {
testNormalFind();
gFindBar.close();

View File

@ -47,8 +47,8 @@ class nsIRenderingContext;
class nsGUIEvent;
#define NS_IVIEWOBSERVER_IID \
{ 0x6af699da, 0x8bfe, 0x43c9, \
{ 0xae, 0xc1, 0x76, 0x1b, 0x03, 0x62, 0x8d, 0x64 } }
{ 0x4d467c73, 0xb6a9, 0x462a, \
{ 0x90, 0x25, 0x80, 0xd9, 0x42, 0xbc, 0xcc, 0xb5 } }
class nsIViewObserver : public nsISupports
{
@ -107,12 +107,6 @@ public:
*/
NS_IMETHOD ResizeReflow(nsIView * aView, nscoord aWidth, nscoord aHeight) = 0;
/**
* Hack to find out if the view observer is itself visible, in lieu
* of having the view trees linked.
*/
NS_IMETHOD_(PRBool) IsVisible() = 0;
/**
* Returns true if the view observer wants to drop all invalidation right now
* because painting is suppressed. It will invalidate everything when it

View File

@ -100,18 +100,6 @@ public:
//-------------- End Invalidate Event Definition ---------------------------
static PRBool IsViewVisible(nsView *aView)
{
if (!aView->IsEffectivelyVisible())
return PR_FALSE;
// Find out if the root view is visible by asking the view observer
// (this won't be needed anymore if we link view trees across chrome /
// content boundaries in DocumentViewerImpl::MakeWindow).
nsIViewObserver* vo = aView->GetViewManager()->GetViewObserver();
return vo && vo->IsVisible();
}
void
nsViewManager::PostInvalidateEvent()
{
@ -324,7 +312,7 @@ void nsViewManager::DoSetWindowDimensions(nscoord aWidth, nscoord aHeight)
NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
{
if (mRootView) {
if (IsViewVisible(mRootView)) {
if (mRootView->IsEffectivelyVisible()) {
mDelayedResize.SizeTo(NSCOORD_NONE, NSCOORD_NONE);
DoSetWindowDimensions(aWidth, aHeight);
} else {
@ -621,7 +609,10 @@ nsViewManager::UpdateWidgetArea(nsView *aWidgetView, nsIWidget* aWidget,
NS_ASSERTION(view != aWidgetView, "will recur infinitely");
PRBool visible;
childWidget->IsVisible(visible);
if (view && visible && !IsWidgetDrawnByPlugin(childWidget, view)) {
nsWindowType type;
childWidget->GetWindowType(type);
if (view && visible && !IsWidgetDrawnByPlugin(childWidget, view) &&
type != eWindowType_popup) {
// Don't mess with views that are in completely different view
// manager trees
nsViewManager* viewManager = view->GetViewManager();
@ -879,7 +870,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
? vm->mRootView->GetParent()->GetViewManager()
: nsnull) {
if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
IsViewVisible(vm->mRootView)) {
vm->mRootView->IsEffectivelyVisible()) {
vm->FlushDelayedResize(PR_TRUE);
// Paint later.
@ -894,7 +885,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
}
if (!didResize) {
//NS_ASSERTION(IsViewVisible(view), "painting an invisible view");
//NS_ASSERTION(view->IsEffectivelyVisible(), "painting an invisible view");
// Notify view observers that we're about to paint.
// Make sure to not send WillPaint notifications while scrolling.
@ -1671,11 +1662,13 @@ nsViewManager::CallWillPaintOnObservers(PRBool aWillSendDidPaint)
nsViewManager* vm = (nsViewManager*)gViewManagers->ElementAt(index);
if (vm->RootViewManager() == this) {
// One of our kids.
nsCOMPtr<nsIViewObserver> obs = vm->GetViewObserver();
if (obs) {
obs->WillPaint(aWillSendDidPaint);
NS_ASSERTION(mUpdateBatchCnt == savedUpdateBatchCnt,
"Observer did not end view batch?");
if (vm->mRootView && vm->mRootView->IsEffectivelyVisible()) {
nsCOMPtr<nsIViewObserver> obs = vm->GetViewObserver();
if (obs) {
obs->WillPaint(aWillSendDidPaint);
NS_ASSERTION(mUpdateBatchCnt == savedUpdateBatchCnt,
"Observer did not end view batch?");
}
}
}
}