accessible/src/base/nsEventShell.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsEventShell.h"
michael@0 7
michael@0 8 #include "nsAccUtils.h"
michael@0 9
michael@0 10 #include "mozilla/StaticPtr.h"
michael@0 11
michael@0 12 using namespace mozilla;
michael@0 13 using namespace mozilla::a11y;
michael@0 14
michael@0 15 ////////////////////////////////////////////////////////////////////////////////
michael@0 16 // nsEventShell
michael@0 17 ////////////////////////////////////////////////////////////////////////////////
michael@0 18
michael@0 19 void
michael@0 20 nsEventShell::FireEvent(AccEvent* aEvent)
michael@0 21 {
michael@0 22 if (!aEvent)
michael@0 23 return;
michael@0 24
michael@0 25 Accessible* accessible = aEvent->GetAccessible();
michael@0 26 NS_ENSURE_TRUE_VOID(accessible);
michael@0 27
michael@0 28 nsINode* node = accessible->GetNode();
michael@0 29 if (node) {
michael@0 30 sEventTargetNode = node;
michael@0 31 sEventFromUserInput = aEvent->IsFromUserInput();
michael@0 32 }
michael@0 33
michael@0 34 accessible->HandleAccEvent(aEvent);
michael@0 35
michael@0 36 sEventTargetNode = nullptr;
michael@0 37 }
michael@0 38
michael@0 39 void
michael@0 40 nsEventShell::FireEvent(uint32_t aEventType, Accessible* aAccessible,
michael@0 41 EIsFromUserInput aIsFromUserInput)
michael@0 42 {
michael@0 43 NS_ENSURE_TRUE_VOID(aAccessible);
michael@0 44
michael@0 45 nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
michael@0 46 aIsFromUserInput);
michael@0 47
michael@0 48 FireEvent(event);
michael@0 49 }
michael@0 50
michael@0 51 void
michael@0 52 nsEventShell::GetEventAttributes(nsINode *aNode,
michael@0 53 nsIPersistentProperties *aAttributes)
michael@0 54 {
michael@0 55 if (aNode != sEventTargetNode)
michael@0 56 return;
michael@0 57
michael@0 58 nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::eventFromInput,
michael@0 59 sEventFromUserInput ? NS_LITERAL_STRING("true") :
michael@0 60 NS_LITERAL_STRING("false"));
michael@0 61 }
michael@0 62
michael@0 63 ////////////////////////////////////////////////////////////////////////////////
michael@0 64 // nsEventShell: private
michael@0 65
michael@0 66 bool nsEventShell::sEventFromUserInput = false;
michael@0 67 StaticRefPtr<nsINode> nsEventShell::sEventTargetNode;

mercurial