/src/mozilla-central/layout/svg/nsCSSClipPathInstance.h
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 | | #ifndef __NS_CSSCLIPPATHINSTANCE_H__ |
8 | | #define __NS_CSSCLIPPATHINSTANCE_H__ |
9 | | |
10 | | #include "nsStyleStruct.h" |
11 | | #include "nsRect.h" |
12 | | #include "mozilla/gfx/2D.h" |
13 | | |
14 | | class nsIFrame; |
15 | | class gfxContext; |
16 | | |
17 | | namespace mozilla { |
18 | | |
19 | | class nsCSSClipPathInstance |
20 | | { |
21 | | typedef mozilla::gfx::DrawTarget DrawTarget; |
22 | | typedef mozilla::gfx::Path Path; |
23 | | typedef mozilla::gfx::Rect Rect; |
24 | | |
25 | | public: |
26 | | static void ApplyBasicShapeOrPathClip(gfxContext& aContext, |
27 | | nsIFrame* aFrame); |
28 | | // aPoint is in CSS pixels. |
29 | | static bool HitTestBasicShapeOrPathClip(nsIFrame* aFrame, |
30 | | const gfxPoint& aPoint); |
31 | | |
32 | | static Rect GetBoundingRectForBasicShapeOrPathClip( |
33 | | nsIFrame* aFrame, |
34 | | const StyleShapeSource& aClipPathStyle); |
35 | | |
36 | | private: |
37 | | explicit nsCSSClipPathInstance(nsIFrame* aFrame, |
38 | | const StyleShapeSource aClipPathStyle) |
39 | | : mTargetFrame(aFrame) |
40 | | , mClipPathStyle(aClipPathStyle) |
41 | 0 | { |
42 | 0 | } |
43 | | |
44 | | already_AddRefed<Path> CreateClipPath(DrawTarget* aDrawTarget); |
45 | | |
46 | | already_AddRefed<Path> CreateClipPathCircle(DrawTarget* aDrawTarget, |
47 | | const nsRect& aRefBox); |
48 | | |
49 | | already_AddRefed<Path> CreateClipPathEllipse(DrawTarget* aDrawTarget, |
50 | | const nsRect& aRefBox); |
51 | | |
52 | | already_AddRefed<Path> CreateClipPathPolygon(DrawTarget* aDrawTarget, |
53 | | const nsRect& aRefBox); |
54 | | |
55 | | already_AddRefed<Path> CreateClipPathInset(DrawTarget* aDrawTarget, |
56 | | const nsRect& aRefBox); |
57 | | |
58 | | already_AddRefed<Path> CreateClipPathPath(DrawTarget* aDrawTarget); |
59 | | |
60 | | /** |
61 | | * The frame for the element that is currently being clipped. |
62 | | */ |
63 | | nsIFrame* mTargetFrame; |
64 | | StyleShapeSource mClipPathStyle; |
65 | | }; |
66 | | |
67 | | } // namespace mozilla |
68 | | |
69 | | #endif |