Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/forms/nsProgressFrame.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
#ifndef nsProgressFrame_h___
8
#define nsProgressFrame_h___
9
10
#include "mozilla/Attributes.h"
11
#include "nsContainerFrame.h"
12
#include "nsIAnonymousContentCreator.h"
13
#include "nsCOMPtr.h"
14
15
namespace mozilla {
16
enum class CSSPseudoElementType : uint8_t;
17
} // namespace mozilla
18
19
class nsProgressFrame final
20
  : public nsContainerFrame
21
  , public nsIAnonymousContentCreator
22
{
23
  typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
24
  typedef mozilla::dom::Element Element;
25
26
public:
27
  NS_DECL_QUERYFRAME
28
  NS_DECL_FRAMEARENA_HELPERS(nsProgressFrame)
29
30
  explicit nsProgressFrame(ComputedStyle* aStyle);
31
  virtual ~nsProgressFrame();
32
33
  virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
34
35
  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
36
                                const nsDisplayListSet& aLists) override;
37
38
  virtual void Reflow(nsPresContext*           aCX,
39
                      ReflowOutput&     aDesiredSize,
40
                      const ReflowInput& aReflowInput,
41
                      nsReflowStatus&          aStatus) override;
42
43
#ifdef DEBUG_FRAME_DUMP
44
  virtual nsresult GetFrameName(nsAString& aResult) const override {
45
    return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
46
  }
47
#endif
48
49
  // nsIAnonymousContentCreator
50
  virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
51
  virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
52
                                        uint32_t aFilter) override;
53
54
  virtual nsresult AttributeChanged(int32_t  aNameSpaceID,
55
                                    nsAtom* aAttribute,
56
                                    int32_t  aModType) override;
57
58
  virtual mozilla::LogicalSize
59
  ComputeAutoSize(gfxContext*                 aRenderingContext,
60
                  mozilla::WritingMode        aWM,
61
                  const mozilla::LogicalSize& aCBSize,
62
                  nscoord                     aAvailableISize,
63
                  const mozilla::LogicalSize& aMargin,
64
                  const mozilla::LogicalSize& aBorder,
65
                  const mozilla::LogicalSize& aPadding,
66
                  ComputeSizeFlags            aFlags) override;
67
68
  virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
69
  virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
70
71
  virtual bool IsFrameOfType(uint32_t aFlags) const override
72
0
  {
73
0
    return nsContainerFrame::IsFrameOfType(aFlags &
74
0
      ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
75
0
  }
76
77
  /**
78
   * Returns whether the frame and its child should use the native style.
79
   */
80
  bool ShouldUseNativeStyle() const;
81
82
protected:
83
  // Helper function to reflow a child frame.
84
  void ReflowChildFrame(nsIFrame*          aChild,
85
                        nsPresContext*     aPresContext,
86
                        const ReflowInput& aReflowInput,
87
                        nsReflowStatus&    aStatus);
88
89
  /**
90
   * The div used to show the progress bar.
91
   * @see nsProgressFrame::CreateAnonymousContent
92
   */
93
  nsCOMPtr<Element> mBarDiv;
94
};
95
96
#endif