Coverage Report

Created: 2018-09-25 14:53

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