Back out 3 csets from bug 1125325 for introducing bug 1173224. r=me

This commit is contained in:
Kartikaya Gupta 2015-06-10 15:55:34 -04:00
parent 02e294ee46
commit 1606970601
12 changed files with 48 additions and 242 deletions

View File

@ -7787,16 +7787,3 @@ nsContentUtils::FirePageShowEvent(nsIDocShellTreeItem* aItem,
doc->OnPageShow(true, aChromeEventHandler);
}
}
/* static */
already_AddRefed<nsPIWindowRoot>
nsContentUtils::GetWindowRoot(nsIDocument* aDoc)
{
if (aDoc) {
nsPIDOMWindow* win = aDoc->GetWindow();
if (win) {
return win->GetTopWindowRoot();
}
}
return nullptr;
}

View File

@ -99,7 +99,6 @@ class nsViewportInfo;
class nsWrapperCache;
class nsAttrValue;
class nsITransferable;
class nsPIWindowRoot;
struct JSPropertyDescriptor;
struct JSRuntime;
@ -2364,8 +2363,6 @@ public:
static void FirePageHideEvent(nsIDocShellTreeItem* aItem,
mozilla::dom::EventTarget* aChromeEventHandler);
static already_AddRefed<nsPIWindowRoot> GetWindowRoot(nsIDocument* aDoc);
private:
static bool InitializeEventTable();

View File

@ -9,21 +9,14 @@
#include "nsISupports.h"
#include "mozilla/dom/EventTarget.h"
#include "nsWeakReference.h"
class nsPIDOMWindow;
class nsIControllers;
class nsIController;
namespace mozilla {
namespace dom {
class TabParent;
}
}
#define NS_IWINDOWROOT_IID \
{ 0x238edca0, 0xb30d, 0x46d3, \
{ 0xb2, 0x6a, 0x17, 0xb6, 0x21, 0x28, 0x89, 0x7e } }
{ 0x728a2682, 0x55c0, 0x4860, \
{ 0x82, 0x6b, 0x0c, 0x30, 0x0a, 0xac, 0xaa, 0x60 } }
class nsPIWindowRoot : public mozilla::dom::EventTarget
{
@ -45,15 +38,6 @@ public:
virtual void SetParentTarget(mozilla::dom::EventTarget* aTarget) = 0;
virtual mozilla::dom::EventTarget* GetParentTarget() = 0;
// Stores a weak reference to the browser.
virtual void AddBrowser(mozilla::dom::TabParent* aBrowser) = 0;
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) = 0;
typedef void (*BrowserEnumerator)(mozilla::dom::TabParent* aTab, void* aArg);
// Enumerate all stored browsers that for which the weak reference is valid.
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIWindowRoot, NS_IWINDOWROOT_IID)

View File

@ -24,7 +24,6 @@
#include "nsIController.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/TabParent.h"
#ifdef MOZ_XUL
#include "nsIDOMXULElement.h"
@ -386,46 +385,6 @@ nsWindowRoot::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return mozilla::dom::WindowRootBinding::Wrap(aCx, this, aGivenProto);
}
void
nsWindowRoot::AddBrowser(mozilla::dom::TabParent* aBrowser)
{
nsWeakPtr weakBrowser = do_GetWeakReference(static_cast<nsITabParent*>(aBrowser));
mWeakBrowsers.PutEntry(weakBrowser);
}
void
nsWindowRoot::RemoveBrowser(mozilla::dom::TabParent* aBrowser)
{
nsWeakPtr weakBrowser = do_GetWeakReference(static_cast<nsITabParent*>(aBrowser));
mWeakBrowsers.RemoveEntry(weakBrowser);
}
static PLDHashOperator
WeakBrowserEnumFunc(nsRefPtrHashKey<nsIWeakReference>* aKey, void* aArg)
{
nsTArray<nsRefPtr<TabParent>>* tabParents =
static_cast<nsTArray<nsRefPtr<TabParent>>*>(aArg);
nsCOMPtr<nsITabParent> tabParent(do_QueryReferent((*aKey).GetKey()));
TabParent* tab = TabParent::GetFrom(tabParent);
if (tab) {
tabParents->AppendElement(tab);
}
return PL_DHASH_NEXT;
}
void
nsWindowRoot::EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg)
{
// Collect strong references to all browsers in a separate array in
// case aEnumFunc alters mWeakBrowsers.
nsTArray<nsRefPtr<TabParent>> tabParents;
mWeakBrowsers.EnumerateEntries(WeakBrowserEnumFunc, &tabParents);
for (uint32_t i = 0; i < tabParents.Length(); ++i) {
aEnumFunc(tabParents[i], aArg);
}
}
///////////////////////////////////////////////////////////////////////////////////
already_AddRefed<EventTarget>

