Bug 1543013 - part 2: Make accessible use mozilla::PresShell directly rather than via nsIPresShell r=Jamie

This patch makes accessible module use `mozilla::PresShell` directly rather
than via `nsIPresShell`.  Additionally, renames `DocAccessible::PresShell()`
to `DocAccessible::PresShellPtr()` for avoiding conflict with using
`PresShell` in it and its sub classes.

Differential Revision: https://phabricator.services.mozilla.com/D26663

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-04-13 12:13:15 +00:00
Родитель 09fd54444c
Коммит d8d0bcab65
39 изменённых файлов: 160 добавлений и 95 удалений

Просмотреть файл

@ -13,7 +13,9 @@
#include "nsAccUtils.h"
#include "nsIPersistentProperties2.h"
#include "SessionAccessibility.h"
#include "mozilla/PresShell.h"
using namespace mozilla;
using namespace mozilla::a11y;
const uint32_t kCacheRefreshInterval = 500;
@ -22,8 +24,7 @@ const uint32_t kCacheRefreshInterval = 500;
// DocAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::DocAccessibleWrap(Document* aDocument,
nsIPresShell* aPresShell)
DocAccessibleWrap::DocAccessibleWrap(Document* aDocument, PresShell* aPresShell)
: DocAccessible(aDocument, aPresShell) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocument->GetDocShell());
@ -84,14 +85,11 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
void* aDocAccParam) {
RefPtr<DocAccessibleWrap> docAcc(
dont_AddRef(reinterpret_cast<DocAccessibleWrap*>(aDocAccParam)));
if (!docAcc) {
if (!docAcc || docAcc->HasShutdown()) {
return;
}
nsIPresShell* presShell = docAcc->PresShell();
if (!presShell) {
return;
}
PresShell* presShell = docAcc->PresShellPtr();
nsIFrame* rootFrame = presShell->GetRootFrame();
if (!rootFrame) {
return;

Просмотреть файл

@ -10,11 +10,14 @@
#include "nsITimer.h"
namespace mozilla {
class PresShell;
namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(Document* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(Document* aDocument, PresShell* aPresShell);
virtual ~DocAccessibleWrap();
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;

Просмотреть файл

@ -10,11 +10,13 @@
#include "DocAccessibleParent.h"
#include "ProxyAccessibleWrap.h"
#include "SessionAccessibility.h"
#include "mozilla/PresShell.h"
using namespace mozilla;
using namespace mozilla::a11y;
RootAccessibleWrap::RootAccessibleWrap(mozilla::dom::Document* aDoc,
nsIPresShell* aPresShell)
RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDoc,
PresShell* aPresShell)
: RootAccessible(aDoc, aPresShell) {}
RootAccessibleWrap::~RootAccessibleWrap() {}

Просмотреть файл

@ -9,13 +9,16 @@
#include "RootAccessible.h"
namespace mozilla {
class PresShell;
namespace a11y {
class DocProxyAccessibleWrap;
class RootAccessibleWrap : public RootAccessible {
public:
RootAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
RootAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell);
virtual ~RootAccessibleWrap();
AccessibleWrap* GetContentAccessible();

Просмотреть файл

@ -15,6 +15,7 @@
#include "nsViewManager.h"
#include "nsIPersistentProperties2.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#include "mozilla/a11y/DocManager.h"
@ -133,8 +134,7 @@ SessionAccessibility* SessionAccessibility::GetInstanceFor(
SessionAccessibility* SessionAccessibility::GetInstanceFor(
Accessible* aAccessible) {
RootAccessible* rootAcc = aAccessible->RootAccessible();
nsIPresShell* shell = rootAcc->PresShell();
nsViewManager* vm = shell->GetViewManager();
nsViewManager* vm = rootAcc->PresShellPtr()->GetViewManager();
if (!vm) {
return nullptr;
}

Просмотреть файл

@ -6,7 +6,9 @@
#include "nsMai.h"
#include "DocAccessibleWrap.h"
#include "mozilla/PresShell.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -14,7 +16,7 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::DocAccessibleWrap(dom::Document* aDocument,
nsIPresShell* aPresShell)
PresShell* aPresShell)
: DocAccessible(aDocument, aPresShell), mActivated(false) {}
DocAccessibleWrap::~DocAccessibleWrap() {}

Просмотреть файл

@ -14,11 +14,14 @@
#include "DocAccessible.h"
namespace mozilla {
class PresShell;
namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell);
virtual ~DocAccessibleWrap();
bool mActivated;

Просмотреть файл

@ -41,11 +41,15 @@ class DocManager : public nsIWebProgressListener,
/**
* Return document accessible for the given presshell.
*/
DocAccessible* GetDocAccessible(const nsIPresShell* aPresShell) {
if (!aPresShell) return nullptr;
DocAccessible* GetDocAccessible(const PresShell* aPresShell) {
if (!aPresShell) {
return nullptr;
}
DocAccessible* doc = aPresShell->GetDocAccessible();
if (doc) return doc;
if (doc) {
return doc;
}
return GetDocAccessible(aPresShell->GetDocument());
}

Просмотреть файл

@ -13,6 +13,7 @@
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/Element.h"
#include "mozilla/PresShell.h"
#include "mozilla/Telemetry.h"
using namespace mozilla;
@ -24,7 +25,7 @@ using namespace mozilla::dom;
////////////////////////////////////////////////////////////////////////////////
NotificationController::NotificationController(DocAccessible* aDocument,
nsIPresShell* aPresShell)
PresShell* aPresShell)
: EventQueue(aDocument),
mObservingState(eNotObservingRefresh),
mPresShell(aPresShell),

Просмотреть файл

@ -20,6 +20,9 @@
#endif
namespace mozilla {
class PresShell;
namespace a11y {
class DocAccessible;
@ -89,7 +92,7 @@ class TNotification : public Notification {
class NotificationController final : public EventQueue,
public nsARefreshObserver {
public:
NotificationController(DocAccessible* aDocument, nsIPresShell* aPresShell);
NotificationController(DocAccessible* aDocument, PresShell* aPresShell);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override;
NS_IMETHOD_(MozExternalRefCountType) Release(void) override;
@ -334,7 +337,7 @@ class NotificationController final : public EventQueue,
/**
* The presshell of the document accessible.
*/
nsIPresShell* mPresShell;
PresShell* mPresShell;
/**
* Child documents that needs to be bound to the tree.

Просмотреть файл

@ -79,7 +79,7 @@ void SelectionManager::SetControlSelectionListener(dom::Element* aFocusedElm) {
mCurrCtrlSpellSel = spellSel;
}
void SelectionManager::AddDocSelectionListener(nsIPresShell* aPresShell) {
void SelectionManager::AddDocSelectionListener(PresShell* aPresShell) {
const nsFrameSelection* frameSel = aPresShell->ConstFrameSelection();
// Register 'this' as selection listener for the normal selection.
@ -91,7 +91,7 @@ void SelectionManager::AddDocSelectionListener(nsIPresShell* aPresShell) {
spellSel->AddSelectionListener(this);
}
void SelectionManager::RemoveDocSelectionListener(nsIPresShell* aPresShell) {
void SelectionManager::RemoveDocSelectionListener(PresShell* aPresShell) {
const nsFrameSelection* frameSel = aPresShell->ConstFrameSelection();
// Remove 'this' registered as selection listener for the normal selection.

Просмотреть файл

@ -10,10 +10,10 @@
#include "nsISelectionListener.h"
#include "mozilla/WeakPtr.h"
class nsIPresShell;
namespace mozilla {
class PresShell;
namespace dom {
class Element;
class Selection;
@ -70,12 +70,12 @@ class SelectionManager : public nsISelectionListener {
/**
* Listen to selection events on the document.
*/
void AddDocSelectionListener(nsIPresShell* aPresShell);
void AddDocSelectionListener(PresShell* aPresShell);
/**
* Stop listening to selection events for a given document
*/
void RemoveDocSelectionListener(nsIPresShell* aShell);
void RemoveDocSelectionListener(PresShell* aPresShell);
/**
* Process delayed event, results in caret move and text selection change

Просмотреть файл

@ -18,6 +18,8 @@
namespace mozilla {
class PresShell;
namespace dom {
class Element;
}
@ -114,8 +116,8 @@ class nsAccUtils {
* Return document accessible for the given DOM node.
*/
static DocAccessible* GetDocAccessibleFor(nsINode* aNode) {
nsIPresShell* presShell = nsCoreUtils::GetPresShellFor(aNode);
return GetAccService()->GetDocAccessible(presShell);
return GetAccService()->GetDocAccessible(
nsCoreUtils::GetPresShellFor(aNode));
}
/**

Просмотреть файл

@ -464,7 +464,7 @@ already_AddRefed<Accessible> nsAccessibilityService::CreatePluginAccessible(
return nullptr;
}
void nsAccessibilityService::DeckPanelSwitched(nsIPresShell* aPresShell,
void nsAccessibilityService::DeckPanelSwitched(PresShell* aPresShell,
nsIContent* aDeckNode,
nsIFrame* aPrevBoxFrame,
nsIFrame* aCurrentBoxFrame) {
@ -502,7 +502,7 @@ void nsAccessibilityService::DeckPanelSwitched(nsIPresShell* aPresShell,
}
}
void nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell,
void nsAccessibilityService::ContentRangeInserted(PresShell* aPresShell,
nsIContent* aStartChild,
nsIContent* aEndChild) {
DocAccessible* document = GetDocAccessible(aPresShell);
@ -524,7 +524,7 @@ void nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell,
}
}
void nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell,
void nsAccessibilityService::ContentRemoved(PresShell* aPresShell,
nsIContent* aChildNode) {
DocAccessible* document = GetDocAccessible(aPresShell);
#ifdef A11Y_LOG
@ -548,13 +548,13 @@ void nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell,
#endif
}
void nsAccessibilityService::UpdateText(nsIPresShell* aPresShell,
void nsAccessibilityService::UpdateText(PresShell* aPresShell,
nsIContent* aContent) {
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) document->UpdateText(aContent);
}
void nsAccessibilityService::TreeViewChanged(nsIPresShell* aPresShell,
void nsAccessibilityService::TreeViewChanged(PresShell* aPresShell,
nsIContent* aContent,
nsITreeView* aView) {
DocAccessible* document = GetDocAccessible(aPresShell);
@ -567,7 +567,7 @@ void nsAccessibilityService::TreeViewChanged(nsIPresShell* aPresShell,
}
}
void nsAccessibilityService::RangeValueChanged(nsIPresShell* aPresShell,
void nsAccessibilityService::RangeValueChanged(PresShell* aPresShell,
nsIContent* aContent) {
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) {
@ -579,7 +579,7 @@ void nsAccessibilityService::RangeValueChanged(nsIPresShell* aPresShell,
}
}
void nsAccessibilityService::UpdateListBullet(nsIPresShell* aPresShell,
void nsAccessibilityService::UpdateListBullet(PresShell* aPresShell,
nsIContent* aHTMLListItemContent,
bool aHasBullet) {
DocAccessible* document = GetDocAccessible(aPresShell);
@ -611,7 +611,7 @@ void nsAccessibilityService::UpdateImageMap(nsImageFrame* aImageFrame) {
}
}
void nsAccessibilityService::UpdateLabelValue(nsIPresShell* aPresShell,
void nsAccessibilityService::UpdateLabelValue(PresShell* aPresShell,
nsIContent* aLabelElm,
const nsString& aNewValue) {
DocAccessible* document = GetDocAccessible(aPresShell);
@ -626,7 +626,7 @@ void nsAccessibilityService::UpdateLabelValue(nsIPresShell* aPresShell,
}
}
void nsAccessibilityService::PresShellActivated(nsIPresShell* aPresShell) {
void nsAccessibilityService::PresShellActivated(PresShell* aPresShell) {
DocAccessible* document = aPresShell->GetDocAccessible();
if (document) {
RootAccessible* rootDocument = document->RootAccessible();
@ -635,7 +635,7 @@ void nsAccessibilityService::PresShellActivated(nsIPresShell* aPresShell) {
}
}
void nsAccessibilityService::RecreateAccessible(nsIPresShell* aPresShell,
void nsAccessibilityService::RecreateAccessible(PresShell* aPresShell,
nsIContent* aContent) {
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) document->RecreateAccessible(aContent);

Просмотреть файл

@ -158,38 +158,38 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
* Notification used to update the accessible tree when deck panel is
* switched.
*/
void DeckPanelSwitched(nsIPresShell* aPresShell, nsIContent* aDeckNode,
void DeckPanelSwitched(mozilla::PresShell* aPresShell, nsIContent* aDeckNode,
nsIFrame* aPrevBoxFrame, nsIFrame* aCurrentBoxFrame);
/**
* Notification used to update the accessible tree when new content is
* inserted.
*/
void ContentRangeInserted(nsIPresShell* aPresShell, nsIContent* aStartChild,
nsIContent* aEndChild);
void ContentRangeInserted(mozilla::PresShell* aPresShell,
nsIContent* aStartChild, nsIContent* aEndChild);
/**
* Notification used to update the accessible tree when content is removed.
*/
void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aChild);
void ContentRemoved(mozilla::PresShell* aPresShell, nsIContent* aChild);
void UpdateText(nsIPresShell* aPresShell, nsIContent* aContent);
void UpdateText(mozilla::PresShell* aPresShell, nsIContent* aContent);
/**
* Update XUL:tree accessible tree when treeview is changed.
*/
void TreeViewChanged(nsIPresShell* aPresShell, nsIContent* aContent,
void TreeViewChanged(mozilla::PresShell* aPresShell, nsIContent* aContent,
nsITreeView* aView);
/**
* Notify of input@type="element" value change.
*/
void RangeValueChanged(nsIPresShell* aPresShell, nsIContent* aContent);
void RangeValueChanged(mozilla::PresShell* aPresShell, nsIContent* aContent);
/**
* Update list bullet accessible.
*/
void UpdateListBullet(nsIPresShell* aPresShell,
void UpdateListBullet(mozilla::PresShell* aPresShell,
nsIContent* aHTMLListItemContent, bool aHasBullet);
/**
@ -200,7 +200,7 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
/**
* Update the label accessible tree when rendered @value is changed.
*/
void UpdateLabelValue(nsIPresShell* aPresShell, nsIContent* aLabelElm,
void UpdateLabelValue(mozilla::PresShell* aPresShell, nsIContent* aLabelElm,
const nsString& aNewValue);
/**
@ -212,12 +212,12 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
/**
* Notify that presshell is activated.
*/
void PresShellActivated(nsIPresShell* aPresShell);
void PresShellActivated(mozilla::PresShell* aPresShell);
/**
* Recreate an accessible for the given content node in the presshell.
*/
void RecreateAccessible(nsIPresShell* aPresShell, nsIContent* aContent);
void RecreateAccessible(mozilla::PresShell* aPresShell, nsIContent* aContent);
void FireAccessibleEvent(uint32_t aEvent, Accessible* aTarget);

Просмотреть файл

@ -115,7 +115,7 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree, int32_t aRowIndex,
void nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, nsIPresShell *aPresShell,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget) {
WidgetMouseEvent event(true, aMessage, aRootWidget, WidgetMouseEvent::eReal,
WidgetMouseEvent::eNormal);
@ -133,7 +133,7 @@ void nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX,
void nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, nsIPresShell *aPresShell,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget) {
nsIDocShell *docShell = nullptr;
if (aPresShell->GetDocument()) {
@ -505,7 +505,7 @@ bool nsCoreUtils::IsColumnHidden(nsTreeColumn *aColumn) {
nsGkAtoms::_true, eCaseMatters);
}
void nsCoreUtils::ScrollTo(nsIPresShell *aPresShell, nsIContent *aContent,
void nsCoreUtils::ScrollTo(PresShell *aPresShell, nsIContent *aContent,
uint32_t aScrollType) {
nsIPresShell::ScrollAxis vertical, horizontal;
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);

Просмотреть файл

@ -7,7 +7,6 @@
#define nsCoreUtils_h_
#include "mozilla/EventForwards.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Element.h"
#include "nsIAccessibleEvent.h"
#include "nsIContent.h"
@ -23,6 +22,7 @@ class nsIDocShell;
class nsIWidget;
namespace mozilla {
class PresShell;
namespace dom {
class XULTreeElement;
}
@ -33,6 +33,7 @@ class XULTreeElement;
*/
class nsCoreUtils {
public:
typedef mozilla::PresShell PresShell;
typedef mozilla::dom::Document Document;
/**
@ -74,7 +75,7 @@ class nsCoreUtils {
MOZ_CAN_RUN_SCRIPT
static void DispatchMouseEvent(mozilla::EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, nsIPresShell *aPresShell,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget);
/**
@ -91,7 +92,7 @@ class nsCoreUtils {
MOZ_CAN_RUN_SCRIPT
static void DispatchTouchEvent(mozilla::EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, nsIPresShell *aPresShell,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget);
/**
@ -214,7 +215,7 @@ class nsCoreUtils {
/**
* Return presShell for the document containing the given DOM node.
*/
static nsIPresShell *GetPresShellFor(nsINode *aNode) {
static PresShell *GetPresShellFor(nsINode *aNode) {
return aNode->OwnerDoc()->GetPresShell();
}
@ -286,7 +287,7 @@ class nsCoreUtils {
* Scroll content into view.
*/
MOZ_CAN_RUN_SCRIPT
static void ScrollTo(nsIPresShell *aPresShell, nsIContent *aContent,
static void ScrollTo(PresShell *aPresShell, nsIContent *aContent,
uint32_t aScrollType);
/**

Просмотреть файл

@ -10,6 +10,7 @@
#include "DocAccessible.h"
#include "ARIAMap.h"
#include "nsCoreUtils.h"
#include "mozilla/PresShell.h"
#ifdef A11Y_LOG
# include "Logging.h"
@ -91,7 +92,7 @@ inline bool Accessible::IsDefunct() const {
inline void Accessible::ScrollTo(uint32_t aHow) const {
if (mContent) {
nsCOMPtr<nsIPresShell> presShell = mDoc->PresShell();
RefPtr<PresShell> presShell = mDoc->PresShellPtr();
nsCOMPtr<nsIContent> content = mContent;
nsCoreUtils::ScrollTo(presShell, content, aHow);
}

Просмотреть файл

@ -1829,7 +1829,7 @@ void Accessible::DispatchClickEvent(nsIContent* aContent,
uint32_t aActionIndex) const {
if (IsDefunct()) return;
nsCOMPtr<nsIPresShell> presShell = mDoc->PresShell();
RefPtr<PresShell> presShell = mDoc->PresShellPtr();
// Scroll into view.
presShell->ScrollContentIntoView(aContent, nsIPresShell::ScrollAxis(),

Просмотреть файл

@ -70,7 +70,8 @@ static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs);
////////////////////////////////////////////////////////////////////////////////
// Constructor/desctructor
DocAccessible::DocAccessible(dom::Document* aDocument, nsIPresShell* aPresShell)
DocAccessible::DocAccessible(dom::Document* aDocument,
PresShell* aPresShell)
: // XXX don't pass a document to the Accessible constructor so that we
// don't set mDoc until our vtable is fully setup. If we set mDoc before
// setting up the vtable we will call Accessible::AddRef() but not the
@ -379,8 +380,9 @@ void DocAccessible::Init() {
}
void DocAccessible::Shutdown() {
if (!mPresShell) // already shutdown
if (!mPresShell) { // already shutdown
return;
}
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDocDestroy))
@ -452,7 +454,9 @@ void DocAccessible::Shutdown() {
nsIFrame* DocAccessible::GetFrame() const {
nsIFrame* root = nullptr;
if (mPresShell) root = mPresShell->GetRootFrame();
if (mPresShell) {
root = mPresShell->GetRootFrame();
}
return root;
}
@ -466,7 +470,7 @@ nsRect DocAccessible::RelativeBounds(nsIFrame** aRelativeFrame) const {
nsRect bounds;
while (document) {
mozilla::PresShell* presShell = document->GetPresShell();
PresShell* presShell = document->GetPresShell();
if (!presShell) {
return nsRect();
}
@ -1103,7 +1107,9 @@ nsresult DocAccessible::HandleAccEvent(AccEvent* aEvent) {
// Public members
void* DocAccessible::GetNativeWindow() const {
if (!mPresShell) return nullptr;
if (!mPresShell) {
return nullptr;
}
nsViewManager* vm = mPresShell->GetViewManager();
if (!vm) return nullptr;

Просмотреть файл

@ -27,6 +27,7 @@ const uint32_t kDefaultCacheLength = 128;
namespace mozilla {
class PresShell;
class TextEditor;
namespace dom {
@ -58,7 +59,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
typedef mozilla::dom::Document Document;
public:
DocAccessible(Document* aDocument, nsIPresShell* aPresShell);
DocAccessible(Document* aDocument, PresShell* aPresShell);
// nsIScrollPositionListener
virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) override {}
@ -124,10 +125,18 @@ class DocAccessible : public HyperTextAccessibleWrap,
*/
nsIAccessiblePivot* VirtualCursor();
/**
* Returns true if the instance has shutdown.
*/
bool HasShutdown() const { return !mPresShell; }
/**
* Return presentation shell for this document accessible.
*/
nsIPresShell* PresShell() const { return mPresShell; }
PresShell* PresShellPtr() const {
MOZ_DIAGNOSTIC_ASSERT(!HasShutdown());
return mPresShell;
}
/**
* Return the presentation shell's context.
@ -710,7 +719,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
friend class NotificationController;
private:
nsIPresShell* mPresShell;
PresShell* mPresShell;
// Exclusively owned by IPDL so don't manually delete it!
DocAccessibleChild* mIPCDoc;

Просмотреть файл

@ -1418,7 +1418,7 @@ int32_t HyperTextAccessible::CaretLineNumber() {
LayoutDeviceIntRect HyperTextAccessible::GetCaretRect(nsIWidget** aWidget) {
*aWidget = nullptr;
RefPtr<nsCaret> caret = mDoc->PresShell()->GetCaret();
RefPtr<nsCaret> caret = mDoc->PresShellPtr()->GetCaret();
NS_ENSURE_TRUE(caret, LayoutDeviceIntRect());
bool isVisible = caret->IsVisible();

Просмотреть файл

@ -59,7 +59,7 @@ NS_IMPL_ISUPPORTS_INHERITED(RootAccessible, DocAccessible, nsIDOMEventListener)
////////////////////////////////////////////////////////////////////////////////
// Constructor/destructor
RootAccessible::RootAccessible(Document* aDocument, nsIPresShell* aPresShell)
RootAccessible::RootAccessible(Document* aDocument, PresShell* aPresShell)
: DocAccessibleWrap(aDocument, aPresShell) {
mType = eRootType;
}
@ -444,8 +444,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
void RootAccessible::Shutdown() {
// Called manually or by Accessible::LastRelease()
if (!PresShell()) return; // Already shutdown
if (HasShutdown()) {
return;
}
DocAccessibleWrap::Shutdown();
}

Просмотреть файл

@ -12,13 +12,16 @@
#include "nsIDOMEventListener.h"
namespace mozilla {
class PresShell;
namespace a11y {
class RootAccessible : public DocAccessibleWrap, public nsIDOMEventListener {
NS_DECL_ISUPPORTS_INHERITED
public:
RootAccessible(dom::Document* aDocument, nsIPresShell* aPresShell);
RootAccessible(dom::Document* aDocument, PresShell* aPresShell);
// nsIDOMEventListener
NS_DECL_NSIDOMEVENTLISTENER

Просмотреть файл

@ -17,6 +17,7 @@
#include "States.h"
#include "TreeWalker.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "nsIHTMLCollection.h"
#include "mozilla/dom/Document.h"
@ -699,7 +700,7 @@ nsresult HTMLTableAccessible::AddRowOrColumnToSelection(
else
count = RowCount();
nsIPresShell* presShell(mDoc->PresShell());
PresShell* presShell = mDoc->PresShellPtr();
RefPtr<nsFrameSelection> tableSelection =
const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
@ -721,7 +722,7 @@ nsresult HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(
nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
if (!tableFrame) return NS_OK;
nsIPresShell* presShell(mDoc->PresShell());
PresShell* presShell = mDoc->PresShellPtr();
RefPtr<nsFrameSelection> tableSelection =
const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());

Просмотреть файл

@ -7,7 +7,6 @@
interface nsIAccessible;
interface nsIWeakReference;
interface nsIPresShell;
interface nsIAccessiblePivot;
webidl Node;

Просмотреть файл

@ -21,6 +21,7 @@
#ifdef MOZ_ACCESSIBILITY_ATK
# include "AccessibleWrap.h"
#endif
#include "mozilla/PresShell.h"
namespace mozilla {
namespace a11y {
@ -245,7 +246,7 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvScrollTo(
const uint64_t& aID, const uint32_t& aScrollType) {
Accessible* acc = IdToAccessible(aID);
if (acc) {
nsCOMPtr<nsIPresShell> presShell = acc->Document()->PresShell();
RefPtr<PresShell> presShell = acc->Document()->PresShellPtr();
nsCOMPtr<nsIContent> content = acc->GetContent();
nsCoreUtils::ScrollTo(presShell, content, aScrollType);
}

Просмотреть файл

@ -9,11 +9,14 @@
#include "DocAccessible.h"
namespace mozilla {
class PresShell;
namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell);
virtual ~DocAccessibleWrap();
};

Просмотреть файл

@ -7,9 +7,10 @@
#import "mozAccessible.h"
using namespace mozilla;
using namespace mozilla::a11y;
DocAccessibleWrap::DocAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell)
DocAccessibleWrap::DocAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell)
: DocAccessible(aDocument, aPresShell) {}
DocAccessibleWrap::~DocAccessibleWrap() {}

Просмотреть файл

@ -13,11 +13,14 @@
#include "RootAccessible.h"
namespace mozilla {
class PresShell;
namespace a11y {
class RootAccessibleWrap : public RootAccessible {
public:
RootAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
RootAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell);
virtual ~RootAccessibleWrap();
Class GetNativeType();

Просмотреть файл

@ -13,9 +13,10 @@
#include "nsView.h"
#include "nsIWidget.h"
using namespace mozilla;
using namespace mozilla::a11y;
RootAccessibleWrap::RootAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell)
RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell)
: RootAccessible(aDocument, aPresShell) {}
RootAccessibleWrap::~RootAccessibleWrap() {}

Просмотреть файл

@ -22,6 +22,7 @@
#include "TextRange-inl.h"
#include "nsAccessibilityService.h"
#include "mozilla/PresShell.h"
#include "nsIPersistentProperties2.h"
#include "nsISimpleEnumerator.h"
@ -187,7 +188,7 @@ ia2Accessible::scrollTo(enum IA2ScrollType aScrollType) {
if (acc->IsDefunct()) return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy());
nsCOMPtr<nsIPresShell> presShell = acc->Document()->PresShell();
RefPtr<PresShell> presShell = acc->Document()->PresShellPtr();
nsCOMPtr<nsIContent> content = acc->GetContent();
nsCoreUtils::ScrollTo(presShell, content, aScrollType);

Просмотреть файл

@ -33,6 +33,7 @@
#include "nsIMutableArray.h"
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/dom/TabParent.h"
#include "nsIServiceManager.h"
@ -1259,9 +1260,7 @@ HWND AccessibleWrap::GetHWNDFor(Accessible* aAccessible) {
if (frame) {
nsIWidget* widget = frame->GetNearestWidget();
if (widget && widget->IsVisible()) {
nsIPresShell* shell = document->PresShell();
nsViewManager* vm = shell->GetViewManager();
if (vm) {
if (nsViewManager* vm = document->PresShellPtr()->GetViewManager()) {
nsCOMPtr<nsIWidget> rootWidget;
vm->GetRootWidget(getter_AddRefs(rootWidget));
// Make sure the accessible belongs to popup. If not then use

Просмотреть файл

@ -7,6 +7,7 @@
#include "DocAccessibleWrap.h"
#include "Compatibility.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/TabChild.h"
#include "DocAccessibleChild.h"
#include "nsWinUtils.h"
@ -26,7 +27,7 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::DocAccessibleWrap(dom::Document* aDocument,
nsIPresShell* aPresShell)
PresShell* aPresShell)
: DocAccessible(aDocument, aPresShell), mHWND(nullptr) {}
DocAccessibleWrap::~DocAccessibleWrap() {}

Просмотреть файл

@ -10,11 +10,14 @@
#include "DocAccessible.h"
namespace mozilla {
class PresShell;
namespace a11y {
class DocAccessibleWrap : public DocAccessible {
public:
DocAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
DocAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell);
virtual ~DocAccessibleWrap();
DECL_IUNKNOWN_INHERITED

Просмотреть файл

@ -6,17 +6,19 @@
#include "RootAccessibleWrap.h"
#include "Compatibility.h"
#include "mozilla/PresShell.h"
#include "mozilla/WindowsVersion.h"
#include "nsCoreUtils.h"
#include "nsWinUtils.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// Constructor/destructor
RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
nsIPresShell* aPresShell)
PresShell* aPresShell)
: RootAccessible(aDocument, aPresShell), mOuter(&mInternalUnknown) {}
RootAccessibleWrap::~RootAccessibleWrap() {}

Просмотреть файл

@ -10,11 +10,14 @@
#include "RootAccessible.h"
namespace mozilla {
class PresShell;
namespace a11y {
class RootAccessibleWrap : public RootAccessible {
public:
RootAccessibleWrap(dom::Document* aDocument, nsIPresShell* aPresShell);
RootAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell);
virtual ~RootAccessibleWrap();
// RootAccessible

Просмотреть файл

@ -21,6 +21,7 @@
#include "mozilla/dom/BorrowedAttrInfo.h"
#include "mozilla/dom/Element.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/PresShell.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -275,7 +276,7 @@ sdnAccessible::scrollTo(boolean aScrollTopLeft) {
? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT
: nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
nsCOMPtr<nsIPresShell> presShell = document->PresShell();
RefPtr<PresShell> presShell = document->PresShellPtr();
nsCOMPtr<nsIContent> content = mNode->AsContent();
nsCoreUtils::ScrollTo(presShell, content, scrollType);
return S_OK;

Просмотреть файл

@ -6903,7 +6903,8 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
accService->ContentRangeInserted(mPresShell, aFirstNewContent, nullptr);
accService->ContentRangeInserted(static_cast<PresShell*>(mPresShell),
aFirstNewContent, nullptr);
}
#endif
}
@ -7015,7 +7016,8 @@ void nsCSSFrameConstructor::ContentRangeInserted(
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild);
accService->ContentRangeInserted(static_cast<PresShell*>(mPresShell),
aStartChild, aEndChild);
}
#endif
@ -7381,7 +7383,8 @@ void nsCSSFrameConstructor::ContentRangeInserted(
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild);
accService->ContentRangeInserted(static_cast<PresShell*>(mPresShell),
aStartChild, aEndChild);
}
#endif
}
@ -7581,7 +7584,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
accService->ContentRemoved(mPresShell, aChild);
accService->ContentRemoved(static_cast<PresShell*>(mPresShell), aChild);
}
#endif
@ -11717,7 +11720,8 @@ void nsCSSFrameConstructor::GenerateChildFrames(nsContainerFrame* aFrame) {
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
if (nsIContent* child = aFrame->GetContent()->GetFirstChild()) {
accService->ContentRangeInserted(mPresShell, child, nullptr);
accService->ContentRangeInserted(static_cast<PresShell*>(mPresShell),
child, nullptr);
}
}
#endif