Bug 575336 part 1. Make sure to update the size of the current prescontext on style flush, so that media queries do the right thing. r=roc

This commit is contained in:
Boris Zbarsky 2010-08-05 14:39:39 -04:00
parent caa98a7971
commit e8a9de31ab
4 changed files with 20 additions and 9 deletions

View File

@ -4789,6 +4789,7 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
// Process pending restyles, since any flush of the presshell wants
// up-to-date style data.
if (!mIsDestroying) {
mViewManager->FlushDelayedResize(PR_FALSE);
mPresContext->FlushPendingMediaFeatureValuesChanged();
// Flush any pending update of the user font set, since that could
@ -4835,7 +4836,7 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
if (aType >= (mSuppressInterruptibleReflows ? Flush_Layout : Flush_InterruptibleLayout) &&
!mIsDestroying) {
mFrameConstructor->RecalcQuotesAndCounters();
mViewManager->FlushDelayedResize();
mViewManager->FlushDelayedResize(PR_TRUE);
if (ProcessReflowCommands(aType < Flush_Layout) && mContentToScrollTo) {
// We didn't get interrupted. Go ahead and scroll to our content
DoScrollContentIntoView(mContentToScrollTo, mContentScrollVPosition,

View File

@ -50,8 +50,8 @@ class nsIDeviceContext;
class nsIViewObserver;
#define NS_IVIEWMANAGER_IID \
{ 0x9e924719, 0x3c4b, 0x435b, \
{ 0xaf, 0x1e, 0x71, 0x52, 0x04, 0x6d, 0xaa, 0x44 } }
{ 0x35c07b12, 0x5d96, 0x49f9, \
{ 0x91, 0xa3, 0x2f, 0xad, 0x3e, 0x84, 0x0c, 0x91 } }
class nsIViewManager : public nsISupports
{
@ -116,7 +116,7 @@ public:
/**
* Do any resizes that are pending.
*/
NS_IMETHOD FlushDelayedResize() = 0;
NS_IMETHOD FlushDelayedResize(PRBool aDoReflow) = 0;
/**
* Called to force a redrawing of any dirty areas.

View File

@ -60,6 +60,8 @@
#include "nsContentUtils.h"
#include "nsIPluginWidget.h"
#include "nsXULPopupManager.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
@ -333,11 +335,19 @@ NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight
return NS_OK;
}
NS_IMETHODIMP nsViewManager::FlushDelayedResize()
NS_IMETHODIMP nsViewManager::FlushDelayedResize(PRBool aDoReflow)
{
if (mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE)) {
DoSetWindowDimensions(mDelayedResize.width, mDelayedResize.height);
mDelayedResize.SizeTo(NSCOORD_NONE, NSCOORD_NONE);
if (aDoReflow) {
DoSetWindowDimensions(mDelayedResize.width, mDelayedResize.height);
mDelayedResize.SizeTo(NSCOORD_NONE, NSCOORD_NONE);
} else if (mObserver) {
nsCOMPtr<nsIPresShell> shell = do_QueryInterface(mObserver);
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
presContext->SetVisibleArea(nsRect(nsPoint(0, 0), mDelayedResize));
}
}
}
return NS_OK;
}
@ -842,7 +852,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
: nsnull) {
if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
IsViewVisible(vm->mRootView)) {
vm->FlushDelayedResize();
vm->FlushDelayedResize(PR_TRUE);
// Paint later.
vm->UpdateView(vm->mRootView, NS_VMREFRESH_NO_SYNC);

View File

@ -111,7 +111,7 @@ public:
NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height);
NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height);
NS_IMETHOD FlushDelayedResize();
NS_IMETHOD FlushDelayedResize(PRBool aDoReflow);
NS_IMETHOD Composite(void);