View File

@ -69,10 +69,6 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
nsIDOMEventTarget)
virtual void AddBrowser(mozilla::dom::TabParent* aBrowser) override;
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) override;
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void *aArg) override;
protected:
virtual ~nsWindowRoot();
@ -88,10 +84,6 @@ protected:
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
nsCOMPtr<mozilla::dom::EventTarget> mParent;
// The TabParents that are currently registered with this top-level window.
typedef nsTHashtable<nsRefPtrHashKey<nsIWeakReference>> WeakBrowserTable;
WeakBrowserTable mWeakBrowsers;
};
extern already_AddRefed<mozilla::dom::EventTarget>

View File

@ -25,7 +25,6 @@ using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
using class mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h";
using struct gfxSize from "gfxPoint.h";
using CSSRect from "Units.h";
using CSSSize from "Units.h";
using LayoutDeviceIntRect from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using ScreenIntSize from "Units.h";
@ -549,7 +548,7 @@ child:
CacheFileDescriptor(nsString path, FileDescriptor fd);
UpdateDimensions(CSSRect rect, CSSSize size, ScreenOrientation orientation,
UpdateDimensions(IntRect rect, ScreenIntSize size, ScreenOrientation orientation,
LayoutDeviceIntPoint chromeDisp) compressall;
UpdateFrame(FrameMetrics frame);

View File

@ -92,7 +92,6 @@
#include "nsIPermissionManager.h"
#include "nsIScriptError.h"
#include "mozilla/EventForwards.h"
#include "nsDeviceContext.h"
#define BROWSER_ELEMENT_CHILD_SCRIPT \
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
@ -166,6 +165,7 @@ NS_IMPL_ISUPPORTS(TabChild::DelayedFireContextMenuEvent,
TabChildBase::TabChildBase()
: mContentDocumentIsDisplayed(false)
, mTabChildGlobal(nullptr)
, mInnerSize(0, 0)
{
mozilla::HoldJSObjects(this);
}
@ -236,11 +236,9 @@ TabChildBase::InitializeRootMetrics()
mLastRootMetrics.SetViewport(CSSRect(CSSPoint(), kDefaultViewportSize));
mLastRootMetrics.SetCompositionBounds(ParentLayerRect(
ParentLayerPoint(),
ParentLayerSize(
ViewAs<ParentLayerPixel>(GetInnerSize(),
PixelCastJustification::ScreenIsParentLayerForRoot))));
ParentLayerSize(ViewAs<ParentLayerPixel>(mInnerSize, PixelCastJustification::ScreenIsParentLayerForRoot))));
mLastRootMetrics.SetZoom(CSSToParentLayerScale2D(
ConvertScaleForRoot(CalculateIntrinsicScale(GetInnerSize(), kDefaultViewportSize))));
ConvertScaleForRoot(CalculateIntrinsicScale(mInnerSize, kDefaultViewportSize))));
mLastRootMetrics.SetDevPixelsPerCSSPixel(WebWidget()->GetDefaultScale());
// We use ParentLayerToLayerScale(1) below in order to turn the
// async zoom amount into the gecko zoom amount.
@ -301,14 +299,14 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
}
TABC_LOG("HandlePossibleViewportChange aOldScreenSize=%s mInnerSize=%s\n",
Stringify(aOldScreenSize).c_str(), Stringify(GetInnerSize()).c_str());
Stringify(aOldScreenSize).c_str(), Stringify(mInnerSize).c_str());
nsCOMPtr<nsIDocument> document(GetDocument());
if (!document) {
return false;
}
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(document, GetInnerSize());
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(document, mInnerSize);
uint32_t presShellId = 0;
mozilla::layers::FrameMetrics::ViewID viewId = FrameMetrics::NULL_SCROLL_ID;
bool scrollIdentifiersValid = APZCCallbackHelper::GetOrCreateScrollIdentifiers(
@ -325,8 +323,8 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
constraints);
}
float screenW = GetInnerSize().width;
float screenH = GetInnerSize().height;
float screenW = mInnerSize.width;
float screenH = mInnerSize.height;
CSSSize viewport(viewportInfo.GetSize());
// We're not being displayed in any way; don't bother doing anything because
@ -360,15 +358,15 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
ScreenIntSize oldScreenSize = aOldScreenSize;
if (oldScreenSize == ScreenIntSize()) {
oldScreenSize = GetInnerSize();
oldScreenSize = mInnerSize;
}
FrameMetrics metrics(mLastRootMetrics);
metrics.SetViewport(CSSRect(CSSPoint(), viewport));
// Calculate the composition bounds based on the inner size, excluding the sizes
// Calculate the composition bounds based on mInnerSize, excluding the sizes
// of the scrollbars if they are not overlay scrollbars.
ScreenSize compositionSize(GetInnerSize());
ScreenSize compositionSize(mInnerSize);
nsCOMPtr<nsIPresShell> shell = GetPresShell();
if (shell) {
nsMargin scrollbarsAppUnits =
@ -382,9 +380,7 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
metrics.SetCompositionBounds(ParentLayerRect(
ParentLayerPoint(),
ParentLayerSize(
ViewAs<ParentLayerPixel>(GetInnerSize(),
PixelCastJustification::ScreenIsParentLayerForRoot))));
ParentLayerSize(ViewAs<ParentLayerPixel>(compositionSize, PixelCastJustification::ScreenIsParentLayerForRoot))));
metrics.SetRootCompositionSize(
ScreenSize(compositionSize) * ScreenToLayoutDeviceScale(1.0f) / metrics.GetDevPixelsPerCSSPixel());
@ -401,7 +397,7 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
// within the screen width. Note that "actual content" may be different with
// respect to CSS pixels because of the CSS viewport size changing.
CSSToScreenScale oldIntrinsicScale = CalculateIntrinsicScale(oldScreenSize, oldBrowserSize);
CSSToScreenScale newIntrinsicScale = CalculateIntrinsicScale(GetInnerSize(), viewport);
CSSToScreenScale newIntrinsicScale = CalculateIntrinsicScale(mInnerSize, viewport);
metrics.ZoomBy(newIntrinsicScale.scale / oldIntrinsicScale.scale);
// Changing the zoom when we're not doing a first paint will get ignored
@ -885,6 +881,7 @@ TabChild::TabChild(nsIContentChild* aManager,
, mManager(aManager)
, mChromeFlags(aChromeFlags)
, mLayersId(0)
, mOuterRect(0, 0, 0, 0)
, mActivePointerId(-1)
, mAppPackageFileDescriptorRecved(false)
, mLastBackgroundColor(NS_RGB(255, 255, 255))
@ -925,9 +922,9 @@ 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(GetInnerSize());
HandlePossibleViewportChange(mInnerSize);
} else if (eventType.EqualsLiteral("FullZoomChange")) {
HandlePossibleViewportChange(GetInnerSize());
HandlePossibleViewportChange(mInnerSize);
}
return NS_OK;
@ -969,14 +966,14 @@ TabChild::Observe(nsISupports *aSubject,
// In some cases before-first-paint gets called before
// RecvUpdateDimensions is called and therefore before we have an
// inner size value set. In such cases defer initializing the viewport
// mInnerSize value set. In such cases defer initializing the viewport
// until we we get an inner size.
if (HasValidInnerSize()) {
InitializeRootMetrics();
if (shell) {
nsLayoutUtils::SetResolutionAndScaleTo(shell, mLastRootMetrics.GetPresShellResolution());
}
HandlePossibleViewportChange(GetInnerSize());
HandlePossibleViewportChange(mInnerSize);
}
}
}
@ -1316,18 +1313,17 @@ NS_IMETHODIMP
TabChild::GetDimensions(uint32_t aFlags, int32_t* aX,
int32_t* aY, int32_t* aCx, int32_t* aCy)
{
ScreenIntRect rect = GetOuterRect();
if (aX) {
*aX = rect.x;
*aX = mOuterRect.x;
}
if (aY) {
*aY = rect.y;
*aY = mOuterRect.y;
}
if (aCx) {
*aCx = rect.width;
*aCx = mOuterRect.width;
}
if (aCy) {
*aCy = rect.height;
*aCy = mOuterRect.height;
}
return NS_OK;
@ -2054,41 +2050,37 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
}
bool
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
const ScreenOrientation& orientation,
const LayoutDeviceIntPoint& chromeDisp)
TabChild::RecvUpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
const ScreenOrientation& orientation, const LayoutDeviceIntPoint& chromeDisp)
{
if (!mRemoteFrame) {
return true;
}
mUnscaledOuterRect = rect;
mOuterRect = rect;
mChromeDisp = chromeDisp;
bool initialSizing = !HasValidInnerSize()
&& (size.width != 0 && size.height != 0);
mOrientation = orientation;
ScreenIntSize oldScreenSize = GetInnerSize();
SetUnscaledInnerSize(size);
ScreenIntSize screenSize = GetInnerSize();
bool sizeChanged = true;
if (initialSizing) {
mHasValidInnerSize = true;
} else if (screenSize == oldScreenSize) {
} else if (mInnerSize == size) {
sizeChanged = false;
}
ScreenIntRect screenRect = GetOuterRect();
mWidget->Resize(screenRect.x + chromeDisp.x, screenRect.y + chromeDisp.y,
screenSize.width, screenSize.height, true);
mOrientation = orientation;
ScreenIntSize oldScreenSize = mInnerSize;
mInnerSize = size;
mWidget->Resize(rect.x + chromeDisp.x, rect.y + chromeDisp.y, size.width, size.height,
true);
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
baseWin->SetPositionAndSize(0, 0, size.width, size.height,
true);
if (initialSizing && mContentDocumentIsDisplayed) {
// If this is the first time we're getting a valid inner size, and the
// If this is the first time we're getting a valid mInnerSize, and the
// before-first-paint event has already been handled, then we need to set
// up our default viewport here. See the corresponding call to
// InitializeRootMetrics in the before-first-paint handler.
@ -3252,7 +3244,6 @@ TabChild::RecvRequestNotifyAfterRemotePaint()
bool
TabChild::RecvUIResolutionChanged()
{
ScreenIntSize oldScreenSize = GetInnerSize();
mDPI = 0;
mDefaultScale = 0;
static_cast<PuppetWidget*>(mWidget.get())->ClearBackingScaleCache();
@ -3261,21 +3252,9 @@ TabChild::RecvUIResolutionChanged()
if (presShell) {
nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
if (presContext) {
presContext->UIResolutionChangedSync();
presContext->UIResolutionChanged();
}
}
ScreenIntSize screenSize = GetInnerSize();
if (mHasValidInnerSize && oldScreenSize != screenSize) {
ScreenIntRect screenRect = GetOuterRect();
mWidget->Resize(screenRect.x + mChromeDisp.x, screenRect.y + mChromeDisp.y,
screenSize.width, screenSize.height, true);
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
true);
}
return true;
}
@ -3337,22 +3316,6 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
return rv;
}
ScreenIntSize
TabChild::GetInnerSize()
{
LayoutDeviceIntSize innerSize =
RoundedToInt(mUnscaledInnerSize * mWidget->GetDefaultScale());
return ViewAs<ScreenPixel>(innerSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
};
ScreenIntRect
TabChild::GetOuterRect()
{
LayoutDeviceIntRect outerRect =
RoundedToInt(mUnscaledOuterRect * mWidget->GetDefaultScale());
return ViewAs<ScreenPixel>(outerRect, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
}
TabChildGlobal::TabChildGlobal(TabChildBase* aTabChild)
: mTabChild(aTabChild)
{

View File

@ -189,8 +189,6 @@ public:
const bool& aIsRoot,
const mozilla::layers::ZoomConstraints& aConstraints) = 0;
virtual ScreenIntSize GetInnerSize() = 0;
protected:
virtual ~TabChildBase();
CSSSize GetPageSize(nsCOMPtr<nsIDocument> aDocument, const CSSSize& aViewport);
@ -224,6 +222,7 @@ protected:
CSSSize mOldViewportSize;
bool mContentDocumentIsDisplayed;
nsRefPtr<TabChildGlobal> mTabChildGlobal;
ScreenIntSize mInnerSize;
mozilla::layers::FrameMetrics mLastRootMetrics;
nsCOMPtr<nsIWebBrowserChrome3> mWebBrowserChrome;
};
@ -320,8 +319,8 @@ public:
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
const bool& aParentIsActive) override;
virtual bool RecvUpdateDimensions(const CSSRect& rect,
const CSSSize& size,
virtual bool RecvUpdateDimensions(const nsIntRect& rect,
const ScreenIntSize& size,
const ScreenOrientation& orientation,
const LayoutDeviceIntPoint& chromeDisp) override;
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
@ -511,8 +510,6 @@ public:
}
bool AsyncPanZoomEnabled() { return mAsyncPanZoomEnabled; }
virtual ScreenIntSize GetInnerSize() override;
protected:
virtual ~TabChild();
@ -602,12 +599,6 @@ private:
void SetTabId(const TabId& aTabId);
ScreenIntRect GetOuterRect();
void SetUnscaledInnerSize(const CSSSize& aSize) {
mUnscaledInnerSize = aSize;
}
class CachedFileDescriptorInfo;
class CachedFileDescriptorCallbackRunnable;
class DelayedDeleteRunnable;
@ -620,7 +611,7 @@ private:
nsRefPtr<nsIContentChild> mManager;
uint32_t mChromeFlags;
uint64_t mLayersId;
CSSRect mUnscaledOuterRect;
nsIntRect mOuterRect;
// When we're tracking a possible tap gesture, this is the "down"
// point of the touchstart.
LayoutDevicePoint mGestureDownPoint;
@ -655,7 +646,6 @@ private:
bool mIPCOpen;
bool mParentIsActive;
bool mAsyncPanZoomEnabled;
CSSSize mUnscaledInnerSize;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

