зеркало из https://github.com/mozilla/gecko-dev.git
Bug 978913 - Dragging e10s window between HiDPI and non-HiDPI displays causes text to be scaled incorrectly. r=smaug.
This commit is contained in:
Родитель
c17e4c94f4
Коммит
c0e682d27d
|
@ -503,6 +503,12 @@ child:
|
|||
*/
|
||||
SetIsDocShellActive(bool aIsActive);
|
||||
|
||||
/**
|
||||
* Tell the child that the UI resolution changed for the containing
|
||||
* window.
|
||||
*/
|
||||
UIResolutionChanged();
|
||||
|
||||
/*
|
||||
* FIXME: write protocol!
|
||||
|
||||
|
|
|
@ -2733,6 +2733,17 @@ TabChild::OnHideTooltip()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvUIResolutionChanged()
|
||||
{
|
||||
static_cast<PuppetWidget*>(mWidget.get())->ClearBackingScaleCache();
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||
nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||
presContext->UIResolutionChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
TabChildGlobal::TabChildGlobal(TabChildBase* aTabChild)
|
||||
: mTabChild(aTabChild)
|
||||
{
|
||||
|
|
|
@ -456,6 +456,8 @@ public:
|
|||
return GetFrom(docShell);
|
||||
}
|
||||
|
||||
virtual bool RecvUIResolutionChanged() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
|
||||
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
||||
|
|
|
@ -509,6 +509,17 @@ TabParent::UpdateFrame(const FrameMetrics& aFrameMetrics)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::UIResolutionChanged()
|
||||
{
|
||||
if (!mIsDestroyed) {
|
||||
// TryCacheDPIAndScale()'s cache is keyed off of
|
||||
// mDPI being greater than 0, so this invalidates it.
|
||||
mDPI = -1;
|
||||
unused << SendUIResolutionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration)
|
||||
{
|
||||
|
|
|
@ -198,6 +198,7 @@ public:
|
|||
void Show(const nsIntSize& size);
|
||||
void UpdateDimensions(const nsRect& rect, const nsIntSize& size);
|
||||
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
|
||||
void UIResolutionChanged();
|
||||
void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration);
|
||||
void HandleDoubleTap(const CSSPoint& aPoint,
|
||||
int32_t aModifiers,
|
||||
|
|
|
@ -49,11 +49,14 @@
|
|||
#include "mozilla/dom/MediaQueryList.h"
|
||||
#include "nsSMILAnimationController.h"
|
||||
#include "mozilla/css/ImageLoader.h"
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "Layers.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
@ -1768,6 +1771,35 @@ nsPresContext::UIResolutionChangedInternal()
|
|||
AppUnitsPerDevPixelChanged();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(mDocument->GetWindow()));
|
||||
nsCOMPtr<nsIMessageBroadcaster> windowMM;
|
||||
if (chromeWindow) {
|
||||
chromeWindow->GetMessageManager(getter_AddRefs(windowMM));
|
||||
}
|
||||
if (windowMM) {
|
||||
uint32_t tabChildCount = 0;
|
||||
windowMM->GetChildCount(&tabChildCount);
|
||||
for (uint32_t j = 0; j < tabChildCount; ++j) {
|
||||
nsCOMPtr<nsIMessageListenerManager> childMM;
|
||||
windowMM->GetChildAt(j, getter_AddRefs(childMM));
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageSender> tabMM = do_QueryInterface(childMM);
|
||||
|
||||
mozilla::dom::ipc::MessageManagerCallback* cb =
|
||||
static_cast<nsFrameMessageManager*>(tabMM.get())->GetCallback();
|
||||
if (cb) {
|
||||
nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
|
||||
PBrowserParent* remoteBrowser = fl->GetRemoteBrowser();
|
||||
TabParent* remote = static_cast<TabParent*>(remoteBrowser);
|
||||
if (remote) {
|
||||
remote->UIResolutionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mDocument->EnumerateSubDocuments(UIResolutionChangedSubdocumentCallback,
|
||||
nullptr);
|
||||
}
|
||||
|
|
|
@ -183,6 +183,11 @@ public:
|
|||
virtual bool NeedsPaint() MOZ_OVERRIDE;
|
||||
|
||||
virtual TabChild* GetOwningTabChild() MOZ_OVERRIDE { return mTabChild; }
|
||||
virtual void ClearBackingScaleCache()
|
||||
{
|
||||
mDPI = -1;
|
||||
mDefaultScale = -1;
|
||||
}
|
||||
|
||||
private:
|
||||
nsresult Paint();
|
||||
|
|
Загрузка…
Ссылка в новой задаче