зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1042959 - Ensure that we always use the actual old screen size in HandlePossibleViewportChange. r=botond
This commit is contained in:
Родитель
aaced0d806
Коммит
ff97ac7749
|
@ -78,6 +78,7 @@
|
|||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "UnitTransforms.h"
|
||||
#include "ClientLayerManager.h"
|
||||
#include "LayersLogging.h"
|
||||
|
||||
#include "nsColorPickerProxy.h"
|
||||
|
||||
|
@ -88,6 +89,9 @@
|
|||
#define BROWSER_ELEMENT_CHILD_SCRIPT \
|
||||
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
|
||||
|
||||
#define TABC_LOG(...)
|
||||
// #define TABC_LOG(...) printf_stderr("TABC: " __VA_ARGS__)
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::ipc;
|
||||
|
@ -174,12 +178,16 @@ TabChildBase::InitializeRootMetrics()
|
|||
// as the resolution.
|
||||
mLastRootMetrics.mResolution = mLastRootMetrics.mCumulativeResolution / LayoutDeviceToParentLayerScale(1);
|
||||
mLastRootMetrics.SetScrollOffset(CSSPoint(0, 0));
|
||||
|
||||
TABC_LOG("After InitializeRootMetrics, mLastRootMetrics is %s\n",
|
||||
Stringify(mLastRootMetrics).c_str());
|
||||
}
|
||||
|
||||
void
|
||||
TabChildBase::SetCSSViewport(const CSSSize& aSize)
|
||||
{
|
||||
mOldViewportSize = aSize;
|
||||
TABC_LOG("Setting CSS viewport to %s\n", Stringify(aSize).c_str());
|
||||
|
||||
if (mContentDocumentIsDisplayed) {
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
|
||||
|
@ -213,12 +221,15 @@ TabChildBase::GetPageSize(nsCOMPtr<nsIDocument> aDocument, const CSSSize& aViewp
|
|||
}
|
||||
|
||||
bool
|
||||
TabChildBase::HandlePossibleViewportChange()
|
||||
TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
|
||||
{
|
||||
if (!IsAsyncPanZoomEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TABC_LOG("HandlePossibleViewportChange aOldScreenSize=%s mInnerSize=%s\n",
|
||||
Stringify(aOldScreenSize).c_str(), Stringify(mInnerSize).c_str());
|
||||
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
|
||||
|
||||
|
@ -249,6 +260,8 @@ TabChildBase::HandlePossibleViewportChange()
|
|||
return false;
|
||||
}
|
||||
|
||||
TABC_LOG("HandlePossibleViewportChange mOldViewportSize=%s viewport=%s\n",
|
||||
Stringify(mOldViewportSize).c_str(), Stringify(viewport).c_str());
|
||||
CSSSize oldBrowserSize = mOldViewportSize;
|
||||
mLastRootMetrics.mViewport.SizeTo(viewport);
|
||||
if (oldBrowserSize == CSSSize()) {
|
||||
|
@ -269,9 +282,7 @@ TabChildBase::HandlePossibleViewportChange()
|
|||
return false;
|
||||
}
|
||||
|
||||
ScreenIntSize oldScreenSize = ViewAs<ScreenPixel>(
|
||||
RoundedToInt(mLastRootMetrics.mCompositionBounds).Size(),
|
||||
PixelCastJustification::ScreenToParentLayerForRoot);
|
||||
ScreenIntSize oldScreenSize = aOldScreenSize;
|
||||
if (oldScreenSize == ScreenIntSize()) {
|
||||
oldScreenSize = mInnerSize;
|
||||
}
|
||||
|
@ -748,7 +759,7 @@ TabChild::HandleEvent(nsIDOMEvent* aEvent)
|
|||
if (eventType.EqualsLiteral("DOMMetaAdded")) {
|
||||
// This meta data may or may not have been a meta viewport tag. If it was,
|
||||
// we should handle it immediately.
|
||||
HandlePossibleViewportChange();
|
||||
HandlePossibleViewportChange(mInnerSize);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -799,7 +810,7 @@ TabChild::Observe(nsISupports *aSubject,
|
|||
InitializeRootMetrics();
|
||||
utils->SetResolution(mLastRootMetrics.mResolution.scale,
|
||||
mLastRootMetrics.mResolution.scale);
|
||||
HandlePossibleViewportChange();
|
||||
HandlePossibleViewportChange(mInnerSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1750,6 +1761,7 @@ TabChild::RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const
|
|||
}
|
||||
|
||||
mOrientation = orientation;
|
||||
ScreenIntSize oldScreenSize = mInnerSize;
|
||||
mInnerSize = ScreenIntSize::FromUnknownSize(
|
||||
gfx::IntSize(size.width, size.height));
|
||||
mWidget->Resize(0, 0, size.width, size.height,
|
||||
|
@ -1767,7 +1779,7 @@ TabChild::RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const
|
|||
InitializeRootMetrics();
|
||||
}
|
||||
|
||||
HandlePossibleViewportChange();
|
||||
HandlePossibleViewportChange(oldScreenSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
// viewport data on a document may have changed. If it didn't
|
||||
// change, this function doesn't do anything. However, it should
|
||||
// not be called all the time as it is fairly expensive.
|
||||
bool HandlePossibleViewportChange();
|
||||
bool HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize);
|
||||
virtual bool DoUpdateZoomConstraints(const uint32_t& aPresShellId,
|
||||
const mozilla::layers::FrameMetrics::ViewID& aViewId,
|
||||
const bool& aIsRoot,
|
||||
|
|
Загрузка…
Ссылка в новой задаче