Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/svg/SVGFEUnstyledLeafFrame.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
// Keep in (case-insensitive) order:
8
#include "nsContainerFrame.h"
9
#include "nsFrame.h"
10
#include "nsGkAtoms.h"
11
#include "SVGObserverUtils.h"
12
#include "nsSVGFilters.h"
13
14
class SVGFEUnstyledLeafFrame final : public nsFrame
15
{
16
  friend nsIFrame*
17
  NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
18
protected:
19
  explicit SVGFEUnstyledLeafFrame(ComputedStyle* aStyle)
20
    : nsFrame(aStyle, kClassID)
21
0
  {
22
0
    AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
23
0
  }
24
25
public:
26
  NS_DECL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
27
28
  virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
29
0
                                const nsDisplayListSet& aLists) override {}
30
31
  virtual bool IsFrameOfType(uint32_t aFlags) const override
32
0
  {
33
0
    if (aFlags & eSupportsContainLayoutAndPaint) {
34
0
      return false;
35
0
    }
36
0
37
0
    return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
38
0
  }
39
40
#ifdef DEBUG_FRAME_DUMP
41
  virtual nsresult GetFrameName(nsAString& aResult) const override
42
  {
43
    return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
44
  }
45
#endif
46
47
  virtual nsresult AttributeChanged(int32_t  aNameSpaceID,
48
                                    nsAtom* aAttribute,
49
                                    int32_t  aModType) override;
50
51
0
  virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
52
0
    // We don't maintain a visual overflow rect
53
0
    return false;
54
0
  }
55
};
56
57
nsIFrame*
58
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
59
0
{
60
0
  return new (aPresShell) SVGFEUnstyledLeafFrame(aStyle);
61
0
}
62
63
NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
64
65
nsresult
66
SVGFEUnstyledLeafFrame::AttributeChanged(int32_t  aNameSpaceID,
67
                                         nsAtom* aAttribute,
68
                                         int32_t  aModType)
69
0
{
70
0
  SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(GetContent());
71
0
  if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
72
0
    MOZ_ASSERT(GetParent()->GetParent()->IsSVGFilterFrame(),
73
0
               "Observers observe the filter, so that's what we must invalidate");
74
0
    SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent()->GetParent());
75
0
  }
76
0
77
0
  return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
78
0
}