Skip to content

Commit

Permalink
merge mozilla-inbound to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Dec 16, 2016
2 parents 863e873 + 6fce618 commit a244c7f
Show file tree
Hide file tree
Showing 116 changed files with 2,054 additions and 888 deletions.
2 changes: 1 addition & 1 deletion accessible/aom/AccessibleNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ AccessibleNode::GetStates(nsTArray<nsString>& aStates)
return;
}

mStates->Add(NS_LITERAL_STRING("defunct"));
aStates.AppendElement(NS_LITERAL_STRING("defunct"));
}

bool
Expand Down
14 changes: 7 additions & 7 deletions accessible/base/DocManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,19 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
DocAccessibleChild* ipcDoc = new DocAccessibleChild(docAcc);
docAcc->SetIPCDoc(ipcDoc);

#if defined(XP_WIN)
IAccessibleHolder holder(CreateHolderFromAccessible(docAcc));
#endif

static_cast<TabChild*>(tabChild.get())->
SendPDocAccessibleConstructor(ipcDoc, nullptr, 0,
#if defined(XP_WIN)
AccessibleWrap::GetChildIDFor(docAcc)
AccessibleWrap::GetChildIDFor(docAcc),
holder
#else
0
0, 0
#endif
);

#if defined(XP_WIN)
IAccessibleHolder holder(CreateHolderFromAccessible(docAcc));
ipcDoc->SendCOMProxy(holder);
#endif
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions accessible/base/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,19 +854,20 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)

ipcDoc = new DocAccessibleChild(childDoc);
childDoc->SetIPCDoc(ipcDoc);

#if defined(XP_WIN)
MOZ_ASSERT(parentIPCDoc);
parentIPCDoc->ConstructChildDocInParentProcess(ipcDoc, id,
AccessibleWrap::GetChildIDFor(childDoc));
#else
nsCOMPtr<nsITabChild> tabChild =
do_GetInterface(mDocument->DocumentNode()->GetDocShell());
if (tabChild) {
MOZ_ASSERT(parentIPCDoc);
static_cast<TabChild*>(tabChild.get())->
SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id,
#if defined(XP_WIN)
AccessibleWrap::GetChildIDFor(childDoc)
#else
0
#endif
);
SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id, 0, 0);
}
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion accessible/ipc/DocAccessibleChildBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent)
nsTArray<AccessibleData> shownTree;
ShowEventData data(parentID, idxInParent, shownTree);
SerializeTree(aShowEvent->GetAccessible(), data.NewTree());
SendShowEvent(data, aShowEvent->IsFromUserInput());
MaybeSendShowEvent(data, aShowEvent->IsFromUserInput());
}

} // namespace a11y
Expand Down
17 changes: 14 additions & 3 deletions accessible/ipc/DocAccessibleChildBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "mozilla/a11y/DocAccessible.h"
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "mozilla/Unused.h"
#include "nsISupportsImpl.h"

namespace mozilla {
Expand Down Expand Up @@ -38,10 +39,9 @@ class DocAccessibleChildBase : public PDocAccessibleChild
MOZ_COUNT_DTOR(DocAccessibleChildBase);
}

void Shutdown()
virtual void Shutdown()
{
mDoc->SetIPCDoc(nullptr);
mDoc = nullptr;
DetachDocument();
SendShutdown();
}

Expand All @@ -61,6 +61,17 @@ class DocAccessibleChildBase : public PDocAccessibleChild
static uint32_t InterfacesFor(Accessible* aAcc);
static void SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree);

virtual void MaybeSendShowEvent(ShowEventData& aData, bool aFromUser)
{ Unused << SendShowEvent(aData, aFromUser); }

void DetachDocument()
{
if (mDoc) {
mDoc->SetIPCDoc(nullptr);
mDoc = nullptr;
}
}

DocAccessible* mDoc;
};

Expand Down
26 changes: 16 additions & 10 deletions accessible/ipc/DocAccessibleParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,25 +467,31 @@ DocAccessibleParent::GetXPCAccessible(ProxyAccessible* aProxy)
#if defined(XP_WIN)
/**
* @param aCOMProxy COM Proxy to the document in the content process.
* @param aParentCOMProxy COM Proxy to the OuterDocAccessible that is
* the parent of the document. The content process will use this
* proxy when traversing up across the content/chrome boundary.
*/
mozilla::ipc::IPCResult
DocAccessibleParent::RecvCOMProxy(const IAccessibleHolder& aCOMProxy,
IAccessibleHolder* aParentCOMProxy)
void
DocAccessibleParent::SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy)
{
RefPtr<IAccessible> ptr(aCOMProxy.Get());
SetCOMInterface(ptr);
SetCOMInterface(aCOMProxy);

// Make sure that we're not racing with a tab shutdown
auto tab = static_cast<dom::TabParent*>(Manager());
MOZ_ASSERT(tab);
if (tab->IsDestroyed()) {
return;
}

Accessible* outerDoc = OuterDocOfRemoteBrowser();
MOZ_ASSERT(outerDoc);

IAccessible* rawNative = nullptr;
if (outerDoc) {
outerDoc->GetNativeInterface((void**) &rawNative);
MOZ_ASSERT(rawNative);
}

aParentCOMProxy->Set(IAccessibleHolder::COMPtrType(rawNative));
return IPC_OK();
IAccessibleHolder::COMPtrType ptr(rawNative);
IAccessibleHolder holder(Move(ptr));
Unused << SendParentCOMProxy(holder);
}

