mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
886c0a2723
- Bug 1215411 - Define MOZ_FALLTHROUGH annotation to suppress clang's -Wimplicit-fallthrough warnings. r=botond (5549d55e8b)
- Bug 1202794 - Explicitly clear array in SortChildrenBy3DZOrder to satisfy the move analysis, r=mattwoodrow (0c53a3db36)
- Bug 1217168 - Respect layer clip rects during plugin visibility computation. r=jimm (6289d35ff1)
- Bug 1220693 - Make mozilla::Atomic<enum class> work even on compilers that don't have <atomic>. r=froydnj (ef1b490ffd)
- Bug 947062 - Make background-position inline-style changes and CSS animations trigger layer activity. r=roc (44bc576960)
- Bug 1201330 - Refactor LayerActivity property management. r=roc (92528b8765)
- Bug 1201330 - Keep scroll handler induced layer activity active until the scroll frame becomes inactive. r=roc (08670902ec)
- Bug 1147707 - Intersect correctly in DisplayItemClip::ApplyNonRoundedIntersection. r=roc (66991b6be6)
- better attempt at 10.5 compaitbility, avoiding out-of-bounds array access (18f481ff6b)
- Bug 1217662 - part 1 - make LayerManagerUserDataDestroy a static function of LayerManager; r=mattwoodrow (f2d34451e0)
- Bug 1217662 - part 2 - move mozilla::layers::LayerUserData to a separate header; r=mattwoodrow (036d7327fa)
- Bug 1217662 - part 3 - move nsDisplayBlendContainer::GetLayerState out-of-line; r=mattwoodrow (fb2bd6bd20)
- Bug 1217662 - part 4 - move {LayerManager,Layer}::RemoveUserData out-of-line; r=mattwoodrow (86836f2a9b)
- Bug 1217662 - part 5 - move FrameLayerBuilder and helper classes's ctors/dtors out-of-line; r=mattwoodrow (e838bde0ec)
- Bug 1217662 - part 6 - remove Layers.h #include from FrameListBuilder.h; r=mattwoodrow (8aea4cb842)
- Bug 1216288 - Disable warning when we don't build an active layer for RenderFrameParent within an opacity:0 subtree. r=roc (2c5e70760a)
- Bug 1169996 - Don't lose eEditorMailMask; r=ehsan (b4647557bb)
- Bug 1211654 - Force opacity layers that were only created for APZ hit-testing information to always be inactive. r=mstange (4c56d440cf)
- Bug 1154336 - Convert nsTextEditorState::mRestoringSelection into a strong reference; r=baku (3e24a6ad18)
- Bug 549674 part.1 Commit composition string at setting value of <input> or <textarea> r=smaug (e6a6471370)
- Bug 1109410 Resolve CSS transform in ContentEventHandler::ConvertToRootViewRelativeOffset() r=roc (5ff3388f28)
- Bug 1180589 part 3 - Rename shadowed variable name; r=bholley (7194cda020)
- Bug 1222145 - Bump maximum video size to 8k. r=jya (056778dda9)
- Bug 1180589 part 1 - Add simulator code for TV Manager API; r=seanlin (dd78a38a27)
- Bug 1180589 part 2 - Add code to create a simulated mediastream; r=se# (c255e0dd07)
- spacing (856ee42504)
- missing bit of Bug 1136827 - Stop synchronously (befed33dbe)
- bit of Bug 1204401 (c1f98ed982)
- bits of 1142527 (dc39662797)
- Bug 1212220 - cache pref values so they are safe to access off the main thread. r=roc. (adb186836b)
- Bug 1194918 - Add VideoSink which contains either AudioSinkWrapper or DecodedStreamSink as a default operating MediaSink in MDSM. r=jwwang. (7ccda9b055)
- Bug 1194918 - Move av-sync and video frame rendering logic from MDSM to VideoSink. r=jwwang. (ba56ae120b)
- Bug 1202533 - Fix naming convention of MediaSink::PlaybackParams. (eed5ed3839)
- Bug 1194918 - Override function SetVolume/SetPreservesPitch in VideoSink for the contained AudioSink. r=jwwang. (0d96e6a395)
- Bug 1198663. Skip null Images in VideoSink::RenderVideoFrames instead of treating them as valid. r=jwwang (aaac235c1f)
- Bug 1207198: P2. Defer dormant request while ReadMetadata is pending in MDSM. r=sotaro (0a8e1f4bb0)
- Bug 1209850: Only attempt to initialize decoders as they are required. r=alfredo (615e41b66b)
- Bug 1192733: fix the MediaFormatReader can not back from dormant state. r=jya (c266107d33)
- Bug 1207198: P1. Do not initialize decoders during ReadMetadata. r=cpearce (4174dbc409)
- missing bit of 1196696 (7b1c0fbe95)
- Bug 1208922. Part 6 - IsWaitingOnCDMResource() is not used by MDSM anymore. Remove it from MediaDecoderReader and make it private in MediaFormatReader. r=cpearce. (db67939710)
- adapted of Bug 1208922. Part 3 - forward the CDMProxy from MediaDecoder (a5dca2f89d)
479 lines
14 KiB
C++
479 lines
14 KiB
C++
/* -*- Mode: C++; tab-width: 20; 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "DisplayItemClip.h"
|
|
|
|
#include "gfxContext.h"
|
|
#include "gfxUtils.h"
|
|
#include "mozilla/gfx/2D.h"
|
|
#include "mozilla/gfx/PathHelpers.h"
|
|
#include "nsPresContext.h"
|
|
#include "nsCSSRendering.h"
|
|
#include "nsLayoutUtils.h"
|
|
#include "nsRegion.h"
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
namespace mozilla {
|
|
|
|
void
|
|
DisplayItemClip::SetTo(const nsRect& aRect)
|
|
{
|
|
SetTo(aRect, nullptr);
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::SetTo(const nsRect& aRect, const nscoord* aRadii)
|
|
{
|
|
mHaveClipRect = true;
|
|
mClipRect = aRect;
|
|
if (aRadii) {
|
|
mRoundedClipRects.SetLength(1);
|
|
mRoundedClipRects[0].mRect = aRect;
|
|
memcpy(mRoundedClipRects[0].mRadii, aRadii, sizeof(nscoord)*8);
|
|
} else {
|
|
mRoundedClipRects.Clear();
|
|
}
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::SetTo(const nsRect& aRect,
|
|
const nsRect& aRoundedRect,
|
|
const nscoord* aRadii)
|
|
{
|
|
mHaveClipRect = true;
|
|
mClipRect = aRect;
|
|
mRoundedClipRects.SetLength(1);
|
|
mRoundedClipRects[0].mRect = aRoundedRect;
|
|
memcpy(mRoundedClipRects[0].mRadii, aRadii, sizeof(nscoord)*8);
|
|
}
|
|
|
|
bool
|
|
DisplayItemClip::MayIntersect(const nsRect& aRect) const
|
|
{
|
|
if (!mHaveClipRect) {
|
|
return !aRect.IsEmpty();
|
|
}
|
|
nsRect r = aRect.Intersect(mClipRect);
|
|
if (r.IsEmpty()) {
|
|
return false;
|
|
}
|
|
for (uint32_t i = 0; i < mRoundedClipRects.Length(); ++i) {
|
|
const RoundedRect& rr = mRoundedClipRects[i];
|
|
if (!nsLayoutUtils::RoundedRectIntersectsRect(rr.mRect, rr.mRadii, r)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::IntersectWith(const DisplayItemClip& aOther)
|
|
{
|
|
if (!aOther.mHaveClipRect) {
|
|
return;
|
|
}
|
|
if (!mHaveClipRect) {
|
|
*this = aOther;
|
|
return;
|
|
}
|
|
if (!mClipRect.IntersectRect(mClipRect, aOther.mClipRect)) {
|
|
mRoundedClipRects.Clear();
|
|
return;
|
|
}
|
|
mRoundedClipRects.AppendElements(aOther.mRoundedClipRects);
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::ApplyTo(gfxContext* aContext,
|
|
nsPresContext* aPresContext,
|
|
uint32_t aBegin, uint32_t aEnd)
|
|
{
|
|
int32_t A2D = aPresContext->AppUnitsPerDevPixel();
|
|
ApplyRectTo(aContext, A2D);
|
|
ApplyRoundedRectClipsTo(aContext, A2D, aBegin, aEnd);
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::ApplyRectTo(gfxContext* aContext, int32_t A2D) const
|
|
{
|
|
aContext->NewPath();
|
|
gfxRect clip = nsLayoutUtils::RectToGfxRect(mClipRect, A2D);
|
|
aContext->Rectangle(clip, true);
|
|
aContext->Clip();
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::ApplyRoundedRectClipsTo(gfxContext* aContext,
|
|
int32_t A2D,
|
|
uint32_t aBegin, uint32_t aEnd) const
|
|
{
|
|
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
|
|
|
|
aEnd = std::min<uint32_t>(aEnd, mRoundedClipRects.Length());
|
|
|
|
for (uint32_t i = aBegin; i < aEnd; ++i) {
|
|
RefPtr<Path> roundedRect =
|
|
MakeRoundedRectPath(aDrawTarget, A2D, mRoundedClipRects[i]);
|
|
aContext->Clip(roundedRect);
|
|
}
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::FillIntersectionOfRoundedRectClips(gfxContext* aContext,
|
|
const Color& aColor,
|
|
int32_t aAppUnitsPerDevPixel,
|
|
uint32_t aBegin,
|
|
uint32_t aEnd) const
|
|
{
|
|
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
|
|
|
|
aEnd = std::min<uint32_t>(aEnd, mRoundedClipRects.Length());
|
|
|
|
if (aBegin >= aEnd) {
|
|
return;
|
|
}
|
|
|
|
// Push clips for any rects that come BEFORE the rect at |aEnd - 1|, if any:
|
|
ApplyRoundedRectClipsTo(aContext, aAppUnitsPerDevPixel, aBegin, aEnd - 1);
|
|
|
|
// Now fill the rect at |aEnd - 1|:
|
|
RefPtr<Path> roundedRect = MakeRoundedRectPath(aDrawTarget,
|
|
aAppUnitsPerDevPixel,
|
|
mRoundedClipRects[aEnd - 1]);
|
|
ColorPattern color(ToDeviceColor(aColor));
|
|
aDrawTarget.Fill(roundedRect, color);
|
|
|
|
// Finally, pop any clips that we may have pushed:
|
|
for (uint32_t i = aBegin; i < aEnd - 1; ++i) {
|
|
aContext->PopClip();
|
|
}
|
|
}
|
|
|
|
already_AddRefed<Path>
|
|
DisplayItemClip::MakeRoundedRectPath(DrawTarget& aDrawTarget,
|
|
int32_t A2D,
|
|
const RoundedRect &aRoundRect) const
|
|
{
|
|
RectCornerRadii pixelRadii;
|
|
nsCSSRendering::ComputePixelRadii(aRoundRect.mRadii, A2D, &pixelRadii);
|
|
|
|
Rect rect = NSRectToSnappedRect(aRoundRect.mRect, A2D, aDrawTarget);
|
|
|
|
return MakePathForRoundedRect(aDrawTarget, rect, pixelRadii);
|
|
}
|
|
|
|
nsRect
|
|
DisplayItemClip::ApproximateIntersectInward(const nsRect& aRect) const
|
|
{
|
|
nsRect r = aRect;
|
|
if (mHaveClipRect) {
|
|
r.IntersectRect(r, mClipRect);
|
|
}
|
|
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
|
|
i < iEnd; ++i) {
|
|
const RoundedRect &rr = mRoundedClipRects[i];
|
|
nsRegion rgn = nsLayoutUtils::RoundedRectIntersectRect(rr.mRect, rr.mRadii, r);
|
|
r = rgn.GetLargestRectangle();
|
|
}
|
|
return r;
|
|
}
|
|
|
|
// Test if (aXPoint, aYPoint) is in the ellipse with center (aXCenter, aYCenter)
|
|
// and radii aXRadius, aYRadius.
|
|
bool IsInsideEllipse(nscoord aXRadius, nscoord aXCenter, nscoord aXPoint,
|
|
nscoord aYRadius, nscoord aYCenter, nscoord aYPoint)
|
|
{
|
|
float scaledX = float(aXPoint - aXCenter) / float(aXRadius);
|
|
float scaledY = float(aYPoint - aYCenter) / float(aYRadius);
|
|
return scaledX * scaledX + scaledY * scaledY < 1.0f;
|
|
}
|
|
|
|
bool
|
|
DisplayItemClip::IsRectClippedByRoundedCorner(const nsRect& aRect) const
|
|
{
|
|
if (mRoundedClipRects.IsEmpty())
|
|
return false;
|
|
|
|
nsRect rect;
|
|
rect.IntersectRect(aRect, NonRoundedIntersection());
|
|
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
|
|
i < iEnd; ++i) {
|
|
const RoundedRect &rr = mRoundedClipRects[i];
|
|
// top left
|
|
if (rect.x < rr.mRect.x + rr.mRadii[NS_CORNER_TOP_LEFT_X] &&
|
|
rect.y < rr.mRect.y + rr.mRadii[NS_CORNER_TOP_LEFT_Y]) {
|
|
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_TOP_LEFT_X],
|
|
rr.mRect.x + rr.mRadii[NS_CORNER_TOP_LEFT_X],
|
|
rect.x,
|
|
rr.mRadii[NS_CORNER_TOP_LEFT_Y],
|
|
rr.mRect.y + rr.mRadii[NS_CORNER_TOP_LEFT_Y],
|
|
rect.y)) {
|
|
return true;
|
|
}
|
|
}
|
|
// top right
|
|
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[NS_CORNER_TOP_RIGHT_X] &&
|
|
rect.y < rr.mRect.y + rr.mRadii[NS_CORNER_TOP_RIGHT_Y]) {
|
|
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_TOP_RIGHT_X],
|
|
rr.mRect.XMost() - rr.mRadii[NS_CORNER_TOP_RIGHT_X],
|
|
rect.XMost(),
|
|
rr.mRadii[NS_CORNER_TOP_RIGHT_Y],
|
|
rr.mRect.y + rr.mRadii[NS_CORNER_TOP_RIGHT_Y],
|
|
rect.y)) {
|
|
return true;
|
|
}
|
|
}
|
|
// bottom left
|
|
if (rect.x < rr.mRect.x + rr.mRadii[NS_CORNER_BOTTOM_LEFT_X] &&
|
|
rect.YMost() > rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y]) {
|
|
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_BOTTOM_LEFT_X],
|
|
rr.mRect.x + rr.mRadii[NS_CORNER_BOTTOM_LEFT_X],
|
|
rect.x,
|
|
rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
|
rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
|
rect.YMost())) {
|
|
return true;
|
|
}
|
|
}
|
|
// bottom right
|
|
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X] &&
|
|
rect.YMost() > rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y]) {
|
|
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
|
rr.mRect.XMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
|
rect.XMost(),
|
|
rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y],
|
|
rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y],
|
|
rect.YMost())) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
nsRect
|
|
DisplayItemClip::NonRoundedIntersection() const
|
|
{
|
|
NS_ASSERTION(mHaveClipRect, "Must have a clip rect!");
|
|
nsRect result = mClipRect;
|
|
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
|
|
i < iEnd; ++i) {
|
|
result.IntersectRect(result, mRoundedClipRects[i].mRect);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
bool
|
|
DisplayItemClip::IsRectAffectedByClip(const nsRect& aRect) const
|
|
{
|
|
if (mHaveClipRect && !mClipRect.Contains(aRect)) {
|
|
return true;
|
|
}
|
|
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
|
|
i < iEnd; ++i) {
|
|
const RoundedRect &rr = mRoundedClipRects[i];
|
|
nsRegion rgn = nsLayoutUtils::RoundedRectIntersectRect(rr.mRect, rr.mRadii, aRect);
|
|
if (!rgn.Contains(aRect)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool
|
|
DisplayItemClip::IsRectAffectedByClip(const nsIntRect& aRect,
|
|
float aXScale,
|
|
float aYScale,
|
|
int32_t A2D) const
|
|
{
|
|
if (mHaveClipRect) {
|
|
nsIntRect pixelClipRect = mClipRect.ScaleToNearestPixels(aXScale, aYScale, A2D);
|
|
if (!pixelClipRect.Contains(aRect)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Rounded rect clipping only snaps to user-space pixels, not device space.
|
|
nsIntRect unscaled = aRect;
|
|
unscaled.Scale(1/aXScale, 1/aYScale);
|
|
|
|
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
|
|
i < iEnd; ++i) {
|
|
const RoundedRect &rr = mRoundedClipRects[i];
|
|
|
|
nsIntRect pixelRect = rr.mRect.ToNearestPixels(A2D);
|
|
|
|
RectCornerRadii pixelRadii;
|
|
nsCSSRendering::ComputePixelRadii(rr.mRadii, A2D, &pixelRadii);
|
|
|
|
nsIntRegion rgn = nsLayoutUtils::RoundedRectIntersectIntRect(pixelRect, pixelRadii, unscaled);
|
|
if (!rgn.Contains(unscaled)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
nsRect
|
|
DisplayItemClip::ApplyNonRoundedIntersection(const nsRect& aRect) const
|
|
{
|
|
if (!mHaveClipRect) {
|
|
return aRect;
|
|
}
|
|
|
|
nsRect result = aRect.Intersect(mClipRect);
|
|
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
|
|
i < iEnd; ++i) {
|
|
result = result.Intersect(mRoundedClipRects[i].mRect);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::RemoveRoundedCorners()
|
|
{
|
|
if (mRoundedClipRects.IsEmpty())
|
|
return;
|
|
|
|
mClipRect = NonRoundedIntersection();
|
|
mRoundedClipRects.Clear();
|
|
}
|
|
|
|
// Computes the difference between aR1 and aR2, limited to aBounds.
|
|
static void
|
|
AccumulateRectDifference(const nsRect& aR1, const nsRect& aR2, const nsRect& aBounds, nsRegion* aOut)
|
|
{
|
|
if (aR1.IsEqualInterior(aR2))
|
|
return;
|
|
nsRegion r;
|
|
r.Xor(aR1, aR2);
|
|
r.And(r, aBounds);
|
|
aOut->Or(*aOut, r);
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::AddOffsetAndComputeDifference(uint32_t aStart,
|
|
const nsPoint& aOffset,
|
|
const nsRect& aBounds,
|
|
const DisplayItemClip& aOther,
|
|
uint32_t aOtherStart,
|
|
const nsRect& aOtherBounds,
|
|
nsRegion* aDifference)
|
|
{
|
|
if (mHaveClipRect != aOther.mHaveClipRect ||
|
|
aStart != aOtherStart ||
|
|
mRoundedClipRects.Length() != aOther.mRoundedClipRects.Length()) {
|
|
aDifference->Or(*aDifference, aBounds);
|
|
aDifference->Or(*aDifference, aOtherBounds);
|
|
return;
|
|
}
|
|
if (mHaveClipRect) {
|
|
AccumulateRectDifference(mClipRect + aOffset, aOther.mClipRect,
|
|
aBounds.Union(aOtherBounds),
|
|
aDifference);
|
|
}
|
|
for (uint32_t i = aStart; i < mRoundedClipRects.Length(); ++i) {
|
|
if (mRoundedClipRects[i] + aOffset != aOther.mRoundedClipRects[i]) {
|
|
// The corners make it tricky so we'll just add both rects here.
|
|
aDifference->Or(*aDifference, mRoundedClipRects[i].mRect.Intersect(aBounds));
|
|
aDifference->Or(*aDifference, aOther.mRoundedClipRects[i].mRect.Intersect(aOtherBounds));
|
|
}
|
|
}
|
|
}
|
|
|
|
uint32_t
|
|
DisplayItemClip::GetCommonRoundedRectCount(const DisplayItemClip& aOther,
|
|
uint32_t aMax) const
|
|
{
|
|
uint32_t end = std::min(std::min(mRoundedClipRects.Length(), size_t(aMax)),
|
|
aOther.mRoundedClipRects.Length());
|
|
uint32_t clipCount = 0;
|
|
for (; clipCount < end; ++clipCount) {
|
|
if (mRoundedClipRects[clipCount] !=
|
|
aOther.mRoundedClipRects[clipCount]) {
|
|
return clipCount;
|
|
}
|
|
}
|
|
return clipCount;
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::AppendRoundedRects(nsTArray<RoundedRect>* aArray, uint32_t aCount) const
|
|
{
|
|
uint32_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
|
|
for (uint32_t i = 0; i < count; ++i) {
|
|
*aArray->AppendElement() = mRoundedClipRects[i];
|
|
}
|
|
}
|
|
|
|
bool
|
|
DisplayItemClip::ComputeRegionInClips(DisplayItemClip* aOldClip,
|
|
const nsPoint& aShift,
|
|
nsRegion* aCombined) const
|
|
{
|
|
if (!mHaveClipRect || (aOldClip && !aOldClip->mHaveClipRect)) {
|
|
return false;
|
|
}
|
|
|
|
if (aOldClip) {
|
|
*aCombined = aOldClip->NonRoundedIntersection();
|
|
aCombined->MoveBy(aShift);
|
|
aCombined->Or(*aCombined, NonRoundedIntersection());
|
|
} else {
|
|
*aCombined = NonRoundedIntersection();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::MoveBy(nsPoint aPoint)
|
|
{
|
|
if (!mHaveClipRect)
|
|
return;
|
|
mClipRect += aPoint;
|
|
for (uint32_t i = 0; i < mRoundedClipRects.Length(); ++i) {
|
|
mRoundedClipRects[i].mRect += aPoint;
|
|
}
|
|
}
|
|
|
|
static DisplayItemClip* gNoClip;
|
|
|
|
const DisplayItemClip&
|
|
DisplayItemClip::NoClip()
|
|
{
|
|
if (!gNoClip) {
|
|
gNoClip = new DisplayItemClip();
|
|
}
|
|
return *gNoClip;
|
|
}
|
|
|
|
void
|
|
DisplayItemClip::Shutdown()
|
|
{
|
|
delete gNoClip;
|
|
gNoClip = nullptr;
|
|
}
|
|
|
|
nsCString
|
|
DisplayItemClip::ToString() const
|
|
{
|
|
nsAutoCString str;
|
|
if (mHaveClipRect) {
|
|
str.AppendPrintf("%d,%d,%d,%d", mClipRect.x, mClipRect.y,
|
|
mClipRect.width, mClipRect.height);
|
|
for (uint32_t i = 0; i < mRoundedClipRects.Length(); ++i) {
|
|
const RoundedRect& r = mRoundedClipRects[i];
|
|
str.AppendPrintf(" [%d,%d,%d,%d corners %d,%d,%d,%d,%d,%d,%d,%d]",
|
|
r.mRect.x, r.mRect.y, r.mRect.width, r.mRect.height,
|
|
r.mRadii[0], r.mRadii[1], r.mRadii[2], r.mRadii[3],
|
|
r.mRadii[4], r.mRadii[5], r.mRadii[6], r.mRadii[7]);
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
|
|
} // namespace mozilla
|