Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef __NS_CSSCLIPPATHINSTANCE_H__
7 : #define __NS_CSSCLIPPATHINSTANCE_H__
8 :
9 : #include "nsStyleStruct.h"
10 : #include "nsRect.h"
11 : #include "mozilla/gfx/2D.h"
12 :
13 : class nsIFrame;
14 : class gfxContext;
15 :
16 : namespace mozilla {
17 :
18 0 : class nsCSSClipPathInstance
19 : {
20 : typedef mozilla::gfx::DrawTarget DrawTarget;
21 : typedef mozilla::gfx::Path Path;
22 :
23 : public:
24 : static void ApplyBasicShapeClip(gfxContext& aContext,
25 : nsIFrame* aFrame);
26 : // aPoint is in CSS pixels.
27 : static bool HitTestBasicShapeClip(nsIFrame* aFrame,
28 : const gfxPoint& aPoint);
29 : private:
30 0 : explicit nsCSSClipPathInstance(nsIFrame* aFrame,
31 : const StyleShapeSource aClipPathStyle)
32 0 : : mTargetFrame(aFrame)
33 0 : , mClipPathStyle(aClipPathStyle)
34 : {
35 0 : }
36 :
37 : already_AddRefed<Path> CreateClipPath(DrawTarget* aDrawTarget);
38 :
39 : already_AddRefed<Path> CreateClipPathCircle(DrawTarget* aDrawTarget,
40 : const nsRect& aRefBox);
41 :
42 : already_AddRefed<Path> CreateClipPathEllipse(DrawTarget* aDrawTarget,
43 : const nsRect& aRefBox);
44 :
45 : already_AddRefed<Path> CreateClipPathPolygon(DrawTarget* aDrawTarget,
46 : const nsRect& aRefBox);
47 :
48 : already_AddRefed<Path> CreateClipPathInset(DrawTarget* aDrawTarget,
49 : const nsRect& aRefBox);
50 :
51 :
52 : /**
53 : * The frame for the element that is currently being clipped.
54 : */
55 : nsIFrame* mTargetFrame;
56 : StyleShapeSource mClipPathStyle;
57 : };
58 :
59 : } // namespace mozilla
60 :
61 : #endif
|