[webkit-dev] Cairo and "-webkit-mask-clip: text"
andrei.bucur at gmail.com
Wed Jun 23 09:45:51 PDT 2010
I'm trying to implement this CSS value on the Cairo backend and I'm stuck
with a problem regarding the Porter-Duff composition operators (why is
CAIRO_OPERATOR_DEST_IN unbound?). I've made the following changes to reach
1. I implemented a version of GraphicsContext::clipToImageBuffer starting
from this patch: https://bugs.webkit.org/show_bug.cgi?id=23526 , but saving
the image mask and the masking rect on a stack and pushing only a group for
the masked content.
2. In GraphicsContext::restorePlatformState when the save count is 0 for the
current mask, I recover the masked content as a pattern, I clip it using the
mask from the stack (I used a new group and operator CAIRO_OPERATOR_IN) and
then I should apply the result on the destination surface using
CAIRO_OPERATOR_DEST_IN, but bounded to the current mask. The problem here is
that CAIRO_OPERATOR_DEST_IN is unbounded so it doesn't take into account the
mask, thus affecting all the surface.
3. I modify RenderBoxModelObject::paintFillLayerExtended so that when
drawing the background image to use the bgLayer->composite() operator if the
clip is TextFillBox. Using CompositeSourceIn can't work because
clipToImageBuffer started a new group which uses a different surface for
drawing (so there is no destination text to composite with). This way the
composition will be done in restorePlatformState.
I know this is ugly and that it's highly unlikely to work in this form with
SVG masking. For now I just need a hook to make this work. Do you have any
other suggestions to make this CSS value work with Cairo?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev