Bug 1311270 - Part 8. Compute background-clip:text clip region as no-clip. draft
authorcku <cku@mozilla.com>
Thu, 24 Nov 2016 19:10:10 +0800
changeset 443853 6e1ead17e1bcc4547060d0625ac69b4dfd00c4d8
parent 443852 d57110d8b9f8fcf416792ae6a86812bad882870f
child 443854 56cc9210ce08bc54b5c45f18fb68cd75e59ba399
push id37112
push userbmo:cku@mozilla.com
push dateFri, 25 Nov 2016 08:55:39 +0000
bugs1311270
milestone53.0a1
Bug 1311270 - Part 8. Compute background-clip:text clip region as no-clip. MozReview-Commit-ID: HAytNoLaM2D
layout/painting/nsCSSRendering.cpp
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -1863,17 +1863,20 @@ nsCSSRendering::GetImageLayerClip(const 
       nsRect(aBorderArea.TopLeft() + toStrokeBoxOffset, clipArea.Size());
 
     SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
                     aAppUnitsPerPixel, &aClipState->mDirtyRect,
                     &aClipState->mDirtyRectGfx);
     return;
   }
 
-  if (layerClip == StyleGeometryBox::NoClip) {
+  // To prevent text-shape-mask been clipped out by border-box, we compute clip
+  // region of background-clip:text as no-clip.
+  if (layerClip == StyleGeometryBox::NoClip ||
+      layerClip == StyleGeometryBox::Text) {
     aClipState->mBGClipArea = aCallerDirtyRect;
     aClipState->mHasAdditionalBGClipArea = false;
     aClipState->mCustomClip = false;
 
     SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
                     aAppUnitsPerPixel, &aClipState->mDirtyRect,
                     &aClipState->mDirtyRectGfx);
     return;
@@ -1932,18 +1935,17 @@ 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;
   }
 
-  if (layerClip != StyleGeometryBox::Border &&
-      layerClip != StyleGeometryBox::Text) {
+  if (layerClip != StyleGeometryBox::Border) {
     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);
       border.right = std::max(0, border.right - aAppUnitsPerPixel);
       border.bottom = std::max(0, border.bottom - aAppUnitsPerPixel);