View File

@ -90,7 +90,6 @@
#include "nsPIWindowRoot.h"
#include "gfxDrawable.h"
#include "ImageOps.h"
#include "UnitTransforms.h"
#include <algorithm>
using namespace mozilla::dom;
@ -334,27 +333,9 @@ TabParent::SetOwnerElement(Element* aElement)
// If we held previous content then unregister for its events.
RemoveWindowListeners();
// If we change top-level documents then we need to change our
// registration with them.
nsRefPtr<nsPIWindowRoot> curTopLevelWin, newTopLevelWin;
if (mFrameElement) {
curTopLevelWin = nsContentUtils::GetWindowRoot(mFrameElement->OwnerDoc());
}
if (aElement) {
newTopLevelWin = nsContentUtils::GetWindowRoot(aElement->OwnerDoc());
}
bool isSameTopLevelWin = curTopLevelWin == newTopLevelWin;
if (curTopLevelWin && !isSameTopLevelWin) {
curTopLevelWin->RemoveBrowser(this);
}
// Update to the new content, and register to listen for events from it.
mFrameElement = aElement;
if (newTopLevelWin && !isSameTopLevelWin) {
newTopLevelWin->AddBrowser(this);
}
AddWindowListeners();
TryCacheDPIAndScale();
}
@ -985,21 +966,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
mOrientation = orientation;
mChromeOffset = chromeOffset;
CSSToLayoutDeviceScale widgetScale;
if (widget) {
widgetScale = widget->GetDefaultScale();
}
LayoutDeviceIntRect devicePixelRect =
ViewAs<LayoutDevicePixel>(mRect,
PixelCastJustification::LayoutDeviceIsScreenForTabDims);
LayoutDeviceIntSize devicePixelSize =
ViewAs<LayoutDevicePixel>(mDimensions.ToUnknownSize(),
PixelCastJustification::LayoutDeviceIsScreenForTabDims);
CSSRect unscaledRect = devicePixelRect / widgetScale;
CSSSize unscaledSize = devicePixelSize / widgetScale;
unused << SendUpdateDimensions(unscaledRect, unscaledSize, orientation, chromeOffset);
unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, mChromeOffset);
}
}
@ -1018,7 +985,6 @@ TabParent::UIResolutionChanged()
// TryCacheDPIAndScale()'s cache is keyed off of
// mDPI being greater than 0, so this invalidates it.
mDPI = -1;
TryCacheDPIAndScale();
unused << SendUIResolutionChanged();
}
}

