Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/generic/nsRubyTextFrame.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
/* rendering object for CSS "display: ruby-text" */
8
9
#include "nsRubyTextFrame.h"
10
11
#include "mozilla/ComputedStyle.h"
12
#include "mozilla/WritingModes.h"
13
#include "nsLineLayout.h"
14
#include "nsPresContext.h"
15
16
using namespace mozilla;
17
18
//----------------------------------------------------------------------
19
20
// Frame class boilerplate
21
// =======================
22
23
0
NS_QUERYFRAME_HEAD(nsRubyTextFrame)
24
0
  NS_QUERYFRAME_ENTRY(nsRubyTextFrame)
25
0
NS_QUERYFRAME_TAIL_INHERITING(nsRubyContentFrame)
26
27
NS_IMPL_FRAMEARENA_HELPERS(nsRubyTextFrame)
28
29
nsContainerFrame*
30
NS_NewRubyTextFrame(nsIPresShell* aPresShell,
31
                    ComputedStyle* aStyle)
32
0
{
33
0
  return new (aPresShell) nsRubyTextFrame(aStyle);
34
0
}
35
36
37
//----------------------------------------------------------------------
38
39
// nsRubyTextFrame Method Implementations
40
// ======================================
41
42
/* virtual */ bool
43
nsRubyTextFrame::CanContinueTextRun() const
44
0
{
45
0
  return false;
46
0
}
47
48
#ifdef DEBUG_FRAME_DUMP
49
nsresult
50
nsRubyTextFrame::GetFrameName(nsAString& aResult) const
51
{
52
  return MakeFrameName(NS_LITERAL_STRING("RubyText"), aResult);
53
}
54
#endif
55
56
57
58
/* virtual */ void
59
nsRubyTextFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
60
                                  const nsDisplayListSet& aLists)
61
0
{
62
0
  if (IsAutoHidden()) {
63
0
    return;
64
0
  }
65
0
66
0
  nsRubyContentFrame::BuildDisplayList(aBuilder, aLists);
67
0
}
68
69
/* virtual */ void
70
nsRubyTextFrame::Reflow(nsPresContext* aPresContext,
71
                        ReflowOutput& aDesiredSize,
72
                        const ReflowInput& aReflowInput,
73
                        nsReflowStatus& aStatus)
74
0
{
75
0
  // Even if we want to hide this frame, we have to reflow it first.
76
0
  // If we leave it dirty, changes to its content will never be
77
0
  // propagated to the ancestors, then it won't be displayed even if
78
0
  // the content is no longer the same, until next reflow triggered by
79
0
  // some other change. In general, we always reflow all the frames we
80
0
  // created. There might be other problems if we don't do that.
81
0
  nsRubyContentFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
82
0
83
0
  if (IsAutoHidden()) {
84
0
    // Reset the ISize. The BSize is not changed so that it won't
85
0
    // affect vertical positioning in unexpected way.
86
0
    WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
87
0
    aDesiredSize.ISize(lineWM) = 0;
88
0
    aDesiredSize.SetOverflowAreasToDesiredBounds();
89
0
  }
90
0
}