2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2016-02-09 01:08:09 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef __NS_CSSCLIPPATHINSTANCE_H__
|
|
|
|
#define __NS_CSSCLIPPATHINSTANCE_H__
|
|
|
|
|
2018-11-13 01:20:52 +03:00
|
|
|
#include "gfxPoint.h"
|
2016-02-09 01:08:09 +03:00
|
|
|
#include "nsStyleStruct.h"
|
|
|
|
#include "nsRect.h"
|
|
|
|
#include "mozilla/gfx/2D.h"
|
|
|
|
|
|
|
|
class nsIFrame;
|
2017-06-09 22:14:53 +03:00
|
|
|
class gfxContext;
|
2016-02-09 01:08:09 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class nsCSSClipPathInstance {
|
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
typedef mozilla::gfx::Path Path;
|
2017-10-04 23:46:44 +03:00
|
|
|
typedef mozilla::gfx::Rect Rect;
|
2016-02-09 01:08:09 +03:00
|
|
|
|
|
|
|
public:
|
2018-08-18 01:48:02 +03:00
|
|
|
static void ApplyBasicShapeOrPathClip(gfxContext& aContext, nsIFrame* aFrame);
|
2016-02-09 01:08:09 +03:00
|
|
|
// aPoint is in CSS pixels.
|
2018-08-18 01:48:02 +03:00
|
|
|
static bool HitTestBasicShapeOrPathClip(nsIFrame* aFrame,
|
|
|
|
const gfxPoint& aPoint);
|
2017-10-04 23:46:44 +03:00
|
|
|
|
2018-08-18 01:48:02 +03:00
|
|
|
static Rect GetBoundingRectForBasicShapeOrPathClip(
|
2018-08-15 22:27:38 +03:00
|
|
|
nsIFrame* aFrame, const StyleShapeSource& aClipPathStyle);
|
|
|
|
|
2016-02-09 01:08:09 +03:00
|
|
|
private:
|
|
|
|
explicit nsCSSClipPathInstance(nsIFrame* aFrame,
|
2017-02-21 18:26:17 +03:00
|
|
|
const StyleShapeSource aClipPathStyle)
|
2016-02-09 01:08:09 +03:00
|
|
|
: mTargetFrame(aFrame), mClipPathStyle(aClipPathStyle) {}
|
|
|
|
|
|
|
|
already_AddRefed<Path> CreateClipPath(DrawTarget* aDrawTarget);
|
|
|
|
|
2016-02-09 01:09:08 +03:00
|
|
|
already_AddRefed<Path> CreateClipPathCircle(DrawTarget* aDrawTarget,
|
|
|
|
const nsRect& aRefBox);
|
|
|
|
|
|
|
|
already_AddRefed<Path> CreateClipPathEllipse(DrawTarget* aDrawTarget,
|
|
|
|
const nsRect& aRefBox);
|
|
|
|
|
2016-02-09 01:08:09 +03:00
|
|
|
already_AddRefed<Path> CreateClipPathPolygon(DrawTarget* aDrawTarget,
|
|
|
|
const nsRect& aRefBox);
|
|
|
|
|
2016-08-18 17:29:01 +03:00
|
|
|
already_AddRefed<Path> CreateClipPathInset(DrawTarget* aDrawTarget,
|
|
|
|
const nsRect& aRefBox);
|
2016-08-26 21:49:41 +03:00
|
|
|
|
2018-08-15 22:27:38 +03:00
|
|
|
already_AddRefed<Path> CreateClipPathPath(DrawTarget* aDrawTarget);
|
2016-08-26 21:49:41 +03:00
|
|
|
|
2016-02-09 01:08:09 +03:00
|
|
|
/**
|
|
|
|
* The frame for the element that is currently being clipped.
|
|
|
|
*/
|
|
|
|
nsIFrame* mTargetFrame;
|
2017-02-21 18:26:17 +03:00
|
|
|
StyleShapeSource mClipPathStyle;
|
2016-02-09 01:08:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|