| 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 if (paintFlags & PaintLayerHaveTransparency) { | 1207 if (paintFlags & PaintLayerHaveTransparency) { |
| 1208 if (parent()) | 1208 if (parent()) |
| 1209 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye
r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.
paintBehavior); | 1209 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye
r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.
paintBehavior); |
| 1210 else | 1210 else |
| 1211 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin
gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav
ior); | 1211 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin
gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav
ior); |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 // Make sure the parent's clip rects have been calculated. | 1214 // Make sure the parent's clip rects have been calculated. |
| 1215 ClipRect clipRect = paintingInfo.paintDirtyRect; | 1215 ClipRect clipRect = paintingInfo.paintDirtyRect; |
| 1216 if (parent()) { | 1216 if (parent()) { |
| 1217 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore
OverlayScrollbarSize); | 1217 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects); |
| 1218 if (shouldRespectOverflowClip(paintFlags, renderer()) == IgnoreOverf
lowClip) | 1218 if (shouldRespectOverflowClip(paintFlags, renderer()) == IgnoreOverf
lowClip) |
| 1219 clipRectsContext.setIgnoreOverflowClip(); | 1219 clipRectsContext.setIgnoreOverflowClip(); |
| 1220 clipRect = clipper().backgroundClipRect(clipRectsContext); | 1220 clipRect = clipper().backgroundClipRect(clipRectsContext); |
| 1221 clipRect.intersect(paintingInfo.paintDirtyRect); | 1221 clipRect.intersect(paintingInfo.paintDirtyRect); |
| 1222 | 1222 |
| 1223 // Push the parent coordinate space's clip. | 1223 // Push the parent coordinate space's clip. |
| 1224 parent()->clipToRect(paintingInfo, context, clipRect, paintFlags); | 1224 parent()->clipToRect(paintingInfo, context, clipRect, paintFlags); |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 1227 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 | 1322 |
| 1323 LayerPaintingInfo localPaintingInfo(paintingInfo); | 1323 LayerPaintingInfo localPaintingInfo(paintingInfo); |
| 1324 bool deferredFiltersEnabled = renderer()->document().settings()->deferredFil
tersEnabled(); | 1324 bool deferredFiltersEnabled = renderer()->document().settings()->deferredFil
tersEnabled(); |
| 1325 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte
rs()); | 1325 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte
rs()); |
| 1326 | 1326 |
| 1327 LayerFragments layerFragments; | 1327 LayerFragments layerFragments; |
| 1328 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ | 1328 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ |
| 1329 // Collect the fragments. This will compute the clip rectangles and pain
t offsets for each layer fragment, as well as whether or not the content of each | 1329 // Collect the fragments. This will compute the clip rectangles and pain
t offsets for each layer fragment, as well as whether or not the content of each |
| 1330 // fragment should paint. | 1330 // fragment should paint. |
| 1331 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint
ingInfo.paintDirtyRect, | 1331 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint
ingInfo.paintDirtyRect, |
| 1332 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai
ntingClipRects, IgnoreOverlayScrollbarSize, | 1332 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai
ntingClipRects, |
| 1333 shouldRespectOverflowClip(paintFlags, renderer()), &offsetFromRoot,
localPaintingInfo.subPixelAccumulation); | 1333 shouldRespectOverflowClip(paintFlags, renderer()), &offsetFromRoot,
localPaintingInfo.subPixelAccumulation); |
| 1334 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); | 1334 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 if (filterPainter.haveFilterEffect()) { | 1337 if (filterPainter.haveFilterEffect()) { |
| 1338 ASSERT(this->filterInfo()); | 1338 ASSERT(this->filterInfo()); |
| 1339 | 1339 |
| 1340 if (!rootRelativeBoundsComputed) | 1340 if (!rootRelativeBoundsComputed) |
| 1341 rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStacki
ngChildren(paintingInfo.rootLayer, offsetFromRoot); | 1341 rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStacki
ngChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 1342 | 1342 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 // If this RenderLayer should paint into its own backing or a grouped ba
cking, that will be done via CompositedLayerMapping::paintContents() | 1508 // If this RenderLayer should paint into its own backing or a grouped ba
cking, that will be done via CompositedLayerMapping::paintContents() |
| 1509 // and CompositedLayerMapping::doPaintTask(). | 1509 // and CompositedLayerMapping::doPaintTask(). |
| 1510 if (!childLayer->shouldPaintLayerInSoftwareMode(paintingInfo, paintFlags
)) | 1510 if (!childLayer->shouldPaintLayerInSoftwareMode(paintingInfo, paintFlags
)) |
| 1511 continue; | 1511 continue; |
| 1512 | 1512 |
| 1513 childLayer->paintLayer(context, paintingInfo, paintFlags); | 1513 childLayer->paintLayer(context, paintingInfo, paintFlags); |
| 1514 } | 1514 } |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, | 1517 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, |
| 1518 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverl
ayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const L
ayoutPoint* offsetFromRoot, | 1518 ClipRectsCacheSlot clipRectsCacheSlot, ShouldRespectOverflowClip respectOver
flowClip, const LayoutPoint* offsetFromRoot, |
| 1519 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) | 1519 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) |
| 1520 { | 1520 { |
| 1521 // For unpaginated layers, there is only one fragment. | 1521 // For unpaginated layers, there is only one fragment. |
| 1522 LayerFragment fragment; | 1522 LayerFragment fragment; |
| 1523 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverlaySc
rollbarSizeRelevancy, subPixelAccumulation); | 1523 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, subPixelAcc
umulation); |
| 1524 if (respectOverflowClip == IgnoreOverflowClip) | 1524 if (respectOverflowClip == IgnoreOverflowClip) |
| 1525 clipRectsContext.setIgnoreOverflowClip(); | 1525 clipRectsContext.setIgnoreOverflowClip(); |
| 1526 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr
omRoot); | 1526 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr
omRoot); |
| 1527 fragments.append(fragment); | 1527 fragments.append(fragment); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 void RenderLayer::updatePaintingInfoForFragments(LayerFragments& fragments, cons
t LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, | 1530 void RenderLayer::updatePaintingInfoForFragments(LayerFragments& fragments, cons
t LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, |
| 1531 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) | 1531 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) |
| 1532 { | 1532 { |
| 1533 ASSERT(offsetFromRoot); | 1533 ASSERT(offsetFromRoot); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 { | 1846 { |
| 1847 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 1847 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 1848 return 0; | 1848 return 0; |
| 1849 | 1849 |
| 1850 // The natural thing would be to keep HitTestingTransformState on the stack,
but it's big, so we heap-allocate. | 1850 // The natural thing would be to keep HitTestingTransformState on the stack,
but it's big, so we heap-allocate. |
| 1851 | 1851 |
| 1852 // Apply a transform if we have one. | 1852 // Apply a transform if we have one. |
| 1853 if (transform() && !appliedTransform) { | 1853 if (transform() && !appliedTransform) { |
| 1854 // Make sure the parent's clip rects have been calculated. | 1854 // Make sure the parent's clip rects have been calculated. |
| 1855 if (parent()) { | 1855 if (parent()) { |
| 1856 ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(ro
otLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize)); | 1856 ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(ro
otLayer, RootRelativeClipRects)); |
| 1857 // Go ahead and test the enclosing clip now. | 1857 // Go ahead and test the enclosing clip now. |
| 1858 if (!clipRect.intersects(hitTestLocation)) | 1858 if (!clipRect.intersects(hitTestLocation)) |
| 1859 return 0; | 1859 return 0; |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques
t, result, hitTestRect, hitTestLocation, transformState, zOffset); | 1862 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, reques
t, result, hitTestRect, hitTestLocation, transformState, zOffset); |
| 1863 } | 1863 } |
| 1864 | 1864 |
| 1865 // Ensure our lists and 3d status are up-to-date. | 1865 // Ensure our lists and 3d status are up-to-date. |
| 1866 m_stackingNode->updateLayerListsIfNeeded(); | 1866 m_stackingNode->updateLayerListsIfNeeded(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, | 1926 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h
itTestRect, hitTestLocation, |
| 1927 localTransformState.get(), zOffsetForDescendantsPtr,
zOffset, unflattenedTransformState.get(), depthSortDescendants); | 1927 localTransformState.get(), zOffsetForDescendantsPtr,
zOffset, unflattenedTransformState.get(), depthSortDescendants); |
| 1928 if (hitLayer) { | 1928 if (hitLayer) { |
| 1929 if (!depthSortDescendants) | 1929 if (!depthSortDescendants) |
| 1930 return hitLayer; | 1930 return hitLayer; |
| 1931 candidateLayer = hitLayer; | 1931 candidateLayer = hitLayer; |
| 1932 } | 1932 } |
| 1933 | 1933 |
| 1934 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. | 1934 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. |
| 1935 LayerFragments layerFragments; | 1935 LayerFragments layerFragments; |
| 1936 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec
ts, IncludeOverlayScrollbarSize); | 1936 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec
ts); |
| 1937 | 1937 |
| 1938 // Next we want to see if the mouse pos is inside the child RenderObjects of
the layer. Check | 1938 // Next we want to see if the mouse pos is inside the child RenderObjects of
the layer. Check |
| 1939 // every fragment in reverse order. | 1939 // every fragment in reverse order. |
| 1940 if (isSelfPaintingLayer()) { | 1940 if (isSelfPaintingLayer()) { |
| 1941 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 1941 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. |
| 1942 HitTestResult tempResult(result.hitTestLocation()); | 1942 HitTestResult tempResult(result.hitTestLocation()); |
| 1943 bool insideFragmentForegroundRect = false; | 1943 bool insideFragmentForegroundRect = false; |
| 1944 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) | 1944 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) |
| 1945 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { | 1945 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { |
| 1946 if (result.isRectBasedTest()) | 1946 if (result.isRectBasedTest()) |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2740 } | 2740 } |
| 2741 } | 2741 } |
| 2742 | 2742 |
| 2743 void showLayerTree(const blink::RenderObject* renderer) | 2743 void showLayerTree(const blink::RenderObject* renderer) |
| 2744 { | 2744 { |
| 2745 if (!renderer) | 2745 if (!renderer) |
| 2746 return; | 2746 return; |
| 2747 showLayerTree(renderer->enclosingLayer()); | 2747 showLayerTree(renderer->enclosingLayer()); |
| 2748 } | 2748 } |
| 2749 #endif | 2749 #endif |
| OLD | NEW |