author Andreas Pehrson <>
Tue, 28 Mar 2017 16:03:21 +0200
changeset 405001 bce76b2df8cc5a22cadfc3c06c61b94533308586
parent 390680 124fbb4b9a97ddb2b0f2f843b90208865d982f8c
child 412306 3d1ce85e6348307a1e98284e6d13da828729bf91
permissions -rw-r--r--
Bug 1320994 - Re-enable tests. r=florian MozReview-Commit-ID: KGe95JhBoVD

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */


#include "nsStyleStruct.h"
#include "nsRect.h"
#include "mozilla/gfx/2D.h"

class nsIFrame;
class nsRenderingContext;

namespace mozilla {

class nsCSSClipPathInstance
  typedef mozilla::gfx::DrawTarget DrawTarget;
  typedef mozilla::gfx::Path Path;

  static void ApplyBasicShapeClip(gfxContext& aContext,
                                  nsIFrame* aFrame);
  // aPoint is in CSS pixels.
  static bool HitTestBasicShapeClip(nsIFrame* aFrame,
                                    const gfxPoint& aPoint);
  explicit nsCSSClipPathInstance(nsIFrame* aFrame,
                                 const StyleShapeSource aClipPathStyle)
    : mTargetFrame(aFrame)
    , mClipPathStyle(aClipPathStyle)

  already_AddRefed<Path> CreateClipPath(DrawTarget* aDrawTarget);

  already_AddRefed<Path> CreateClipPathCircle(DrawTarget* aDrawTarget,
                                              const nsRect& aRefBox);

  already_AddRefed<Path> CreateClipPathEllipse(DrawTarget* aDrawTarget,
                                               const nsRect& aRefBox);

  already_AddRefed<Path> CreateClipPathPolygon(DrawTarget* aDrawTarget,
                                               const nsRect& aRefBox);

  already_AddRefed<Path> CreateClipPathInset(DrawTarget* aDrawTarget,
                                             const nsRect& aRefBox);

   * The frame for the element that is currently being clipped.
  nsIFrame* mTargetFrame;
  StyleShapeSource mClipPathStyle;

} // namespace mozilla