Bug 1341149 - Implement ImageLayerClipState::ctor. r=mstange

MozReview-Commit-ID: 7MPrjtgz6c7

--HG--
extra : source : c6d13f12ccfa85af420139422910528c6fdcbbd2
extra : amend_source : 15c8d3471994fe5faea5a3bd75558aad29972632
This commit is contained in:
cku 2017-02-24 11:40:44 +08:00
parent 492e274bf6
commit f8a44da88a
2 changed files with 13 additions and 11 deletions

View File

@ -1996,15 +1996,15 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
bool aWillPaintBorder, nscoord aAppUnitsPerPixel,
/* out */ ImageLayerClipState* aClipState)
{
StyleGeometryBox layerClip = ComputeBoxValue(aForFrame, aLayer.mClip);
aClipState->mHasRoundedCorners = false;
aClipState->mHasAdditionalBGClipArea = false;
aClipState->mCustomClip = false;
StyleGeometryBox layerClip = ComputeBoxValue(aForFrame, aLayer.mClip);
if (IsSVGStyleGeometryBox(layerClip)) {
MOZ_ASSERT(aForFrame->IsFrameOfType(nsIFrame::eSVG) &&
(aForFrame->GetType() != nsGkAtoms::svgOuterSVGFrame));
aClipState->mHasAdditionalBGClipArea = false;
aClipState->mCustomClip = false;
// The coordinate space of clipArea is svg user space.
nsRect clipArea =
nsLayoutUtils::ComputeGeometryBox(aForFrame, layerClip);
@ -2033,8 +2033,6 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
if (layerClip == StyleGeometryBox::NoClip) {
aClipState->mBGClipArea = aCallerDirtyRect;
aClipState->mHasAdditionalBGClipArea = false;
aClipState->mCustomClip = false;
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
aAppUnitsPerPixel, &aClipState->mDirtyRect,
@ -2066,8 +2064,6 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
}
aClipState->mBGClipArea = clipBorderArea;
aClipState->mHasAdditionalBGClipArea = false;
aClipState->mCustomClip = false;
if (aForFrame->GetType() == nsGkAtoms::scrollFrame &&
NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL == aLayer.mAttachment) {
@ -2137,8 +2133,6 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
auto d2a = aForFrame->PresContext()->AppUnitsPerDevPixel();
nsCSSRendering::ComputePixelRadii(aClipState->mRadii, d2a, &aClipState->mClippedRadii);
aClipState->mHasRoundedCorners = true;
} else {
aClipState->mHasRoundedCorners = false;
}

View File

@ -596,7 +596,7 @@ struct nsCSSRendering {
bool* aOutIsTransformedFixed = nullptr);
struct ImageLayerClipState {
nsRect mBGClipArea; // Affected by mClippedRadii
nsRect mBGClipArea; // Affected by mClippedRadii
nsRect mAdditionalBGClipArea; // Not affected by mClippedRadii
nsRect mDirtyRect;
gfxRect mDirtyRectGfx;
@ -609,6 +609,14 @@ struct nsCSSRendering {
// Whether we are being asked to draw with a caller provided background
// clipping area. If this is true we also disable rounded corners.
bool mCustomClip;
ImageLayerClipState()
: mHasRoundedCorners(false),
mHasAdditionalBGClipArea(false),
mCustomClip(false)
{
memset(mRadii, 0, sizeof(nscoord) * 8);
}
};
static void