View File

@ -37,10 +37,7 @@ enum class PixelCastJustification : uint8_t {
// technically in screen pixels, as it has not yet accounted for any
// asynchronous transforms. This justification is for viewing the initial
// reference point as a screen point.
LayoutDeviceToScreenForUntransformedEvent,
// Similar to LayoutDeviceToScreenForUntransformedEvent, PBrowser handles
// some widget/tab dimension information as the OS does -- in screen units.
LayoutDeviceIsScreenForTabDims
LayoutDeviceToScreenForUntransformedEvent
};
template <class TargetUnits, class SourceUnits>

View File

@ -1798,15 +1798,6 @@ nsPresContext::UIResolutionChanged()
}
}
void
nsPresContext::UIResolutionChangedSync()
{
if (!mPendingUIResolutionChanged) {
mPendingUIResolutionChanged = true;
UIResolutionChangedInternal();
}
}
/*static*/ bool
nsPresContext::UIResolutionChangedSubdocumentCallback(nsIDocument* aDocument,
void* aData)
@ -1822,24 +1813,9 @@ nsPresContext::UIResolutionChangedSubdocumentCallback(nsIDocument* aDocument,
}
static void
NotifyTabUIResolutionChanged(TabParent* aTab, void *aArg)
NotifyUIResolutionChanged(TabParent* aTabParent, void* aArg)
{
aTab->UIResolutionChanged();
}
static void
NotifyChildrenUIResolutionChanged(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
if (!piWin) {
return;
}
nsCOMPtr<nsIDocument> doc = piWin->GetExtantDoc();
nsRefPtr<nsPIWindowRoot> topLevelWin = nsContentUtils::GetWindowRoot(doc);
if (!topLevelWin) {
return;
}
topLevelWin->EnumerateBrowsers(NotifyTabUIResolutionChanged, nullptr);
aTabParent->UIResolutionChanged();
}
void
@ -1852,8 +1828,10 @@ nsPresContext::UIResolutionChangedInternal()
AppUnitsPerDevPixelChanged();
}
// Recursively notify all remote leaf descendants of the change.
NotifyChildrenUIResolutionChanged(mDocument->GetWindow());
// Recursively notify all remote leaf descendants that the
// resolution of the user interface has changed.
nsContentUtils::CallOnAllRemoteChildren(mDocument->GetWindow(),
NotifyUIResolutionChanged, nullptr);
mDocument->EnumerateSubDocuments(UIResolutionChangedSubdocumentCallback,
nullptr);

View File

@ -791,15 +791,9 @@ public:
* Notify the pres context that the resolution of the user interface has
* changed. This happens if a window is moved between HiDPI and non-HiDPI
* displays, so that the ratio of points to device pixels changes.
* The notification happens asynchronously.
*/
void UIResolutionChanged();
/*
* Like UIResolutionChanged() but invalidates values immediately.
*/
void UIResolutionChangedSync();
/*
* Notify the pres context that a system color has changed
*/