зеркало из https://github.com/mozilla/gecko-dev.git
when switching documents, the scrollbars are reset.
This commit is contained in:
Родитель
8adf0f0f65
Коммит
07f184a0ef
|
@ -340,26 +340,26 @@ double a1,a2;
|
|||
m2 = m1;
|
||||
for(x=0;x<numbytes;x++)
|
||||
{
|
||||
a1 = (*m2)/256.0;
|
||||
a1 = (*m2) * (1.0 / 256.0);
|
||||
a2 = 1.0-a1;
|
||||
temp = ((*d2)*a1 + (*s2)*a2);
|
||||
temp = (PRUint16)((*d2)*a1 + (*s2)*a2);
|
||||
if(temp>255)
|
||||
temp = 255;
|
||||
*d2 = temp;
|
||||
*d2 = (PRUint8)temp;
|
||||
d2++;
|
||||
s2++;
|
||||
|
||||
temp = ((*d2)*a1 + (*s2)*a2);
|
||||
temp = (PRUint16)((*d2)*a1 + (*s2)*a2);
|
||||
if(temp>255)
|
||||
temp = 255;
|
||||
*d2 = temp;
|
||||
*d2 = (PRUint8)temp;
|
||||
d2++;
|
||||
s2++;
|
||||
|
||||
temp = ((*d2)*a1 + (*s2)*a2);
|
||||
temp = (PRUint16)((*d2)*a1 + (*s2)*a2);
|
||||
if(temp>255)
|
||||
temp = 255;
|
||||
*d2 = temp;
|
||||
*d2 = (PRUint8)temp;
|
||||
d2++;
|
||||
s2++;
|
||||
m2++;
|
||||
|
@ -627,8 +627,6 @@ void nsImageWin :: CleanUp(PRBool aCleanUpAll)
|
|||
// this only happens when we need to clean up everything
|
||||
if (aCleanUpAll == PR_TRUE)
|
||||
{
|
||||
char *temp;
|
||||
|
||||
if (mAlphaBits != nsnull)
|
||||
delete [] mAlphaBits;
|
||||
|
||||
|
|
|
@ -121,6 +121,11 @@ public:
|
|||
*/
|
||||
virtual void SetWindowOffsets(nscoord xoffset, nscoord yoffset) = 0;
|
||||
|
||||
/**
|
||||
* Reset the state of scrollbars and the scrolling region
|
||||
*/
|
||||
virtual void ResetScrolling(void) = 0;
|
||||
|
||||
/**
|
||||
* Called to refresh an area of the root window. Often called in
|
||||
* response to a paint/redraw event from the native windowing system.
|
||||
|
|
|
@ -377,15 +377,17 @@ nsEventStatus nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEvent
|
|||
|
||||
void nsScrollingView :: ComputeContainerSize()
|
||||
{
|
||||
nsIView *scrollview = GetScrolledView();
|
||||
nsIView *scrollview = GetScrolledView();
|
||||
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
||||
nsIWidget *win;
|
||||
|
||||
static NS_DEFINE_IID(kscroller, NS_ISCROLLBAR_IID);
|
||||
|
||||
if (nsnull != scrollview)
|
||||
{
|
||||
nscoord dx = 0, dy = 0;
|
||||
nsIPresContext *px = mViewManager->GetPresContext();
|
||||
nscoord width, height;
|
||||
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
||||
nsIWidget *win;
|
||||
PRUint32 oldsizey = mSizeY, oldsizex = mSizeX;
|
||||
nsRect area(0, 0, 0, 0);
|
||||
nscoord offx, offy;
|
||||
|
@ -403,8 +405,6 @@ void nsScrollingView :: ComputeContainerSize()
|
|||
|
||||
win = mVScrollBarView->GetWidget();
|
||||
|
||||
static NS_DEFINE_IID(kscroller, NS_ISCROLLBAR_IID);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kscroller, (void **)&scrollv))
|
||||
{
|
||||
if (mSizeY > mBounds.height)
|
||||
|
@ -443,8 +443,6 @@ void nsScrollingView :: ComputeContainerSize()
|
|||
|
||||
win = mHScrollBarView->GetWidget();
|
||||
|
||||
static NS_DEFINE_IID(kscroller, NS_ISCROLLBAR_IID);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kscroller, (void **)&scrollh))
|
||||
{
|
||||
if (mSizeX > mBounds.width)
|
||||
|
@ -482,6 +480,41 @@ void nsScrollingView :: ComputeContainerSize()
|
|||
NS_RELEASE(px);
|
||||
NS_RELEASE(scrollview);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nsnull != mHScrollBarView)
|
||||
{
|
||||
mHScrollBarView->SetVisibility(nsViewVisibility_kHide);
|
||||
|
||||
win = mHScrollBarView->GetWidget();
|
||||
|
||||
if (NS_OK == win->QueryInterface(kscroller, (void **)&scrollh))
|
||||
{
|
||||
scrollh->SetParameters(0, 0, 0, 0);
|
||||
NS_RELEASE(scrollh);
|
||||
}
|
||||
|
||||
NS_RELEASE(win);
|
||||
}
|
||||
|
||||
if (nsnull != mVScrollBarView)
|
||||
{
|
||||
mVScrollBarView->SetVisibility(nsViewVisibility_kHide);
|
||||
|
||||
win = mVScrollBarView->GetWidget();
|
||||
|
||||
if (NS_OK == win->QueryInterface(kscroller, (void **)&scrollv))
|
||||
{
|
||||
scrollv->SetParameters(0, 0, 0, 0);
|
||||
NS_RELEASE(scrollv);
|
||||
}
|
||||
|
||||
NS_RELEASE(win);
|
||||
}
|
||||
|
||||
mOffsetX = mOffsetY = 0;
|
||||
mSizeX = mSizeY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void nsScrollingView :: GetContainerSize(nscoord *aWidth, nscoord *aHeight)
|
||||
|
|
|
@ -254,6 +254,22 @@ void nsViewManager :: SetWindowOffsets(nscoord xoffset, nscoord yoffset)
|
|||
}
|
||||
}
|
||||
|
||||
void nsViewManager :: ResetScrolling(void)
|
||||
{
|
||||
if (nsnull != mRootView)
|
||||
{
|
||||
nsIScrollableView *scroller;
|
||||
|
||||
static NS_DEFINE_IID(kscroller, NS_ISCROLLABLEVIEW_IID);
|
||||
|
||||
if (NS_OK == mRootView->QueryInterface(kscroller, (void **)&scroller))
|
||||
{
|
||||
scroller->ComputeContainerSize();
|
||||
NS_RELEASE(scroller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsViewManager :: Refresh(nsIRenderingContext *aContext, nsRegion *region, PRUint32 aUpdateFlags)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
virtual void GetWindowOffsets(nscoord *xoffset, nscoord *yoffset);
|
||||
virtual void SetWindowOffsets(nscoord xoffset, nscoord yoffset);
|
||||
|
||||
virtual void ResetScrolling(void);
|
||||
|
||||
// Called to refresh an area of the root window. The coordinates of
|
||||
// the region or rectangle passed in should be in the window's
|
||||
// coordinate space. Often called in response to a paint/redraw event
|
||||
|
|
|
@ -431,8 +431,10 @@ NS_IMETHODIMP WebWidgetImpl::LoadURL(const nsString& aURLSpec)
|
|||
// Setup view manager's window
|
||||
nsRect bounds;
|
||||
mWindow->GetBounds(bounds);
|
||||
if (nsnull != mPresShell) {
|
||||
if ((nsnull != mPresContext) && (nsnull != mViewManager)) {
|
||||
float p2t = mPresContext->GetPixelsToTwips();
|
||||
//reset scrolling offset to upper left
|
||||
mViewManager->ResetScrolling();
|
||||
nscoord width = NS_TO_INT_ROUND(bounds.width * p2t);
|
||||
nscoord height = NS_TO_INT_ROUND(bounds.height * p2t);
|
||||
mViewManager->SetWindowDimensions(width, height);
|
||||
|
|
Загрузка…
Ссылка в новой задаче