Bug 1311270 - Part 8. Handle rendering of mask-clip:margin-box.
MozReview-Commit-ID: AhinMykxOKH
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -1871,23 +1871,16 @@ nsCSSRendering::GetImageLayerClip(const
// Same coordinate space as aBorderArea.
Sides skipSides = aForFrame->GetSkipSides();
nsRect clipBorderArea =
::BoxDecorationRectForBorder(aForFrame, aBorderArea, skipSides, &aBorder);
bool haveRoundedCorners = GetRadii(aForFrame, aBorder, aBorderArea,
clipBorderArea, aClipState->mRadii);
- // XXX TODO: bug 1303623 only implements the parser of fill-box|stroke-box|view-box|no-clip.
- // So we need to fallback to default value when rendering. We should remove this
- // in bug 1311270.
- if (backgroundClip == StyleGeometryBox::Margin) {
- backgroundClip = StyleGeometryBox::Border;
- }
-
bool isSolidBorder =
aWillPaintBorder && IsOpaqueBorder(aBorder);
if (isSolidBorder && backgroundClip == StyleGeometryBox::Border) {
// If we have rounded corners, we need to inflate the background
// drawing area a bit to avoid seams between the border and
// background.
backgroundClip = haveRoundedCorners
? StyleGeometryBox::MozAlmostPadding
@@ -1925,18 +1918,26 @@ nsCSSRendering::GetImageLayerClip(const
aClipState->mAdditionalBGClipArea.Deflate(padding);
}
// Also clip at a non-scrolling, rounded-corner 'padding-box',
// same as the scrolled content because of the 'overflow' property.
backgroundClip = StyleGeometryBox::Padding;
}
- if (backgroundClip != StyleGeometryBox::Border &&
- backgroundClip != StyleGeometryBox::Text) {
+ if (backgroundClip == StyleGeometryBox::Margin) {
+ nsMargin border = aForFrame->GetUsedMargin();
+ border.ApplySkipSides(skipSides);
+ aClipState->mBGClipArea.Inflate(border);
+
+ if (haveRoundedCorners) {
+ nsIFrame::InsetBorderRadii(aClipState->mRadii, border);
+ }
+ } else if (backgroundClip != StyleGeometryBox::Border &&
+ backgroundClip != StyleGeometryBox::Text) {
nsMargin border = aForFrame->GetUsedBorder();
if (backgroundClip == StyleGeometryBox::MozAlmostPadding) {
// Reduce |border| by 1px (device pixels) on all sides, if
// possible, so that we don't get antialiasing seams between the
// background and border.
border.top = std::max(0, border.top - aAppUnitsPerPixel);
border.right = std::max(0, border.right - aAppUnitsPerPixel);
border.bottom = std::max(0, border.bottom - aAppUnitsPerPixel);