layout/svg/nsSVGPathGeometryFrame.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef __NS_SVGPATHGEOMETRYFRAME_H__
michael@0 7 #define __NS_SVGPATHGEOMETRYFRAME_H__
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "gfxMatrix.h"
michael@0 11 #include "gfxRect.h"
michael@0 12 #include "nsFrame.h"
michael@0 13 #include "nsISVGChildFrame.h"
michael@0 14 #include "nsLiteralString.h"
michael@0 15 #include "nsQueryFrame.h"
michael@0 16 #include "nsSVGUtils.h"
michael@0 17
michael@0 18 class gfxContext;
michael@0 19 class nsDisplaySVGPathGeometry;
michael@0 20 class nsIAtom;
michael@0 21 class nsIFrame;
michael@0 22 class nsIPresShell;
michael@0 23 class nsRenderingContext;
michael@0 24 class nsStyleContext;
michael@0 25 class nsSVGMarkerFrame;
michael@0 26 class nsSVGMarkerProperty;
michael@0 27
michael@0 28 struct nsPoint;
michael@0 29 struct nsRect;
michael@0 30 struct nsIntRect;
michael@0 31
michael@0 32 typedef nsFrame nsSVGPathGeometryFrameBase;
michael@0 33
michael@0 34 class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
michael@0 35 public nsISVGChildFrame
michael@0 36 {
michael@0 37 friend nsIFrame*
michael@0 38 NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
michael@0 39
michael@0 40 friend class nsDisplaySVGPathGeometry;
michael@0 41
michael@0 42 protected:
michael@0 43 nsSVGPathGeometryFrame(nsStyleContext* aContext)
michael@0 44 : nsSVGPathGeometryFrameBase(aContext)
michael@0 45 {
michael@0 46 AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
michael@0 47 }
michael@0 48
michael@0 49 public:
michael@0 50 NS_DECL_QUERYFRAME_TARGET(nsSVGPathGeometryFrame)
michael@0 51 NS_DECL_QUERYFRAME
michael@0 52 NS_DECL_FRAMEARENA_HELPERS
michael@0 53
michael@0 54 // nsIFrame interface:
michael@0 55 virtual void Init(nsIContent* aContent,
michael@0 56 nsIFrame* aParent,
michael@0 57 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
michael@0 58
michael@0 59 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
michael@0 60 {
michael@0 61 return nsSVGPathGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
michael@0 62 }
michael@0 63
michael@0 64 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
michael@0 65 nsIAtom* aAttribute,
michael@0 66 int32_t aModType) MOZ_OVERRIDE;
michael@0 67
michael@0 68 virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
michael@0 69
michael@0 70 /**
michael@0 71 * Get the "type" of the frame
michael@0 72 *
michael@0 73 * @see nsGkAtoms::svgPathGeometryFrame
michael@0 74 */
michael@0 75 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 76
michael@0 77 virtual bool IsSVGTransformed(Matrix *aOwnTransforms = nullptr,
michael@0 78 Matrix *aFromParentTransforms = nullptr) const MOZ_OVERRIDE;
michael@0 79
michael@0 80 #ifdef DEBUG_FRAME_DUMP
michael@0 81 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
michael@0 82 {
michael@0 83 return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
michael@0 84 }
michael@0 85 #endif
michael@0 86
michael@0 87 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 88 const nsRect& aDirtyRect,
michael@0 89 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 90
michael@0 91 // nsSVGPathGeometryFrame methods
michael@0 92 gfxMatrix GetCanvasTM(uint32_t aFor,
michael@0 93 nsIFrame* aTransformRoot = nullptr);
michael@0 94 protected:
michael@0 95 // nsISVGChildFrame interface:
michael@0 96 virtual nsresult PaintSVG(nsRenderingContext *aContext,
michael@0 97 const nsIntRect *aDirtyRect,
michael@0 98 nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
michael@0 99 virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
michael@0 100 virtual nsRect GetCoveredRegion() MOZ_OVERRIDE;
michael@0 101 virtual void ReflowSVG() MOZ_OVERRIDE;
michael@0 102 virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
michael@0 103 virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
michael@0 104 uint32_t aFlags) MOZ_OVERRIDE;
michael@0 105 virtual bool IsDisplayContainer() MOZ_OVERRIDE { return false; }
michael@0 106
michael@0 107 void GeneratePath(gfxContext *aContext, const Matrix &aTransform);
michael@0 108 /**
michael@0 109 * This function returns a set of bit flags indicating which parts of the
michael@0 110 * element (fill, stroke, bounds) should intercept pointer events. It takes
michael@0 111 * into account the type of element and the value of the 'pointer-events'
michael@0 112 * property on the element.
michael@0 113 */
michael@0 114 virtual uint16_t GetHitTestFlags();
michael@0 115 private:
michael@0 116 enum { eRenderFill = 1, eRenderStroke = 2 };
michael@0 117 void Render(nsRenderingContext *aContext, uint32_t aRenderComponents,
michael@0 118 nsIFrame* aTransformRoot);
michael@0 119 void PaintMarkers(nsRenderingContext *aContext);
michael@0 120
michael@0 121 struct MarkerProperties {
michael@0 122 nsSVGMarkerProperty* mMarkerStart;
michael@0 123 nsSVGMarkerProperty* mMarkerMid;
michael@0 124 nsSVGMarkerProperty* mMarkerEnd;
michael@0 125
michael@0 126 bool MarkersExist() const {
michael@0 127 return mMarkerStart || mMarkerMid || mMarkerEnd;
michael@0 128 }
michael@0 129
michael@0 130 nsSVGMarkerFrame *GetMarkerStartFrame();
michael@0 131 nsSVGMarkerFrame *GetMarkerMidFrame();
michael@0 132 nsSVGMarkerFrame *GetMarkerEndFrame();
michael@0 133 };
michael@0 134
michael@0 135 /**
michael@0 136 * @param aFrame should be the first continuation
michael@0 137 */
michael@0 138 static MarkerProperties GetMarkerProperties(nsSVGPathGeometryFrame *aFrame);
michael@0 139 };
michael@0 140
michael@0 141 #endif // __NS_SVGPATHGEOMETRYFRAME_H__

mercurial