Bug 1311270 - Part 8. Add assertion for margin-box. draft
authorcku <cku@mozilla.com>
Wed, 30 Nov 2016 15:51:05 +0800
changeset 453294 b1c1deb914ba23f74953670e8e79cc0d3ba635c4
parent 453293 cad013dabea9af3f5636f894f867ff913d004cce
child 453295 166ccd5c661338f6f4d090275b486b6463fa4fc6
push id39618
push userbmo:cku@mozilla.com
push dateFri, 23 Dec 2016 04:25:44 +0000
bugs1311270
milestone53.0a1
Bug 1311270 - Part 8. Add assertion for margin-box. MozReview-Commit-ID: FEkEf3ps83k
layout/painting/nsCSSRendering.cpp
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -2044,16 +2044,24 @@ 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.
     layerClip = StyleGeometryBox::Padding;
   }
 
+  // See the comment of StyleGeometryBox::Margin.
+  // Hitting this assertion means we decide to turn on margin-box support for
+  // positioned mask from CSS parser and style system. In this case, you
+  // should *inflate* mBGClipArea by the margin returning from
+  // aForFrame->GetUsedMargin() in the code chunk bellow.
+  MOZ_ASSERT(layerClip != StyleGeometryBox::Margin,
+             "StyleGeometryBox::Margin rendering is not supported yet.\n");
+
   if (layerClip != StyleGeometryBox::Border &&
       layerClip != StyleGeometryBox::Text) {
     nsMargin border = aForFrame->GetUsedBorder();
     if (layerClip == StyleGeometryBox::MozAlmostPadding) {
       // Reduce |border| by 1px (device pixels) on all sides, if
       // possible, so that we don't get antialiasing seams between the
       // {background|mask} and border.
       border.top = std::max(0, border.top - aAppUnitsPerPixel);
@@ -3530,16 +3538,25 @@ nsCSSRendering::ComputeImageLayerPositio
     // finished and this page only displays the continuations of
     // absolutely positioned content).
     if (geometryFrame) {
       positionArea = geometryFrame->GetRect();
     }
   } else {
     positionArea = nsRect(nsPoint(0,0), aBorderArea.Size());
   }
+
+  // See the comment of StyleGeometryBox::Margin.
+  // Hitting this assertion means we decide to turn on margin-box support for
+  // positioned mask from CSS parser and style system. In this case, you
+  // should *inflate* positionArea by the margin returning from
+  // geometryFrame->GetUsedMargin() in the code chunk bellow.
+  MOZ_ASSERT(aLayer.mOrigin != StyleGeometryBox::Margin,
+             "StyleGeometryBox::Margin rendering is not supported yet.\n");
+
   // {background|mask} images are tiled over the '{background|mask}-clip' area
   // but the origin of the tiling is based on the '{background|mask}-origin'
   // area.
   if (layerOrigin != StyleGeometryBox::Border && geometryFrame) {
     nsMargin border = geometryFrame->GetUsedBorder();
     if (layerOrigin != StyleGeometryBox::Padding) {
       border += geometryFrame->GetUsedPadding();
       NS_ASSERTION(layerOrigin == StyleGeometryBox::Content,