Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/inspector/inLayoutUtils.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "inLayoutUtils.h"
8
9
#include "nsIDocument.h"
10
#include "nsIContent.h"
11
#include "nsIContentViewer.h"
12
#include "nsPIDOMWindow.h"
13
#include "nsIDocShell.h"
14
#include "nsIPresShell.h"
15
#include "nsPresContext.h"
16
#include "mozilla/EventStateManager.h"
17
#include "mozilla/dom/Element.h"
18
19
using namespace mozilla;
20
21
///////////////////////////////////////////////////////////////////////////////
22
23
EventStateManager*
24
inLayoutUtils::GetEventStateManagerFor(Element& aElement)
25
0
{
26
0
  nsIDocument* doc = aElement.OwnerDoc();
27
0
  nsPresContext* presContext = doc->GetPresContext();
28
0
  if (!presContext)
29
0
    return nullptr;
30
0
31
0
  return presContext->EventStateManager();
32
0
}
33
34
nsIDocument*
35
inLayoutUtils::GetSubDocumentFor(nsINode* aNode)
36
0
{
37
0
  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
38
0
  if (content) {
39
0
    nsCOMPtr<nsIDocument> doc = content->GetComposedDoc();
40
0
    if (doc) {
41
0
      return doc->GetSubDocumentFor(content);
42
0
    }
43
0
  }
44
0
45
0
  return nullptr;
46
0
}
47
48
nsINode*
49
inLayoutUtils::GetContainerFor(const nsIDocument& aDoc)
50
0
{
51
0
  nsPIDOMWindowOuter* pwin = aDoc.GetWindow();
52
0
  if (!pwin) {
53
0
    return nullptr;
54
0
  }
55
0
56
0
  return pwin->GetFrameElementInternal();
57
0
}
58