зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1547277. If the size of the document as recorded in the frame/view tree and the document viewer diverge as a result of a call to GetContentSize make sure to invalidate when they converge again because what we draw is changing. r=mattwoodrow
The code comment mostly explains things. Differential Revision: https://phabricator.services.mozilla.com/D29953 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4f873399c9
Коммит
9e00c372a5
|
@ -2032,6 +2032,7 @@ nsDocumentViewer::SetBoundsWithFlags(const nsIntRect& aBounds,
|
|||
uint32_t aFlags) {
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
bool boundsChanged = mBounds.IsEqualEdges(aBounds);
|
||||
mBounds = aBounds;
|
||||
|
||||
if (mWindow && !mAttachedToParent) {
|
||||
|
@ -2047,11 +2048,32 @@ nsDocumentViewer::SetBoundsWithFlags(const nsIntRect& aBounds,
|
|||
if (mPresContext->DeviceContext()->CheckDPIChange()) {
|
||||
mPresContext->UIResolutionChanged();
|
||||
}
|
||||
|
||||
int32_t p2a = mPresContext->AppUnitsPerDevPixel();
|
||||
nscoord width = NSIntPixelsToAppUnits(mBounds.width, p2a);
|
||||
nscoord height = NSIntPixelsToAppUnits(mBounds.height, p2a);
|
||||
nsView* rootView = mViewManager->GetRootView();
|
||||
if (boundsChanged && rootView) {
|
||||
nsRect viewDims = rootView->GetDimensions();
|
||||
// If the view/frame tree and prescontext visible area already has the new
|
||||
// size but we did not, then it's likely that we got reflowed in response
|
||||
// to a call to GetContentSize. Thus there is a disconnect between the
|
||||
// size on the document viewer/docshell/containing widget and view
|
||||
// tree/frame tree/prescontext visible area). SetWindowDimensions compares
|
||||
// to the root view dimenstions to determine if it needs to do anything;
|
||||
// if they are the same as the new size it won't do anything, but we still
|
||||
// need to invalidate because what we want to draw to the screen has
|
||||
// changed.
|
||||
if (viewDims.width == width && viewDims.height == height) {
|
||||
nsIFrame* f = rootView->GetFrame();
|
||||
if (f) {
|
||||
f->InvalidateFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mViewManager->SetWindowDimensions(
|
||||
NSIntPixelsToAppUnits(mBounds.width, p2a),
|
||||
NSIntPixelsToAppUnits(mBounds.height, p2a),
|
||||
!!(aFlags & nsIContentViewer::eDelayResize));
|
||||
width, height, !!(aFlags & nsIContentViewer::eDelayResize));
|
||||
}
|
||||
|
||||
// If there's a previous viewer, it's the one that's actually showing,
|
||||
|
|
Загрузка…
Ссылка в новой задаче