Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/generic/nsBackdropFrame.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 "::backdrop" */
8
9
#include "nsBackdropFrame.h"
10
11
#include "nsDisplayList.h"
12
13
using namespace mozilla;
14
15
NS_IMPL_FRAMEARENA_HELPERS(nsBackdropFrame)
16
17
#ifdef DEBUG_FRAME_DUMP
18
nsresult
19
nsBackdropFrame::GetFrameName(nsAString& aResult) const
20
{
21
  return MakeFrameName(NS_LITERAL_STRING("Backdrop"), aResult);
22
}
23
#endif
24
25
/* virtual */ ComputedStyle*
26
nsBackdropFrame::GetParentComputedStyle(nsIFrame** aProviderFrame) const
27
0
{
28
0
  // Style context of backdrop pseudo-element does not inherit from
29
0
  // any element, per the Fullscreen API spec.
30
0
  *aProviderFrame = nullptr;
31
0
  return nullptr;
32
0
}
33
34
/* virtual */ void
35
nsBackdropFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
36
                                  const nsDisplayListSet& aLists)
37
0
{
38
0
  DO_GLOBAL_REFLOW_COUNT_DSP("nsBackdropFrame");
39
0
  // We want this frame to always be there even if its display value is
40
0
  // none or contents so that we can respond to style change on it. To
41
0
  // support those values, we skip painting ourselves in those cases.
42
0
  auto display = StyleDisplay()->mDisplay;
43
0
  if (display == mozilla::StyleDisplay::None ||
44
0
      display == mozilla::StyleDisplay::Contents) {
45
0
    return;
46
0
  }
47
0
48
0
  DisplayBorderBackgroundOutline(aBuilder, aLists);
49
0
}
50
51
/* virtual */ LogicalSize
52
nsBackdropFrame::ComputeAutoSize(gfxContext*         aRenderingContext,
53
                                 WritingMode         aWM,
54
                                 const LogicalSize&  aCBSize,
55
                                 nscoord             aAvailableISize,
56
                                 const LogicalSize&  aMargin,
57
                                 const LogicalSize&  aBorder,
58
                                 const LogicalSize&  aPadding,
59
                                 ComputeSizeFlags    aFlags)
60
0
{
61
0
  // Note that this frame is a child of the viewport frame.
62
0
  LogicalSize result(aWM, 0xdeadbeef, NS_UNCONSTRAINEDSIZE);
63
0
  if (aFlags & ComputeSizeFlags::eShrinkWrap) {
64
0
    result.ISize(aWM) = 0;
65
0
  } else {
66
0
    result.ISize(aWM) = aAvailableISize - aMargin.ISize(aWM) -
67
0
                        aBorder.ISize(aWM) - aPadding.ISize(aWM);
68
0
  }
69
0
  return result;
70
0
}
71
72
/* virtual */ void
73
nsBackdropFrame::Reflow(nsPresContext* aPresContext,
74
                        ReflowOutput& aDesiredSize,
75
                        const ReflowInput& aReflowInput,
76
                        nsReflowStatus& aStatus)
77
0
{
78
0
  MarkInReflow();
79
0
  DO_GLOBAL_REFLOW_COUNT("nsBackdropFrame");
80
0
  DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
81
0
  MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
82
0
83
0
  // Note that this frame is a child of the viewport frame.
84
0
  WritingMode wm = aReflowInput.GetWritingMode();
85
0
  LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
86
0
  nscoord isize = aReflowInput.ComputedISize() + borderPadding.IStartEnd(wm);
87
0
  nscoord bsize = aReflowInput.ComputedBSize() + borderPadding.BStartEnd(wm);
88
0
  aDesiredSize.SetSize(wm, LogicalSize(wm, isize, bsize));
89
0
}