mozilla::ipc::IPCResult
Expand Down
5 changes: 2 additions & 3 deletions accessible/ipc/DocAccessibleParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class DocAccessibleParent : public ProxyAccessible,
*/
void RemoveChildDoc(DocAccessibleParent* aChildDoc)
{
aChildDoc->Parent()->SetChildDoc(nullptr);
aChildDoc->Parent()->ClearChildDoc(aChildDoc);
mChildDocs.RemoveElement(aChildDoc);
aChildDoc->mParentDoc = nullptr;
MOZ_ASSERT(aChildDoc->mChildDocs.Length() == 0);
Expand Down Expand Up @@ -143,8 +143,7 @@ class DocAccessibleParent : public ProxyAccessible,
{ return mChildDocs[aIdx]; }

#if defined(XP_WIN)
virtual mozilla::ipc::IPCResult RecvCOMProxy(const IAccessibleHolder& aCOMProxy,
IAccessibleHolder* aParentCOMProxy) override;
void SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy);

virtual mozilla::ipc::IPCResult RecvGetWindowedPluginIAccessible(
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override;
Expand Down
49 changes: 49 additions & 0 deletions accessible/ipc/IPCTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_a11y_IPCTypes_h
#define mozilla_a11y_IPCTypes_h

/**
* Since IPDL does not support preprocessing, this header file allows us to
* define types used by PDocAccessible differently depending on platform.
*/

#if defined(XP_WIN) && defined(ACCESSIBILITY)

// So that we don't include a bunch of other Windows junk.
#if !defined(COM_NO_WINDOWS_H)
#define COM_NO_WINDOWS_H
#endif // !defined(COM_NO_WINDOWS_H)

// COM headers pull in MSXML which conflicts with our own XMLDocument class.
// This define excludes those conflicting definitions.
#if !defined(__XMLDocument_FWD_DEFINED__)
#define __XMLDocument_FWD_DEFINED__
#endif // !defined(__XMLDocument_FWD_DEFINED__)

#include "mozilla/a11y/COMPtrTypes.h"

// This define in rpcndr.h messes up our code, so we must undefine it after
// COMPtrTypes.h has been included.
#if defined(small)
#undef small
#endif // defined(small)

#else

namespace mozilla {
namespace a11y {

typedef uint32_t IAccessibleHolder;

} // namespace a11y
} // namespace mozilla

#endif // defined(XP_WIN) && defined(ACCESSIBILITY)

#endif // mozilla_a11y_IPCTypes_h

30 changes: 23 additions & 7 deletions accessible/ipc/ProxyAccessibleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,31 @@ ProxyAccessibleBase<Derived>::Shutdown()

template <class Derived>
void
ProxyAccessibleBase<Derived>::SetChildDoc(DocAccessibleParent* aParent)
ProxyAccessibleBase<Derived>::SetChildDoc(DocAccessibleParent* aChildDoc)
{
if (aParent) {
MOZ_ASSERT(mChildren.IsEmpty());
mChildren.AppendElement(aParent);
mOuterDoc = true;
// DocAccessibleParent::AddChildDoc tolerates replacing one document with
// another. We must reflect that here.
MOZ_ASSERT(aChildDoc);
MOZ_ASSERT(mChildren.Length() <= 1);
if (mChildren.IsEmpty()) {
mChildren.AppendElement(aChildDoc);
} else {
MOZ_ASSERT(mChildren.Length() == 1);
mChildren.Clear();
mChildren.ReplaceElementAt(0, aChildDoc);
}
mOuterDoc = true;
}

template <class Derived>
void
ProxyAccessibleBase<Derived>::ClearChildDoc(DocAccessibleParent* aChildDoc)
{
MOZ_ASSERT(aChildDoc);
// This is possible if we're replacing one document with another: Doc 1
// has not had a chance to remove itself, but was already replaced by Doc 2
// in SetChildDoc(). This could result in two subsequent calls to
// ClearChildDoc() even though mChildren.Length() == 1.
MOZ_ASSERT(mChildren.Length() <= 1);
if (mChildren.RemoveElement(aChildDoc)) {
mOuterDoc = false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion accessible/ipc/ProxyAccessibleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class ProxyAccessibleBase

void Shutdown();

void SetChildDoc(DocAccessibleParent*);
void SetChildDoc(DocAccessibleParent* aChildDoc);
void ClearChildDoc(DocAccessibleParent* aChildDoc);

/**
* Remove The given child.
Expand Down
4 changes: 4 additions & 0 deletions accessible/ipc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ else:
'/accessible/other',
]

EXPORTS.mozilla.a11y += [
'IPCTypes.h',
]

if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']

Expand Down
Loading

0 comments on commit a244c7f

Please sign in to comment.