mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
69790bc62e
The inclusions were removed with the following very crude script and the resulting breakage was fixed up by hand. The manual fixups did either revert the changes done by the script, replace a generic header with a more specific one or replace a header with a forward declaration. find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2) if [ -n "$interfaces" ]; then if [[ "$interfaces" == *$'\n'* ]]; then regexp="\(" for i in $interfaces; do regexp="$regexp$i\|"; done regexp="${regexp%%\\\|}\)" else regexp="$interfaces" fi interface=$(basename "$path") rg -l "#include.*${interface%%.idl}.h" . | while read path2; do hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" ) if [ $hits -eq 0 ]; then echo "Removing ${interface} from ${path2}" grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp mv -f "$path2".tmp "$path2" fi done fi done Differential Revision: https://phabricator.services.mozilla.com/D55443 --HG-- extra : moz-landing-system : lando
139 lines
4.2 KiB
C++
139 lines
4.2 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
|
*/
|
|
/* 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/. */
|
|
|
|
#include "ApplicationAccessible.h"
|
|
|
|
#include "nsAccessibilityService.h"
|
|
#include "nsAccUtils.h"
|
|
#include "Relation.h"
|
|
#include "Role.h"
|
|
#include "States.h"
|
|
|
|
#include "nsServiceManagerUtils.h"
|
|
#include "mozilla/Services.h"
|
|
#include "nsGlobalWindow.h"
|
|
#include "nsIStringBundle.h"
|
|
|
|
using namespace mozilla::a11y;
|
|
|
|
ApplicationAccessible::ApplicationAccessible()
|
|
: AccessibleWrap(nullptr, nullptr) {
|
|
mType = eApplicationType;
|
|
mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
|
MOZ_ASSERT(mAppInfo, "no application info");
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsIAccessible
|
|
|
|
ENameValueFlag ApplicationAccessible::Name(nsString& aName) const {
|
|
aName.Truncate();
|
|
|
|
nsCOMPtr<nsIStringBundleService> bundleService =
|
|
mozilla::services::GetStringBundleService();
|
|
|
|
NS_ASSERTION(bundleService, "String bundle service must be present!");
|
|
if (!bundleService) return eNameOK;
|
|
|
|
nsCOMPtr<nsIStringBundle> bundle;
|
|
nsresult rv = bundleService->CreateBundle(
|
|
"chrome://branding/locale/brand.properties", getter_AddRefs(bundle));
|
|
if (NS_FAILED(rv)) return eNameOK;
|
|
|
|
nsAutoString appName;
|
|
rv = bundle->GetStringFromName("brandShortName", appName);
|
|
if (NS_FAILED(rv) || appName.IsEmpty()) {
|
|
NS_WARNING("brandShortName not found, using default app name");
|
|
appName.AssignLiteral("Gecko based application");
|
|
}
|
|
|
|
aName.Assign(appName);
|
|
return eNameOK;
|
|
}
|
|
|
|
void ApplicationAccessible::Description(nsString& aDescription) {
|
|
aDescription.Truncate();
|
|
}
|
|
|
|
void ApplicationAccessible::Value(nsString& aValue) const { aValue.Truncate(); }
|
|
|
|
uint64_t ApplicationAccessible::State() {
|
|
return IsDefunct() ? states::DEFUNCT : 0;
|
|
}
|
|
|
|
already_AddRefed<nsIPersistentProperties>
|
|
ApplicationAccessible::NativeAttributes() {
|
|
return nullptr;
|
|
}
|
|
|
|
GroupPos ApplicationAccessible::GroupPosition() { return GroupPos(); }
|
|
|
|
Accessible* ApplicationAccessible::ChildAtPoint(
|
|
int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) {
|
|
return nullptr;
|
|
}
|
|
|
|
Accessible* ApplicationAccessible::FocusedChild() {
|
|
Accessible* focus = FocusMgr()->FocusedAccessible();
|
|
if (focus && focus->Parent() == this) return focus;
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
Relation ApplicationAccessible::RelationByType(
|
|
RelationType aRelationType) const {
|
|
return Relation();
|
|
}
|
|
|
|
nsIntRect ApplicationAccessible::Bounds() const { return nsIntRect(); }
|
|
|
|
nsRect ApplicationAccessible::BoundsInAppUnits() const { return nsRect(); }
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Accessible public methods
|
|
|
|
void ApplicationAccessible::Shutdown() { mAppInfo = nullptr; }
|
|
|
|
void ApplicationAccessible::ApplyARIAState(uint64_t* aState) const {}
|
|
|
|
role ApplicationAccessible::NativeRole() const { return roles::APP_ROOT; }
|
|
|
|
uint64_t ApplicationAccessible::NativeState() const { return 0; }
|
|
|
|
KeyBinding ApplicationAccessible::AccessKey() const { return KeyBinding(); }
|
|
|
|
void ApplicationAccessible::Init() {
|
|
// Basically children are kept updated by Append/RemoveChild method calls.
|
|
// However if there are open windows before accessibility was started
|
|
// then we need to make sure root accessibles for open windows are created so
|
|
// that all root accessibles are stored in application accessible children
|
|
// array.
|
|
|
|
nsGlobalWindowOuter::OuterWindowByIdTable* windowsById =
|
|
nsGlobalWindowOuter::GetWindowsTable();
|
|
|
|
if (!windowsById) {
|
|
return;
|
|
}
|
|
|
|
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
|
|
nsGlobalWindowOuter* window = iter.Data();
|
|
if (window->GetDocShell() && window->IsRootOuterWindow()) {
|
|
if (RefPtr<dom::Document> docNode = window->GetExtantDoc()) {
|
|
GetAccService()->GetDocAccessible(docNode); // ensure creation
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Accessible* ApplicationAccessible::GetSiblingAtOffset(int32_t aOffset,
|
|
nsresult* aError) const {
|
|
if (aError) *aError = NS_OK; // fail peacefully
|
|
|
|
return nullptr;
|
|
}
|