tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RootAccessibleWrap.cpp (1612B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "RootAccessibleWrap.h"
      7 
      8 #include "Compatibility.h"
      9 #include "mozilla/PresShell.h"
     10 #include "nsCoreUtils.h"
     11 #include "nsWinUtils.h"
     12 
     13 using namespace mozilla;
     14 using namespace mozilla::a11y;
     15 
     16 ////////////////////////////////////////////////////////////////////////////////
     17 // Constructor/destructor
     18 
     19 RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
     20                                       PresShell* aPresShell)
     21    : RootAccessible(aDocument, aPresShell) {}
     22 
     23 RootAccessibleWrap::~RootAccessibleWrap() {}
     24 
     25 ////////////////////////////////////////////////////////////////////////////////
     26 // RootAccessible
     27 
     28 void RootAccessibleWrap::DocumentActivated(DocAccessible* aDocument) {
     29  // This check will never work with e10s enabled, in other words, as of
     30  // Firefox 57.
     31  if (Compatibility::IsDolphin() &&
     32      nsCoreUtils::IsTopLevelContentDocInProcess(aDocument->DocumentNode())) {
     33    MOZ_ASSERT(XRE_IsParentProcess());
     34    uint32_t count = mChildDocuments.Length();
     35    for (uint32_t idx = 0; idx < count; idx++) {
     36      DocAccessible* childDoc = mChildDocuments[idx];
     37      HWND childDocHWND = static_cast<HWND>(childDoc->GetNativeWindow());
     38      if (childDoc != aDocument)
     39        nsWinUtils::HideNativeWindow(childDocHWND);
     40      else
     41        nsWinUtils::ShowNativeWindow(childDocHWND);
     42    }
     43  }
     44 }