Title: [108492] trunk/Source/WebCore
Revision
108492
Author
[email protected]
Date
2012-02-22 06:18:33 -0800 (Wed, 22 Feb 2012)

Log Message

Drop clipToImageBuffer from RenderBoxModelObject
https://bugs.webkit.org/show_bug.cgi?id=79225

Reviewed by Nikolas Zimmermann.

-webkit-background-clip: text is a rarely used non-standard
feature uses clipToImageBuffer. It is replaced by
CompositeDestinationIn on a transparent layer. The new
approach has the same speed as the old one.

Existing tests cover this issue.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108491 => 108492)


--- trunk/Source/WebCore/ChangeLog	2012-02-22 13:56:24 UTC (rev 108491)
+++ trunk/Source/WebCore/ChangeLog	2012-02-22 14:18:33 UTC (rev 108492)
@@ -1,3 +1,20 @@
+2012-02-22  Zoltan Herczeg  <[email protected]>
+
+        Drop clipToImageBuffer from RenderBoxModelObject
+        https://bugs.webkit.org/show_bug.cgi?id=79225
+
+        Reviewed by Nikolas Zimmermann.
+
+        -webkit-background-clip: text is a rarely used non-standard
+        feature uses clipToImageBuffer. It is replaced by
+        CompositeDestinationIn on a transparent layer. The new
+        approach has the same speed as the old one.
+
+        Existing tests cover this issue.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+
 2012-02-22  Kenneth Rohde Christiansen  <[email protected]>
 
         Merge setVisibleRectTrajectoryVector and adjustVisibleRect to

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (108491 => 108492)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-02-22 13:56:24 UTC (rev 108491)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-02-22 14:18:33 UTC (rev 108492)
@@ -738,6 +738,9 @@
     }
     
     GraphicsContextStateSaver backgroundClipStateSaver(*context, false);
+    OwnPtr<ImageBuffer> maskImage;
+    IntRect maskRect;
+
     if (bgLayer->clip() == PaddingFillBox || bgLayer->clip() == ContentFillBox) {
         // Clip to the padding or content boxes as necessary.
         bool includePadding = bgLayer->clip() == ContentFillBox;
@@ -751,17 +754,17 @@
         // We have to draw our text into a mask that can then be used to clip background drawing.
         // First figure out how big the mask has to be.  It should be no bigger than what we need
         // to actually render, so we should intersect the dirty rect with the border box of the background.
-        IntRect maskRect = pixelSnappedIntRect(rect);
+        maskRect = pixelSnappedIntRect(rect);
         maskRect.intersect(paintInfo.rect);
-        
+
         // Now create the mask.
-        OwnPtr<ImageBuffer> maskImage = context->createCompatibleBuffer(maskRect.size());
+        maskImage = context->createCompatibleBuffer(maskRect.size());
         if (!maskImage)
             return;
-        
+
         GraphicsContext* maskImageContext = maskImage->context();
         maskImageContext->translate(-maskRect.x(), -maskRect.y());
-        
+
         // Now add the text to the clip.  We do this by painting using a special paint phase that signals to
         // InlineTextBoxes that they should just add their contents to the clip.
         PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, true, 0, paintInfo.renderRegion, 0);
@@ -772,12 +775,13 @@
             LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset() : LayoutSize();
             paint(info, scrolledPaintRect.location() - localOffset);
         }
-        
+
         // The mask has been created.  Now we just need to clip to it.
         backgroundClipStateSaver.save();
-        context->clipToImageBuffer(maskImage.get(), maskRect);
+        context->clip(maskRect);
+        context->beginTransparencyLayer(1);
     }
-    
+
     // Only fill with a base color (e.g., white) if we're the root document, since iframes/frames with
     // no background in the child document should show the parent's background.
     bool isOpaqueRoot = false;
@@ -855,6 +859,11 @@
                 compositeOp, useLowQualityScaling);
         }
     }
+
+    if (bgLayer->clip() == TextFillBox) {
+        context->drawImageBuffer(maskImage.get(), ColorSpaceDeviceRGB, maskRect, CompositeDestinationIn);
+        context->endTransparencyLayer();
+    }
 }
 
 static inline LayoutUnit resolveWidthForRatio(LayoutUnit height, const FloatSize& intrinsicRatio)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to