Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/generic/nsIAnonymousContentCreator.h
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
/*
8
 * interface for rendering objects that manually create subtrees of
9
 * anonymous content
10
 */
11
12
#ifndef nsIAnonymousContentCreator_h___
13
#define nsIAnonymousContentCreator_h___
14
15
#include "mozilla/ComputedStyle.h"
16
17
#include "nsQueryFrame.h"
18
#include "nsTArrayForwardDeclare.h"
19
20
class nsIContent;
21
class nsIFrame;
22
23
/**
24
 * Any source for anonymous content can implement this interface to provide it.
25
 * HTML frames like nsFileControlFrame currently use this.
26
 *
27
 * @see nsCSSFrameConstructor
28
 */
29
class nsIAnonymousContentCreator
30
{
31
public:
32
  NS_DECL_QUERYFRAME_TARGET(nsIAnonymousContentCreator)
33
34
  struct ContentInfo {
35
    explicit ContentInfo(nsIContent* aContent)
36
      : mContent(aContent)
37
0
    {}
38
39
    nsIContent* mContent;
40
  };
41
42
  /**
43
   * Creates "native" anonymous content and adds the created content to
44
   * the aElements array. None of the returned elements can be nullptr.
45
   *
46
   * If the anonymous content creator sets the editable flag on some
47
   * of the elements that it creates, the flag will be applied to the node
48
   * upon being bound to the document.
49
   *
50
   * @note The returned elements are owned by this object. This object is
51
   *       responsible for calling UnbindFromTree on the elements it returned
52
   *       from CreateAnonymousContent when appropriate (i.e. before releasing
53
   *       them).
54
   */
55
  virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) = 0;
56
57
  /**
58
   * Appends "native" anonymous children created by CreateAnonymousContent()
59
   * to the given content list depending on the filter.
60
   *
61
   * @see nsIContent::GetChildren for set of values used for filter.  Currently,
62
   *   eSkipPlaceholderContent is the only flag that any implementation of
63
   *   this method heeds.
64
   */
65
  virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
66
                                        uint32_t aFilter) = 0;
67
};
68
69
#endif
70