mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 915822 - Make GetTabChildFrom a class method on TabChild. r=smaug
This commit is contained in:
parent
609c22452f
commit
3d2fa7cabf
@ -279,7 +279,7 @@ DocAccessibleWrap::DoInitialUpdate()
|
||||
// Create window for tab document.
|
||||
if (mDocFlags & eTabDocument) {
|
||||
mozilla::dom::TabChild* tabChild =
|
||||
mozilla::dom::GetTabChildFrom(mDocumentNode->GetShell());
|
||||
mozilla::dom::TabChild::GetFrom(mDocumentNode->GetShell());
|
||||
|
||||
a11y::RootAccessible* rootDocument = RootAccessible();
|
||||
|
||||
|
@ -12731,7 +12731,7 @@ nsDocShell::GetAppId(uint32_t* aAppId)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||
{
|
||||
if (TabChild* tabChild = GetTabChildFrom(this)) {
|
||||
if (TabChild* tabChild = TabChild::GetFrom(this)) {
|
||||
*aOut = tabChild->IsAsyncPanZoomEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2154,7 +2154,7 @@ public:
|
||||
|
||||
// because owner implements nsITabChild, we can assume that it is
|
||||
// the one and only TabChild.
|
||||
TabChild* child = GetTabChildFrom(mWindow->GetDocShell());
|
||||
TabChild* child = TabChild::GetFrom(mWindow->GetDocShell());
|
||||
if (!child) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3173,7 +3173,7 @@ nsDOMDeviceStorage::EnumerateInternal(const nsAString& aPath,
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
// because owner implements nsITabChild, we can assume that it is
|
||||
// the one and only TabChild.
|
||||
TabChild* child = GetTabChildFrom(win->GetDocShell());
|
||||
TabChild* child = TabChild::GetFrom(win->GetDocShell());
|
||||
if (!child) {
|
||||
return cursor.forget();
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ IDBFactory::Create(nsPIDOMWindow* aWindow,
|
||||
factory->mContentParent = aContentParent;
|
||||
|
||||
if (!IndexedDatabaseManager::IsMainProcess()) {
|
||||
TabChild* tabChild = GetTabChildFrom(aWindow);
|
||||
TabChild* tabChild = TabChild::GetFrom(aWindow);
|
||||
NS_ENSURE_TRUE(tabChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
IndexedDBChild* actor = new IndexedDBChild(origin);
|
||||
|
@ -388,13 +388,13 @@ TabChild::Observe(nsISupports *aSubject,
|
||||
{
|
||||
if (!strcmp(aTopic, CANCEL_DEFAULT_PAN_ZOOM)) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell));
|
||||
nsCOMPtr<nsITabChild> tabChild(TabChild::GetFrom(docShell));
|
||||
if (tabChild == this) {
|
||||
mRemoteFrame->CancelDefaultPanZoom();
|
||||
}
|
||||
} else if (!strcmp(aTopic, BROWSER_ZOOM_TO_RECT)) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell));
|
||||
nsCOMPtr<nsITabChild> tabChild(TabChild::GetFrom(docShell));
|
||||
if (tabChild == this) {
|
||||
CSSRect rect;
|
||||
sscanf(NS_ConvertUTF16toUTF8(aData).get(),
|
||||
@ -442,7 +442,7 @@ TabChild::Observe(nsISupports *aSubject,
|
||||
}
|
||||
} else if (!strcmp(aTopic, DETECT_SCROLLABLE_SUBFRAME)) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell));
|
||||
nsCOMPtr<nsITabChild> tabChild(TabChild::GetFrom(docShell));
|
||||
if (tabChild == this) {
|
||||
mRemoteFrame->DetectScrollableSubframe();
|
||||
}
|
||||
|
@ -342,6 +342,33 @@ public:
|
||||
|
||||
void UpdateHitRegion(const nsRegion& aRegion);
|
||||
|
||||
static inline TabChild*
|
||||
GetFrom(nsIDocShell* aDocShell)
|
||||
{
|
||||
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
|
||||
return static_cast<TabChild*>(tc.get());
|
||||
}
|
||||
|
||||
static inline TabChild*
|
||||
GetFrom(nsIPresShell* aPresShell)
|
||||
{
|
||||
nsIDocument* doc = aPresShell->GetDocument();
|
||||
if (!doc) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
||||
return GetFrom(docShell);
|
||||
}
|
||||
|
||||
static inline TabChild*
|
||||
GetFrom(nsIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
|
||||
return GetFrom(docShell);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
|
||||
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
||||
@ -477,33 +504,6 @@ private:
|
||||
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
||||
};
|
||||
|
||||
inline TabChild*
|
||||
GetTabChildFrom(nsIDocShell* aDocShell)
|
||||
{
|
||||
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
|
||||
return static_cast<TabChild*>(tc.get());
|
||||
}
|
||||
|
||||
inline TabChild*
|
||||
GetTabChildFrom(nsIPresShell* aPresShell)
|
||||
{
|
||||
nsIDocument* doc = aPresShell->GetDocument();
|
||||
if (!doc) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
||||
return GetTabChildFrom(docShell);
|
||||
}
|
||||
|
||||
inline TabChild*
|
||||
GetTabChildFrom(nsIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
|
||||
return GetTabChildFrom(docShell);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ Geolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
|
||||
|
||||
// because owner implements nsITabChild, we can assume that it is
|
||||
// the one and only TabChild.
|
||||
TabChild* child = GetTabChildFrom(window->GetDocShell());
|
||||
TabChild* child = TabChild::GetFrom(window->GetDocShell());
|
||||
if (!child) {
|
||||
return false;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ DesktopNotification::Init()
|
||||
|
||||
// because owner implements nsITabChild, we can assume that it is
|
||||
// the one and only TabChild for this docshell.
|
||||
TabChild* child = GetTabChildFrom(GetOwner()->GetDocShell());
|
||||
TabChild* child = TabChild::GetFrom(GetOwner()->GetDocShell());
|
||||
|
||||
// Retain a reference so the object isn't deleted without IPDL's knowledge.
|
||||
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
||||
|
@ -140,7 +140,7 @@ NotificationPermissionRequest::Run()
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
// because owner implements nsITabChild, we can assume that it is
|
||||
// the one and only TabChild.
|
||||
TabChild* child = GetTabChildFrom(mWindow->GetDocShell());
|
||||
TabChild* child = TabChild::GetFrom(mWindow->GetDocShell());
|
||||
if (!child) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
|
||||
|
||||
WindowIdentifier newID(id);
|
||||
newID.AppendProcessID();
|
||||
Hal()->SendVibrate(p, newID.AsArray(), GetTabChildFrom(newID.GetWindow()));
|
||||
Hal()->SendVibrate(p, newID.AsArray(), TabChild::GetFrom(newID.GetWindow()));
|
||||
}
|
||||
|
||||
void
|
||||
@ -62,7 +62,7 @@ CancelVibrate(const WindowIdentifier &id)
|
||||
|
||||
WindowIdentifier newID(id);
|
||||
newID.AppendProcessID();
|
||||
Hal()->SendCancelVibrate(newID.AsArray(), GetTabChildFrom(newID.GetWindow()));
|
||||
Hal()->SendCancelVibrate(newID.AsArray(), TabChild::GetFrom(newID.GetWindow()));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2655,7 +2655,7 @@ nsPresContext::IsCrossProcessRootContentDocument()
|
||||
return true;
|
||||
}
|
||||
|
||||
TabChild* tabChild = GetTabChildFrom(mShell);
|
||||
TabChild* tabChild = TabChild::GetFrom(mShell);
|
||||
return (tabChild && tabChild->IsRootContentDocument());
|
||||
}
|
||||
|
||||
|
@ -4978,7 +4978,7 @@ void PresShell::UpdateCanvasBackground()
|
||||
mCanvasBackgroundColor = GetDefaultBackgroundColorToDraw();
|
||||
}
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
if (TabChild* tabChild = GetTabChildFrom(this)) {
|
||||
if (TabChild* tabChild = TabChild::GetFrom(this)) {
|
||||
tabChild->SetBackgroundColor(mCanvasBackgroundColor);
|
||||
}
|
||||
}
|
||||
@ -5471,7 +5471,7 @@ public:
|
||||
!mFrame || !mShell) {
|
||||
return;
|
||||
}
|
||||
TabChild* tabChild = GetTabChildFrom(mShell);
|
||||
TabChild* tabChild = TabChild::GetFrom(mShell);
|
||||
if (!tabChild || !tabChild->GetUpdateHitRegion()) {
|
||||
return;
|
||||
}
|
||||
@ -9420,7 +9420,7 @@ PresShell::SetIsActive(bool aIsActive)
|
||||
// and (ii) has easy access to the TabChild. So we use this
|
||||
// notification to signal the TabChild to drop its layer tree and
|
||||
// stop trying to repaint.
|
||||
if (TabChild* tab = GetTabChildFrom(this)) {
|
||||
if (TabChild* tab = TabChild::GetFrom(this)) {
|
||||
if (aIsActive) {
|
||||
tab->MakeVisible();
|
||||
if (!mIsZombie) {
|
||||
@ -9561,7 +9561,7 @@ nsIPresShell::RecomputeFontSizeInflationEnabled()
|
||||
|
||||
// Force-enabling font inflation always trumps the heuristics here.
|
||||
if (!FontSizeInflationForceEnabled()) {
|
||||
if (TabChild* tab = GetTabChildFrom(this)) {
|
||||
if (TabChild* tab = TabChild::GetFrom(this)) {
|
||||
// We're in a child process. Cancel inflation if we're not
|
||||
// async-pan zoomed.
|
||||
if (!tab->IsAsyncPanZoomEnabled()) {
|
||||
|
@ -614,7 +614,7 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||
nsCString(aMimeContentType),
|
||||
disp, aForceSave, contentLength,
|
||||
referrerParams,
|
||||
mozilla::dom::GetTabChildFrom(window));
|
||||
mozilla::dom::TabChild::GetFrom(window));
|
||||
ExternalHelperAppChild *childListener = static_cast<ExternalHelperAppChild *>(pc);
|
||||
|
||||
NS_ADDREF(*aStreamListener = childListener);
|
||||
|
Loading…
Reference in New Issue
Block a user