Bug 1545499 - Remove dead code for threading accelerator state. r=NeilDeakin

It's only moved around, but not actually used anywhere.

I have no idea what this was supposed to control in the past but it doesn't seem
useful to keep it around.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-06-03 15:29:06 +00:00
Родитель d68454d1da
Коммит d143aaa5f3
19 изменённых файлов: 35 добавлений и 93 удалений

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

@ -7180,26 +7180,21 @@ void nsContentUtils::CallOnAllRemoteChildren(
}
struct UIStateChangeInfo {
UIStateChangeType mShowAccelerators;
UIStateChangeType mShowFocusRings;
UIStateChangeInfo(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings)
: mShowAccelerators(aShowAccelerators),
mShowFocusRings(aShowFocusRings) {}
explicit UIStateChangeInfo(UIStateChangeType aShowFocusRings)
: mShowFocusRings(aShowFocusRings) {}
};
bool SetKeyboardIndicatorsChild(BrowserParent* aParent, void* aArg) {
UIStateChangeInfo* stateInfo = static_cast<UIStateChangeInfo*>(aArg);
Unused << aParent->SendSetKeyboardIndicators(stateInfo->mShowAccelerators,
stateInfo->mShowFocusRings);
Unused << aParent->SendSetKeyboardIndicators(stateInfo->mShowFocusRings);
return false;
}
void nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(
nsPIDOMWindowOuter* aWindow, UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) {
UIStateChangeInfo stateInfo(aShowAccelerators, aShowFocusRings);
nsPIDOMWindowOuter* aWindow, UIStateChangeType aShowFocusRings) {
UIStateChangeInfo stateInfo(aShowFocusRings);
CallOnAllRemoteChildren(aWindow, SetKeyboardIndicatorsChild,
(void*)&stateInfo);
}

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

