OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 enum TransparencyClipBoxBehavior { | 1209 enum TransparencyClipBoxBehavior { |
1210 PaintingTransparencyClipBox, | 1210 PaintingTransparencyClipBox, |
1211 HitTestingTransparencyClipBox | 1211 HitTestingTransparencyClipBox |
1212 }; | 1212 }; |
1213 | 1213 |
1214 enum TransparencyClipBoxMode { | 1214 enum TransparencyClipBoxMode { |
1215 DescendantsOfTransparencyClipBox, | 1215 DescendantsOfTransparencyClipBox, |
1216 RootOfTransparencyClipBox | 1216 RootOfTransparencyClipBox |
1217 }; | 1217 }; |
1218 | 1218 |
1219 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* roo
tLayer, TransparencyClipBoxBehavior, TransparencyClipBoxMode, PaintBehavior = 0)
; | 1219 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* roo
tLayer, TransparencyClipBoxBehavior, TransparencyClipBoxMode, const LayoutSize&
subPixelAccumulation, PaintBehavior = 0); |
1220 | 1220 |
1221 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
t RenderLayer* layer, const RenderLayer* rootLayer, | 1221 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
t RenderLayer* layer, const RenderLayer* rootLayer, |
1222 TransparencyClipBoxBehavior transparencyBehavior, PaintBehavior paintBehavio
r) | 1222 TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& subPixel
Accumulation, PaintBehavior paintBehavior) |
1223 { | 1223 { |
1224 // If we have a mask, then the clip is limited to the border box area (and t
here is | 1224 // If we have a mask, then the clip is limited to the border box area (and t
here is |
1225 // no need to examine child layers). | 1225 // no need to examine child layers). |
1226 if (!layer->renderer()->hasMask()) { | 1226 if (!layer->renderer()->hasMask()) { |
1227 // Note: we don't have to walk z-order lists since transparent elements
always establish | 1227 // Note: we don't have to walk z-order lists since transparent elements
always establish |
1228 // a stacking container. This means we can just walk the layer tree dire
ctly. | 1228 // a stacking container. This means we can just walk the layer tree dire
ctly. |
1229 for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSib
ling()) { | 1229 for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSib
ling()) { |
1230 if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionL
ayer() != curr) | 1230 if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionL
ayer() != curr) |
1231 clipRect.unite(transparencyClipBox(curr, rootLayer, transparency
Behavior, DescendantsOfTransparencyClipBox, paintBehavior)); | 1231 clipRect.unite(transparencyClipBox(curr, rootLayer, transparency
Behavior, DescendantsOfTransparencyClipBox, subPixelAccumulation, paintBehavior)
); |
1232 } | 1232 } |
1233 } | 1233 } |
1234 | 1234 |
1235 // If we have a reflection, then we need to account for that when we push th
e clip. Reflect our entire | 1235 // If we have a reflection, then we need to account for that when we push th
e clip. Reflect our entire |
1236 // current transparencyClipBox to catch all child layers. | 1236 // current transparencyClipBox to catch all child layers. |
1237 // FIXME: Accelerated compositing will eventually want to do something smart
here to avoid incorporating this | 1237 // FIXME: Accelerated compositing will eventually want to do something smart
here to avoid incorporating this |
1238 // size into the parent layer. | 1238 // size into the parent layer. |
1239 if (layer->renderer()->hasReflection()) { | 1239 if (layer->renderer()->hasReflection()) { |
1240 LayoutPoint delta; | 1240 LayoutPoint delta; |
1241 layer->convertToLayerCoords(rootLayer, delta); | 1241 layer->convertToLayerCoords(rootLayer, delta); |
1242 clipRect.move(-delta.x(), -delta.y()); | 1242 clipRect.move(-delta.x(), -delta.y()); |
1243 clipRect.unite(layer->renderBox()->reflectedRect(clipRect)); | 1243 clipRect.unite(layer->renderBox()->reflectedRect(clipRect)); |
1244 clipRect.moveBy(delta); | 1244 clipRect.moveBy(delta); |
1245 } | 1245 } |
1246 } | 1246 } |
1247 | 1247 |
1248 static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye
r* rootLayer, TransparencyClipBoxBehavior transparencyBehavior, | 1248 static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye
r* rootLayer, TransparencyClipBoxBehavior transparencyBehavior, |
1249 TransparencyClipBoxMode transparencyMode, PaintBehavior paintBehavior) | 1249 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula
tion, PaintBehavior paintBehavior) |
1250 { | 1250 { |
1251 // FIXME: Although this function completely ignores CSS-imposed clipping, we
did already intersect with the | 1251 // FIXME: Although this function completely ignores CSS-imposed clipping, we
did already intersect with the |
1252 // paintDirtyRect, and that should cut down on the amount we have to paint.
Still it | 1252 // paintDirtyRect, and that should cut down on the amount we have to paint.
Still it |
1253 // would be better to respect clips. | 1253 // would be better to respect clips. |
1254 | 1254 |
1255 if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClip
Box && layer->paintsWithTransform(paintBehavior)) | 1255 if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClip
Box && layer->paintsWithTransform(paintBehavior)) |
1256 || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasT
ransform()))) { | 1256 || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasT
ransform()))) { |
1257 // The best we can do here is to use enclosed bounding boxes to establis
h a "fuzzy" enough clip to encompass | 1257 // The best we can do here is to use enclosed bounding boxes to establis
h a "fuzzy" enough clip to encompass |
1258 // the transformed layer and all of its children. | 1258 // the transformed layer and all of its children. |
1259 const RenderLayer* paginationLayer = transparencyMode == DescendantsOfTr
ansparencyClipBox ? layer->enclosingPaginationLayer() : 0; | 1259 const RenderLayer* paginationLayer = transparencyMode == DescendantsOfTr
ansparencyClipBox ? layer->enclosingPaginationLayer() : 0; |
1260 const RenderLayer* rootLayerForTransform = paginationLayer ? paginationL
ayer : rootLayer; | 1260 const RenderLayer* rootLayerForTransform = paginationLayer ? paginationL
ayer : rootLayer; |
1261 LayoutPoint delta; | 1261 LayoutPoint delta; |
1262 layer->convertToLayerCoords(rootLayerForTransform, delta); | 1262 layer->convertToLayerCoords(rootLayerForTransform, delta); |
1263 | 1263 |
| 1264 delta.move(subPixelAccumulation); |
| 1265 IntPoint pixelSnappedDelta = roundedIntPoint(delta); |
1264 TransformationMatrix transform; | 1266 TransformationMatrix transform; |
1265 transform.translate(delta.x(), delta.y()); | 1267 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); |
1266 transform = transform * *layer->transform(); | 1268 transform = transform * *layer->transform(); |
1267 | 1269 |
1268 // We don't use fragment boxes when collecting a transformed layer's bou
nding box, since it always | 1270 // We don't use fragment boxes when collecting a transformed layer's bou
nding box, since it always |
1269 // paints unfragmented. | 1271 // paints unfragmented. |
1270 LayoutRect clipRect = layer->boundingBox(layer); | 1272 LayoutRect clipRect = layer->boundingBox(layer); |
1271 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp
arencyBehavior, paintBehavior); | 1273 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp
arencyBehavior, subPixelAccumulation, paintBehavior); |
1272 layer->renderer()->style()->filterOutsets().expandRect(clipRect); | 1274 layer->renderer()->style()->filterOutsets().expandRect(clipRect); |
1273 LayoutRect result = transform.mapRect(clipRect); | 1275 LayoutRect result = transform.mapRect(clipRect); |
1274 if (!paginationLayer) | 1276 if (!paginationLayer) |
1275 return result; | 1277 return result; |
1276 | 1278 |
1277 // We have to break up the transformed extent across our columns. | 1279 // We have to break up the transformed extent across our columns. |
1278 // Split our box up into the actual fragment boxes that render in the co
lumns/pages and unite those together to | 1280 // Split our box up into the actual fragment boxes that render in the co
lumns/pages and unite those together to |
1279 // get our true bounding box. | 1281 // get our true bounding box. |
1280 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(paginationLay
er->renderer()); | 1282 RenderFlowThread* enclosingFlowThread = toRenderFlowThread(paginationLay
er->renderer()); |
1281 result = enclosingFlowThread->fragmentsBoundingBox(result); | 1283 result = enclosingFlowThread->fragmentsBoundingBox(result); |
1282 | 1284 |
1283 LayoutPoint rootLayerDelta; | 1285 LayoutPoint rootLayerDelta; |
1284 paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta); | 1286 paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta); |
1285 result.moveBy(rootLayerDelta); | 1287 result.moveBy(rootLayerDelta); |
1286 return result; | 1288 return result; |
1287 } | 1289 } |
1288 | 1290 |
1289 LayoutRect clipRect = layer->boundingBox(rootLayer, RenderLayer::UseFragment
Boxes); | 1291 LayoutRect clipRect = layer->boundingBox(rootLayer, RenderLayer::UseFragment
Boxes); |
1290 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp
arencyBehavior, paintBehavior); | 1292 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp
arencyBehavior, subPixelAccumulation, paintBehavior); |
1291 layer->renderer()->style()->filterOutsets().expandRect(clipRect); | 1293 layer->renderer()->style()->filterOutsets().expandRect(clipRect); |
| 1294 clipRect.move(subPixelAccumulation); |
1292 return clipRect; | 1295 return clipRect; |
1293 } | 1296 } |
1294 | 1297 |
1295 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou
tRect& paintDirtyRect, PaintBehavior paintBehavior) | 1298 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou
tRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior pai
ntBehavior) |
1296 { | 1299 { |
1297 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc
yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect); | 1300 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc
yClipBox, RootOfTransparencyClipBox, subPixelAccumulation, paintBehavior), paint
DirtyRect); |
1298 } | 1301 } |
1299 | 1302 |
1300 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render
Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) | 1303 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render
Layer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAc
cumulation, PaintBehavior paintBehavior) |
1301 { | 1304 { |
1302 bool createTransparencyLayerForBlendMode = m_stackingNode->isStackingContext
() && m_blendInfo.childLayerHasBlendMode(); | 1305 bool createTransparencyLayerForBlendMode = m_stackingNode->isStackingContext
() && m_blendInfo.childLayerHasBlendMode(); |
1303 if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) |
| paintsWithBlendMode() || createTransparencyLayerForBlendMode) && m_usedTranspa
rency)) | 1306 if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) |
| paintsWithBlendMode() || createTransparencyLayerForBlendMode) && m_usedTranspa
rency)) |
1304 return; | 1307 return; |
1305 | 1308 |
1306 RenderLayer* ancestor = transparentPaintingAncestor(); | 1309 RenderLayer* ancestor = transparentPaintingAncestor(); |
1307 if (ancestor) | 1310 if (ancestor) |
1308 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa
intBehavior); | 1311 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, su
bPixelAccumulation, paintBehavior); |
1309 | 1312 |
1310 if (paintsWithTransparency(paintBehavior) || paintsWithBlendMode() || create
TransparencyLayerForBlendMode) { | 1313 if (paintsWithTransparency(paintBehavior) || paintsWithBlendMode() || create
TransparencyLayerForBlendMode) { |
1311 m_usedTransparency = true; | 1314 m_usedTransparency = true; |
1312 context->save(); | 1315 context->save(); |
1313 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh
avior); | 1316 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, subPixel
Accumulation, paintBehavior); |
1314 context->clip(clipRect); | 1317 context->clip(clipRect); |
1315 | 1318 |
1316 if (paintsWithBlendMode()) | 1319 if (paintsWithBlendMode()) |
1317 context->setCompositeOperation(context->compositeOperation(), m_blen
dInfo.blendMode()); | 1320 context->setCompositeOperation(context->compositeOperation(), m_blen
dInfo.blendMode()); |
1318 | 1321 |
1319 context->beginTransparencyLayer(renderer()->opacity()); | 1322 context->beginTransparencyLayer(renderer()->opacity()); |
1320 | 1323 |
1321 if (paintsWithBlendMode()) | 1324 if (paintsWithBlendMode()) |
1322 context->setCompositeOperation(context->compositeOperation(), blink:
:WebBlendModeNormal); | 1325 context->setCompositeOperation(context->compositeOperation(), blink:
:WebBlendModeNormal); |
1323 #ifdef REVEAL_TRANSPARENCY_LAYERS | 1326 #ifdef REVEAL_TRANSPARENCY_LAYERS |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 if (paintsWithTransform(paintingInfo.paintBehavior) && !(paintFlags & PaintL
ayerAppliedTransform)) { | 1893 if (paintsWithTransform(paintingInfo.paintBehavior) && !(paintFlags & PaintL
ayerAppliedTransform)) { |
1891 TransformationMatrix layerTransform = renderableTransform(paintingInfo.p
aintBehavior); | 1894 TransformationMatrix layerTransform = renderableTransform(paintingInfo.p
aintBehavior); |
1892 // If the transform can't be inverted, then don't paint anything. | 1895 // If the transform can't be inverted, then don't paint anything. |
1893 if (!layerTransform.isInvertible()) | 1896 if (!layerTransform.isInvertible()) |
1894 return; | 1897 return; |
1895 | 1898 |
1896 // If we have a transparency layer enclosing us and we are the root of a
transform, then we need to establish the transparency | 1899 // If we have a transparency layer enclosing us and we are the root of a
transform, then we need to establish the transparency |
1897 // layer from the parent now, assuming there is a parent | 1900 // layer from the parent now, assuming there is a parent |
1898 if (paintFlags & PaintLayerHaveTransparency) { | 1901 if (paintFlags & PaintLayerHaveTransparency) { |
1899 if (parent()) | 1902 if (parent()) |
1900 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye
r, paintingInfo.paintDirtyRect, paintingInfo.paintBehavior); | 1903 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye
r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.
paintBehavior); |
1901 else | 1904 else |
1902 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin
gInfo.paintDirtyRect, paintingInfo.paintBehavior); | 1905 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin
gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav
ior); |
1903 } | 1906 } |
1904 | 1907 |
1905 if (enclosingPaginationLayer()) { | 1908 if (enclosingPaginationLayer()) { |
1906 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags
); | 1909 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags
); |
1907 return; | 1910 return; |
1908 } | 1911 } |
1909 | 1912 |
1910 // Make sure the parent's clip rects have been calculated. | 1913 // Make sure the parent's clip rects have been calculated. |
1911 ClipRect clipRect = paintingInfo.paintDirtyRect; | 1914 ClipRect clipRect = paintingInfo.paintDirtyRect; |
1912 if (parent()) { | 1915 if (parent()) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 } | 2028 } |
2026 } | 2029 } |
2027 } | 2030 } |
2028 } | 2031 } |
2029 | 2032 |
2030 // Blending operations must be performed only with the nearest ancestor stac
king context. | 2033 // Blending operations must be performed only with the nearest ancestor stac
king context. |
2031 // Note that there is no need to create a transparency layer if we're painti
ng the root. | 2034 // Note that there is no need to create a transparency layer if we're painti
ng the root. |
2032 bool createTransparencyLayerForBlendMode = !renderer()->isRoot() && m_stacki
ngNode->isStackingContext() && m_blendInfo.childLayerHasBlendMode(); | 2035 bool createTransparencyLayerForBlendMode = !renderer()->isRoot() && m_stacki
ngNode->isStackingContext() && m_blendInfo.childLayerHasBlendMode(); |
2033 | 2036 |
2034 if (createTransparencyLayerForBlendMode) | 2037 if (createTransparencyLayerForBlendMode) |
2035 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.paintBehavior); | 2038 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); |
2036 | 2039 |
2037 LayerPaintingInfo localPaintingInfo(paintingInfo); | 2040 LayerPaintingInfo localPaintingInfo(paintingInfo); |
2038 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte
rs()); | 2041 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte
rs()); |
2039 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { | 2042 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { |
2040 RenderLayerFilterInfo* filterInfo = this->filterInfo(); | 2043 RenderLayerFilterInfo* filterInfo = this->filterInfo(); |
2041 ASSERT(filterInfo); | 2044 ASSERT(filterInfo); |
2042 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); | 2045 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); |
2043 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); | 2046 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); |
2044 | 2047 |
2045 if (!rootRelativeBoundsComputed) | 2048 if (!rootRelativeBoundsComputed) |
(...skipping 15 matching lines...) Expand all Loading... |
2061 // If the filter needs the full source image, we need to avoid u
sing the clip rectangles. | 2064 // If the filter needs the full source image, we need to avoid u
sing the clip rectangles. |
2062 // Otherwise, if for example this layer has overflow:hidden, a d
rop shadow will not compute correctly. | 2065 // Otherwise, if for example this layer has overflow:hidden, a d
rop shadow will not compute correctly. |
2063 // Note that we will still apply the clipping on the final rende
ring of the filter. | 2066 // Note that we will still apply the clipping on the final rende
ring of the filter. |
2064 localPaintingInfo.clipToDirtyRect = !filterRenderer()->hasFilter
ThatMovesPixels(); | 2067 localPaintingInfo.clipToDirtyRect = !filterRenderer()->hasFilter
ThatMovesPixels(); |
2065 } | 2068 } |
2066 } | 2069 } |
2067 } | 2070 } |
2068 | 2071 |
2069 if (filterPainter.hasStartedFilterEffect() && haveTransparency) { | 2072 if (filterPainter.hasStartedFilterEffect() && haveTransparency) { |
2070 // If we have a filter and transparency, we have to eagerly start a tran
sparency layer here, rather than risk a child layer lazily starts one with the w
rong context. | 2073 // If we have a filter and transparency, we have to eagerly start a tran
sparency layer here, rather than risk a child layer lazily starts one with the w
rong context. |
2071 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root
Layer, paintingInfo.paintDirtyRect, localPaintingInfo.paintBehavior); | 2074 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root
Layer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPain
tingInfo.paintBehavior); |
2072 } | 2075 } |
2073 | 2076 |
2074 // If this layer's renderer is a child of the paintingRoot, we render uncond
itionally, which | 2077 // If this layer's renderer is a child of the paintingRoot, we render uncond
itionally, which |
2075 // is done by passing a nil paintingRoot down to our renderer (as if no pain
tingRoot was ever set). | 2078 // is done by passing a nil paintingRoot down to our renderer (as if no pain
tingRoot was ever set). |
2076 // Else, our renderer tree may or may not contain the painting root, so we p
ass that root along | 2079 // Else, our renderer tree may or may not contain the painting root, so we p
ass that root along |
2077 // so it will be tested against as we descend through the renderers. | 2080 // so it will be tested against as we descend through the renderers. |
2078 RenderObject* paintingRootForRenderer = 0; | 2081 RenderObject* paintingRootForRenderer = 0; |
2079 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint
ingInfo.paintingRoot)) | 2082 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint
ingInfo.paintingRoot)) |
2080 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 2083 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
2081 | 2084 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginatio
nOffset; | 2298 LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginatio
nOffset; |
2296 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo
unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro
mRoot); | 2299 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo
unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro
mRoot); |
2297 } | 2300 } |
2298 } | 2301 } |
2299 } | 2302 } |
2300 | 2303 |
2301 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 2304 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
2302 { | 2305 { |
2303 LayerFragments enclosingPaginationFragments; | 2306 LayerFragments enclosingPaginationFragments; |
2304 LayoutPoint offsetOfPaginationLayerFromRoot; | 2307 LayoutPoint offsetOfPaginationLayerFromRoot; |
2305 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa
intBehavior); | 2308 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.su
bPixelAccumulation, paintingInfo.paintBehavior); |
2306 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p
aintingInfo.rootLayer, paintingInfo.paintDirtyRect, | 2309 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p
aintingInfo.rootLayer, paintingInfo.paintDirtyRect, |
2307 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint
ingClipRects, IgnoreOverlayScrollbarSize, | 2310 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint
ingClipRects, IgnoreOverlayScrollbarSize, |
2308 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip :
RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc
umulation, &transformedExtent); | 2311 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip :
RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc
umulation, &transformedExtent); |
2309 | 2312 |
2310 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { | 2313 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { |
2311 const LayerFragment& fragment = enclosingPaginationFragments.at(i); | 2314 const LayerFragment& fragment = enclosingPaginationFragments.at(i); |
2312 | 2315 |
2313 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and | 2316 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and |
2314 // the enclosing pagination layer. | 2317 // the enclosing pagination layer. |
2315 LayoutRect clipRect = fragment.backgroundRect.rect(); | 2318 LayoutRect clipRect = fragment.backgroundRect.rect(); |
(...skipping 28 matching lines...) Expand all Loading... |
2344 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 2347 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
2345 RenderObject* paintingRootForRenderer) | 2348 RenderObject* paintingRootForRenderer) |
2346 { | 2349 { |
2347 for (size_t i = 0; i < layerFragments.size(); ++i) { | 2350 for (size_t i = 0; i < layerFragments.size(); ++i) { |
2348 const LayerFragment& fragment = layerFragments.at(i); | 2351 const LayerFragment& fragment = layerFragments.at(i); |
2349 if (!fragment.shouldPaintContent) | 2352 if (!fragment.shouldPaintContent) |
2350 continue; | 2353 continue; |
2351 | 2354 |
2352 // Begin transparency layers lazily now that we know we have to paint so
mething. | 2355 // Begin transparency layers lazily now that we know we have to paint so
mething. |
2353 if (haveTransparency || paintsWithBlendMode()) | 2356 if (haveTransparency || paintsWithBlendMode()) |
2354 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.
rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); | 2357 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.
rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, l
ocalPaintingInfo.paintBehavior); |
2355 | 2358 |
2356 if (localPaintingInfo.clipToDirtyRect) { | 2359 if (localPaintingInfo.clipToDirtyRect) { |
2357 // Paint our background first, before painting any child layers. | 2360 // Paint our background first, before painting any child layers. |
2358 // Establish the clip used to paint our background. | 2361 // Establish the clip used to paint our background. |
2359 clipToRect(localPaintingInfo, context, fragment.backgroundRect, DoNo
tIncludeSelfForBorderRadius); // Background painting will handle clipping to sel
f. | 2362 clipToRect(localPaintingInfo, context, fragment.backgroundRect, DoNo
tIncludeSelfForBorderRadius); // Background painting will handle clipping to sel
f. |
2360 } | 2363 } |
2361 | 2364 |
2362 // Paint the background. | 2365 // Paint the background. |
2363 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. | 2366 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. |
2364 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0,
0, localPaintingInfo.rootLayer->renderer()); | 2367 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0,
0, localPaintingInfo.rootLayer->renderer()); |
2365 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); | 2368 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu
mulation, compositingState()))); |
2366 | 2369 |
2367 if (localPaintingInfo.clipToDirtyRect) | 2370 if (localPaintingInfo.clipToDirtyRect) |
2368 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); | 2371 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); |
2369 } | 2372 } |
2370 } | 2373 } |
2371 | 2374 |
2372 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, | 2375 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, |
2373 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 2376 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
2374 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe
xt) | 2377 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe
xt) |
2375 { | 2378 { |
2376 // Begin transparency if we have something to paint. | 2379 // Begin transparency if we have something to paint. |
2377 if (haveTransparency || paintsWithBlendMode()) { | 2380 if (haveTransparency || paintsWithBlendMode()) { |
2378 for (size_t i = 0; i < layerFragments.size(); ++i) { | 2381 for (size_t i = 0; i < layerFragments.size(); ++i) { |
2379 const LayerFragment& fragment = layerFragments.at(i); | 2382 const LayerFragment& fragment = layerFragments.at(i); |
2380 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty(
)) { | 2383 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty(
)) { |
2381 beginTransparencyLayers(transparencyLayerContext, localPaintingI
nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); | 2384 beginTransparencyLayers(transparencyLayerContext, localPaintingI
nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulatio
n, localPaintingInfo.paintBehavior); |
2382 break; | 2385 break; |
2383 } | 2386 } |
2384 } | 2387 } |
2385 } | 2388 } |
2386 | 2389 |
2387 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha
viorForceBlackText : paintBehavior; | 2390 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha
viorForceBlackText : paintBehavior; |
2388 | 2391 |
2389 // Optimize clipping for the single fragment case. | 2392 // Optimize clipping for the single fragment case. |
2390 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe
ct.isEmpty(); | 2393 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe
ct.isEmpty(); |
2391 if (shouldClip) | 2394 if (shouldClip) |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2944 } | 2947 } |
2945 | 2948 |
2946 return false; | 2949 return false; |
2947 } | 2950 } |
2948 | 2951 |
2949 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa
yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult&
result, | 2952 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa
yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult&
result, |
2950 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) | 2953 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) |
2951 { | 2954 { |
2952 LayerFragments enclosingPaginationFragments; | 2955 LayerFragments enclosingPaginationFragments; |
2953 LayoutPoint offsetOfPaginationLayerFromRoot; | 2956 LayoutPoint offsetOfPaginationLayerFromRoot; |
2954 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox); | 2957 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 |
| 2958 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination
Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox, LayoutSize())
; |
2955 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, | 2959 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r
ootLayer, hitTestRect, |
2956 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
&offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); | 2960 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
&offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); |
2957 | 2961 |
2958 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { | 2962 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { |
2959 const LayerFragment& fragment = enclosingPaginationFragments.at(i); | 2963 const LayerFragment& fragment = enclosingPaginationFragments.at(i); |
2960 | 2964 |
2961 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and | 2965 // Apply the page/column clip for this fragment, as well as any clips es
tablished by layers in between us and |
2962 // the enclosing pagination layer. | 2966 // the enclosing pagination layer. |
2963 LayoutRect clipRect = fragment.backgroundRect.rect(); | 2967 LayoutRect clipRect = fragment.backgroundRect.rect(); |
2964 | 2968 |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4031 } | 4035 } |
4032 } | 4036 } |
4033 | 4037 |
4034 void showLayerTree(const WebCore::RenderObject* renderer) | 4038 void showLayerTree(const WebCore::RenderObject* renderer) |
4035 { | 4039 { |
4036 if (!renderer) | 4040 if (!renderer) |
4037 return; | 4041 return; |
4038 showLayerTree(renderer->enclosingLayer()); | 4042 showLayerTree(renderer->enclosingLayer()); |
4039 } | 4043 } |
4040 #endif | 4044 #endif |
OLD | NEW |