Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/generic/nsFirstLetterFrame.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 nsFirstLetterFrame_h__
8
#define nsFirstLetterFrame_h__
9
10
/* rendering object for CSS :first-letter pseudo-element */
11
12
#include "mozilla/Attributes.h"
13
#include "nsContainerFrame.h"
14
15
class nsFirstLetterFrame final : public nsContainerFrame {
16
public:
17
  NS_DECL_QUERYFRAME
18
  NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
19
20
  explicit nsFirstLetterFrame(ComputedStyle* aStyle)
21
    : nsContainerFrame(aStyle, kClassID)
22
0
  {}
23
24
  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
25
                                const nsDisplayListSet& aLists) override;
26
27
  virtual void Init(nsIContent*       aContent,
28
                    nsContainerFrame* aParent,
29
                    nsIFrame*         aPrevInFlow) override;
30
  virtual void SetInitialChildList(ChildListID     aListID,
31
                                   nsFrameList&    aChildList) override;
32
#ifdef DEBUG_FRAME_DUMP
33
  virtual nsresult GetFrameName(nsAString& aResult) const override;
34
#endif
35
36
0
  bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
37
38
  virtual bool IsFrameOfType(uint32_t aFlags) const override
39
0
  {
40
0
    if (!IsFloating())
41
0
      aFlags = aFlags & ~(nsIFrame::eLineParticipant);
42
0
    return nsContainerFrame::IsFrameOfType(aFlags &
43
0
      ~(nsIFrame::eBidiInlineContainer));
44
0
  }
45
46
  virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
47
  virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
48
  virtual void AddInlineMinISize(gfxContext *aRenderingContext,
49
                                 InlineMinISizeData *aData) override;
50
  virtual void AddInlinePrefISize(gfxContext *aRenderingContext,
51
                                  InlinePrefISizeData *aData) override;
52
53
  virtual mozilla::LogicalSize
54
  ComputeSize(gfxContext *aRenderingContext,
55
              mozilla::WritingMode aWritingMode,
56
              const mozilla::LogicalSize& aCBSize,
57
              nscoord aAvailableISize,
58
              const mozilla::LogicalSize& aMargin,
59
              const mozilla::LogicalSize& aBorder,
60
              const mozilla::LogicalSize& aPadding,
61
              ComputeSizeFlags aFlags) override;
62
63
  virtual void Reflow(nsPresContext*           aPresContext,
64
                      ReflowOutput&     aDesiredSize,
65
                      const ReflowInput& aReflowInput,
66
                      nsReflowStatus&          aStatus) override;
67
68
  virtual bool CanContinueTextRun() const override;
69
  virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
70
  virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
71
72
//override of nsFrame method
73
  virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
74
                                                 bool inHint,
75
                                                 int32_t* outFrameContentOffset,
76
                                                 nsIFrame** outChildFrame) override;
77
78
0
  nscoord GetFirstLetterBaseline() const { return mBaseline; }
79
80
  // For floating first letter frames, create a continuation for aChild and
81
  // place it in the correct place. aContinuation is an outparam for the
82
  // continuation that is created. aIsFluid determines if the continuation is
83
  // fluid or not.
84
  nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
85
                                               nsIFrame* aChild,
86
                                               nsIFrame** aContinuation,
87
                                               bool aIsFluid);
88
89
protected:
90
  nscoord mBaseline;
91
92
  void DrainOverflowFrames(nsPresContext* aPresContext);
93
};
94
95
#endif /* nsFirstLetterFrame_h__ */