@ -2744,8 +2744,7 @@ class nsContentUtils {
* includes Windows headers which aren't allowed there.
*/
static void SetKeyboardIndicatorsOnRemoteChildren(
nsPIDOMWindowOuter* aWindow, UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings);
nsPIDOMWindowOuter* aWindow, UIStateChangeType aShowFocusRings);
/**
* Given an nsIFile, attempts to read it into aString.

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

@ -3451,7 +3451,6 @@ nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
bool isPrivate = parentContext->UsePrivateBrowsing();
attrs.SyncAttributesWithPrivateBrowsing(isPrivate);
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
uint64_t chromeOuterWindowID = 0;
@ -3459,8 +3458,6 @@ nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
if (doc) {
nsCOMPtr<nsPIWindowRoot> root = nsContentUtils::GetWindowRoot(doc);
if (root) {
showAccelerators = root->ShowAccelerators() ? UIStateChangeType_Set
: UIStateChangeType_Clear;
showFocusRings = root->ShowFocusRings() ? UIStateChangeType_Set
: UIStateChangeType_Clear;
@ -3472,8 +3469,8 @@ nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
}
bool tabContextUpdated = aTabContext->SetTabContext(
OwnerIsMozBrowserFrame(), chromeOuterWindowID, showAccelerators,
showFocusRings, attrs, presentationURLStr);
OwnerIsMozBrowserFrame(), chromeOuterWindowID, showFocusRings, attrs,
presentationURLStr);
NS_ENSURE_STATE(tabContextUpdated);
return NS_OK;

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

@ -2800,7 +2800,7 @@ nsIPrincipal* nsGlobalWindowOuter::GetEffectiveStoragePrincipal() {
//*****************************************************************************
void nsPIDOMWindowOuter::SetInitialKeyboardIndicators(
UIStateChangeType aShowAccelerators, UIStateChangeType aShowFocusRings) {
UIStateChangeType aShowFocusRings) {
MOZ_ASSERT(!GetCurrentInnerWindow());
nsPIDOMWindowOuter* piWin = GetPrivateRoot();
@ -2816,15 +2816,11 @@ void nsPIDOMWindowOuter::SetInitialKeyboardIndicators(
return;
}
if (aShowAccelerators != UIStateChangeType_NoChange) {
windowRoot->SetShowAccelerators(aShowAccelerators == UIStateChangeType_Set);
}
if (aShowFocusRings != UIStateChangeType_NoChange) {
windowRoot->SetShowFocusRings(aShowFocusRings == UIStateChangeType_Set);
}
nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(this, aShowAccelerators,
aShowFocusRings);
nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(this, aShowFocusRings);
}
Element* nsPIDOMWindowOuter::GetFrameElementInternal() const {
@ -6855,7 +6851,7 @@ bool nsGlobalWindowOuter::ShouldShowFocusRing() {
}
void nsGlobalWindowOuter::SetKeyboardIndicators(
UIStateChangeType aShowAccelerators, UIStateChangeType aShowFocusRings) {
UIStateChangeType aShowFocusRings) {
nsPIDOMWindowOuter* piWin = GetPrivateRoot();
if (!piWin) {
return;
@ -6871,15 +6867,11 @@ void nsGlobalWindowOuter::SetKeyboardIndicators(
return;
}
if (aShowAccelerators != UIStateChangeType_NoChange) {
windowRoot->SetShowAccelerators(aShowAccelerators == UIStateChangeType_Set);
}
if (aShowFocusRings != UIStateChangeType_NoChange) {
windowRoot->SetShowFocusRings(aShowFocusRings == UIStateChangeType_Set);
}
nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(this, aShowAccelerators,
aShowFocusRings);
nsContentUtils::SetKeyboardIndicatorsOnRemoteChildren(this, aShowFocusRings);
bool newShouldShowFocusRing = ShouldShowFocusRing();
if (mInnerWindow && nsGlobalWindowInner::Cast(mInnerWindow)->mHasFocus &&

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

@ -916,9 +916,8 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
virtual bool ShouldShowFocusRing() override;
virtual void SetKeyboardIndicators(
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) override;
virtual void SetKeyboardIndicators(UIStateChangeType aShowFocusRings)
override;
public:
virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() override;

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

@ -715,10 +715,9 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
bool IsRootOuterWindow() { return mIsRootOuterWindow; }
/**
* Set initial keyboard indicator state for accelerators and focus rings.
* Set initial keyboard indicator state for focus rings.
*/
void SetInitialKeyboardIndicators(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings);
void SetInitialKeyboardIndicators(UIStateChangeType aShowFocusRings);
// Internal getter/setter for the frame element, this version of the
// getter crosses chrome boundaries whereas the public scriptable
@ -959,8 +958,7 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
/**
* Set the keyboard indicator state for accelerators and focus rings.
*/
virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) = 0;
virtual void SetKeyboardIndicators(UIStateChangeType aShowFocusRings) = 0;
/**
* Indicates that the page in the window has been hidden. This is used to

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

@ -69,9 +69,7 @@ class nsPIWindowRoot : public mozilla::dom::EventTarget {
// Enumerate all stored browsers that for which the weak reference is valid.
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) = 0;
virtual bool ShowAccelerators() = 0;
virtual bool ShowFocusRings() = 0;
virtual void SetShowAccelerators(bool aEnable) = 0;
virtual void SetShowFocusRings(bool aEnable) = 0;
};

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

@ -39,10 +39,8 @@ nsWindowRoot::nsWindowRoot(nsPIDOMWindowOuter* aWindow) {
// Keyboard indicators are not shown on Mac by default.
#if defined(XP_MACOSX)
mShowAccelerators = false;
mShowFocusRings = false;
#else
mShowAccelerators = true;
mShowFocusRings = true;
#endif
}

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

@ -75,14 +75,8 @@ class nsWindowRoot final : public nsPIWindowRoot {
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc,
void* aArg) override;
virtual bool ShowAccelerators() override { return mShowAccelerators; }
virtual bool ShowFocusRings() override { return mShowFocusRings; }
virtual void SetShowAccelerators(bool aEnable) override {
mShowAccelerators = aEnable;
}
virtual void SetShowFocusRings(bool aEnable) override {
mShowFocusRings = aEnable;
}
@ -102,9 +96,7 @@ class nsWindowRoot final : public nsPIWindowRoot {
RefPtr<mozilla::EventListenerManager> mListenerManager; // [Strong]
nsWeakPtr mPopupNode;
// True if focus rings and accelerators are enabled for this
// window hierarchy.
bool mShowAccelerators;
// True if focus rings are enabled for this window hierarchy.
bool mShowFocusRings;
nsCOMPtr<mozilla::dom::EventTarget> mParent;

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

@ -44,8 +44,8 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
attrs.mInIsolatedMozBrowser = false;
attrs.SyncAttributesWithPrivateBrowsing(false);
MutableTabContext tabContext;
tabContext.SetTabContext(false, 0, UIStateChangeType_Set,
UIStateChangeType_Set, attrs, aPresentationURL);
tabContext.SetTabContext(false, 0, UIStateChangeType_Set, attrs,
aPresentationURL);
ProcessPriority initialPriority = PROCESS_PRIORITY_FOREGROUND;

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

@ -590,10 +590,10 @@ nsresult BrowserChild::Init(mozIDOMWindowProxy* aParent) {
docShell->SetChromeEventHandler(chromeHandler);
if (window->GetCurrentInnerWindow()) {
window->SetKeyboardIndicators(ShowAccelerators(), ShowFocusRings());
window->SetKeyboardIndicators(ShowFocusRings());
} else {
// Skip ShouldShowFocusRing check if no inner window is available
window->SetInitialKeyboardIndicators(ShowAccelerators(), ShowFocusRings());
window->SetInitialKeyboardIndicators(ShowFocusRings());
}
nsContentUtils::SetScrollbarsVisibility(
@ -1468,12 +1468,10 @@ mozilla::ipc::IPCResult BrowserChild::RecvParentActivated(
}
mozilla::ipc::IPCResult BrowserChild::RecvSetKeyboardIndicators(
const UIStateChangeType& aShowAccelerators,
const UIStateChangeType& aShowFocusRings) {
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
NS_ENSURE_TRUE(window, IPC_OK());
window->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
window->SetKeyboardIndicators(aShowFocusRings);
return IPC_OK();
}

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

@ -739,7 +739,6 @@ class BrowserChild final : public BrowserChildBase,
mozilla::ipc::IPCResult RecvParentActivated(const bool& aActivated);
mozilla::ipc::IPCResult RecvSetKeyboardIndicators(
const UIStateChangeType& aShowAccelerators,
const UIStateChangeType& aShowFocusRings);
mozilla::ipc::IPCResult RecvStopIMEStateManagement();

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

@ -695,8 +695,7 @@ child:
async ParentActivated(bool aActivated);
async SetKeyboardIndicators(UIStateChangeType showAccelerators,
UIStateChangeType showFocusRings);
async SetKeyboardIndicators(UIStateChangeType showFocusRings);
/**
* StopIMEStateManagement() is called when the process loses focus and

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

@ -50,7 +50,6 @@ struct FrameIPCTabContext
nsString presentationURL;
// Keyboard indicator state inherited from the parent.
UIStateChangeType showAccelerators;
UIStateChangeType showFocusRings;
};

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

@ -23,7 +23,6 @@ TabContext::TabContext()
mIsMozBrowserElement(false),
mChromeOuterWindowID(0),
mJSPluginID(-1),
mShowAccelerators(UIStateChangeType_NoChange),
mShowFocusRings(UIStateChangeType_NoChange) {}
bool TabContext::IsMozBrowserElement() const { return mIsMozBrowserElement; }
@ -79,15 +78,10 @@ const nsAString& TabContext::PresentationURL() const {
return mPresentationURL;
}
UIStateChangeType TabContext::ShowAccelerators() const {
return mShowAccelerators;
}
UIStateChangeType TabContext::ShowFocusRings() const { return mShowFocusRings; }
bool TabContext::SetTabContext(bool aIsMozBrowserElement,
uint64_t aChromeOuterWindowID,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const OriginAttributes& aOriginAttributes,
const nsAString& aPresentationURL) {
@ -98,7 +92,6 @@ bool TabContext::SetTabContext(bool aIsMozBrowserElement,
mChromeOuterWindowID = aChromeOuterWindowID;
mOriginAttributes = aOriginAttributes;
mPresentationURL = aPresentationURL;
mShowAccelerators = aShowAccelerators;
mShowFocusRings = aShowFocusRings;
return true;
}
@ -118,7 +111,7 @@ IPCTabContext TabContext::AsIPCTabContext() const {
return IPCTabContext(FrameIPCTabContext(
mOriginAttributes, mIsMozBrowserElement, mChromeOuterWindowID,
mPresentationURL, mShowAccelerators, mShowFocusRings));
mPresentationURL, mShowFocusRings));
}
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
@ -128,7 +121,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
int32_t jsPluginId = -1;
OriginAttributes originAttributes;
nsAutoString presentationURL;
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
switch (aParams.type()) {
@ -198,7 +190,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
isMozBrowserElement = ipcContext.isMozBrowserElement();
chromeOuterWindowID = ipcContext.chromeOuterWindowID();
presentationURL = ipcContext.presentationURL();
showAccelerators = ipcContext.showAccelerators();
showFocusRings = ipcContext.showFocusRings();
originAttributes = ipcContext.originAttributes();
break;
@ -225,8 +216,8 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
rv = mTabContext.SetTabContextForJSPluginFrame(jsPluginId);
} else {
rv = mTabContext.SetTabContext(isMozBrowserElement, chromeOuterWindowID,
showAccelerators, showFocusRings,
originAttributes, presentationURL);
showFocusRings, originAttributes,
presentationURL);
}
if (!rv) {
mInvalidReason = "Couldn't initialize TabContext.";

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

@ -80,7 +80,6 @@ class TabContext {
*/
const nsAString& PresentationURL() const;
UIStateChangeType ShowAccelerators() const;
UIStateChangeType ShowFocusRings() const;
protected:
@ -106,7 +105,6 @@ class TabContext {
void SetPrivateBrowsingAttributes(bool aIsPrivateBrowsing);
bool SetTabContext(bool aIsMozBrowserElement, uint64_t aChromeOuterWindowID,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const OriginAttributes& aOriginAttributes,
const nsAString& aPresentationURL);
@ -164,9 +162,8 @@ class TabContext {
nsString mPresentationURL;
/**
* Keyboard indicator state (focus rings, accelerators).
* Keyboard indicator state (focus rings).
*/
UIStateChangeType mShowAccelerators;
UIStateChangeType mShowFocusRings;
};
@ -182,13 +179,12 @@ class MutableTabContext : public TabContext {
}
bool SetTabContext(bool aIsMozBrowserElement, uint64_t aChromeOuterWindowID,
UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings,
const OriginAttributes& aOriginAttributes,
const nsAString& aPresentationURL = EmptyString()) {
return TabContext::SetTabContext(aIsMozBrowserElement, aChromeOuterWindowID,
aShowAccelerators, aShowFocusRings,
aOriginAttributes, aPresentationURL);
aShowFocusRings, aOriginAttributes,
aPresentationURL);
}
bool SetTabContextForJSPluginFrame(uint32_t aJSPluginID) {

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

@ -1693,12 +1693,10 @@ void nsBaseWidget::NotifyThemeChanged() {
}
}
void nsBaseWidget::NotifyUIStateChanged(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings) {
void nsBaseWidget::NotifyUIStateChanged(UIStateChangeType aShowFocusRings) {
if (Document* doc = GetDocument()) {
nsPIDOMWindowOuter* win = doc->GetWindow();
if (win) {
win->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
if (nsPIDOMWindowOuter* win = doc->GetWindow()) {
win->SetKeyboardIndicators(aShowFocusRings);
}
}
}

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

@ -346,8 +346,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
// theme changes.
void NotifySysColorChanged();
void NotifyThemeChanged();
void NotifyUIStateChanged(UIStateChangeType aShowAccelerators,
UIStateChangeType aShowFocusRings);
void NotifyUIStateChanged(UIStateChangeType aShowFocusRings);
#ifdef ACCESSIBILITY
// Get the accessible for the window.

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

@ -5866,16 +5866,11 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
int32_t action = LOWORD(wParam);
if (action == UIS_SET || action == UIS_CLEAR) {
int32_t flags = HIWORD(wParam);
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
if (flags & UISF_HIDEACCEL)
showAccelerators = (action == UIS_SET) ? UIStateChangeType_Clear
: UIStateChangeType_Set;
if (flags & UISF_HIDEFOCUS)
showFocusRings = (action == UIS_SET) ? UIStateChangeType_Clear
: UIStateChangeType_Set;
NotifyUIStateChanged(showAccelerators, showFocusRings);
NotifyUIStateChanged(showFocusRings);
}
}