Chromium Code Reviews| 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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 984 | 984 |
| 985 context->clipPath(clipPath->path(rootRelativeBounds), clipPath-> windRule()); | 985 context->clipPath(clipPath->path(rootRelativeBounds), clipPath-> windRule()); |
| 986 } | 986 } |
| 987 } | 987 } |
| 988 } | 988 } |
| 989 | 989 |
| 990 LayerPaintingInfo localPaintingInfo(paintingInfo); | 990 LayerPaintingInfo localPaintingInfo(paintingInfo); |
| 991 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs()); | 991 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs()); |
| 992 | 992 |
| 993 LayoutRect layerBounds; | 993 LayoutRect layerBounds; |
| 994 ClipRect backgroundRect, foregroundRect, outlineRect; | 994 ClipRect backgroundRect, foregroundRect; |
| 995 ClipRectsContext clipRectsContext(localPaintingInfo.rootLayer, PaintingClipR ects, localPaintingInfo.subPixelAccumulation); | 995 ClipRectsContext clipRectsContext(localPaintingInfo.rootLayer, PaintingClipR ects, localPaintingInfo.subPixelAccumulation); |
| 996 clipper().calculateRects(clipRectsContext, localPaintingInfo.paintDirtyRect, | 996 clipper().calculateRects(clipRectsContext, localPaintingInfo.paintDirtyRect, |
| 997 layerBounds, backgroundRect, foregroundRect, outlineRect, | 997 layerBounds, backgroundRect, foregroundRect, |
| 998 &offsetFromRoot); | 998 &offsetFromRoot); |
| 999 | 999 |
| 1000 bool isPaintingOverlayScrollbars = paintFlags == PaintOverlayScrollbars; | 1000 bool isPaintingOverlayScrollbars = paintFlags == PaintOverlayScrollbars; |
| 1001 bool shouldPaintContent = isSelfPaintingLayer() && !isPaintingOverlayScrollb ars | 1001 bool shouldPaintContent = isSelfPaintingLayer() && !isPaintingOverlayScrollb ars |
| 1002 && intersectsDamageRect(layerBounds, backgroundRect.rect(), localPaintin gInfo.rootLayer, &offsetFromRoot); | 1002 && intersectsDamageRect(layerBounds, backgroundRect.rect(), localPaintin gInfo.rootLayer, &offsetFromRoot); |
| 1003 | 1003 |
| 1004 bool haveTransparency = isTransparent(); | 1004 bool haveTransparency = isTransparent(); |
| 1005 | 1005 |
| 1006 if (filterPainter.haveFilterEffect()) { | 1006 if (filterPainter.haveFilterEffect()) { |
| 1007 ASSERT(this->filterInfo()); | 1007 ASSERT(this->filterInfo()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1041 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot)) | 1041 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot)) |
| 1042 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 1042 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
| 1043 | 1043 |
| 1044 LayoutPoint layerLocation = toPoint(layerBounds.location() - renderBoxLocati on() + localPaintingInfo.subPixelAccumulation); | 1044 LayoutPoint layerLocation = toPoint(layerBounds.location() - renderBoxLocati on() + localPaintingInfo.subPixelAccumulation); |
| 1045 | 1045 |
| 1046 if (shouldPaintContent) { | 1046 if (shouldPaintContent) { |
| 1047 paintForeground(context, transparencyLayerContext, paintingInfo.paintDir tyRect, haveTransparency, | 1047 paintForeground(context, transparencyLayerContext, paintingInfo.paintDir tyRect, haveTransparency, |
| 1048 localPaintingInfo, paintingRootForRenderer, layerLocation, foregroun dRect); | 1048 localPaintingInfo, paintingRootForRenderer, layerLocation, foregroun dRect); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 paintOutline(context, localPaintingInfo, paintingRootForRenderer, layerLocat ion, outlineRect); | |
|
ojan
2015/01/27 04:44:40
Honestly, not really sure why we don't need this c
| |
| 1052 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, painting Info, paintFlags); | 1051 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, painting Info, paintFlags); |
| 1053 | 1052 |
| 1054 if (isPaintingOverlayScrollbars) | 1053 if (isPaintingOverlayScrollbars) |
| 1055 paintOverflowControls(context, localPaintingInfo, layerLocation, backgro undRect); | 1054 paintOverflowControls(context, localPaintingInfo, layerLocation, backgro undRect); |
| 1056 | 1055 |
| 1057 if (filterPainter.hasStartedFilterEffect()) { | 1056 if (filterPainter.hasStartedFilterEffect()) { |
| 1058 context = filterPainter.applyFilterEffect(); | 1057 context = filterPainter.applyFilterEffect(); |
| 1059 restoreClip(transparencyLayerContext, localPaintingInfo.paintDirtyRect, backgroundRect); | 1058 restoreClip(transparencyLayerContext, localPaintingInfo.paintDirtyRect, backgroundRect); |
| 1060 } | 1059 } |
| 1061 | 1060 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 if (shouldClip) | 1127 if (shouldClip) |
| 1129 clipToRect(localPaintingInfo, context, layerForegroundRect); | 1128 clipToRect(localPaintingInfo, context, layerForegroundRect); |
| 1130 | 1129 |
| 1131 if (!foregroundRectIsEmpty) { | 1130 if (!foregroundRectIsEmpty) { |
| 1132 // We have to loop through every fragment multiple times, since we have to issue paint invalidations in each specific phase in order for | 1131 // We have to loop through every fragment multiple times, since we have to issue paint invalidations in each specific phase in order for |
| 1133 // interleaving of the fragments to work properly. | 1132 // interleaving of the fragments to work properly. |
| 1134 // FIXME(sky): Do we still need this for anything now that we don't have fragments? | 1133 // FIXME(sky): Do we still need this for anything now that we don't have fragments? |
| 1135 paintForegroundWithPhase(PaintPhaseForeground, | 1134 paintForegroundWithPhase(PaintPhaseForeground, |
| 1136 context, localPaintingInfo, paintingRootForRenderer, | 1135 context, localPaintingInfo, paintingRootForRenderer, |
| 1137 layerLocation, layerForegroundRect); | 1136 layerLocation, layerForegroundRect); |
| 1138 paintForegroundWithPhase(PaintPhaseChildOutlines, | |
| 1139 context, localPaintingInfo, paintingRootForRenderer, | |
| 1140 layerLocation, layerForegroundRect); | |
| 1141 } | 1137 } |
| 1142 | 1138 |
| 1143 if (shouldClip) | 1139 if (shouldClip) |
| 1144 restoreClip(context, localPaintingInfo.paintDirtyRect, layerForegroundRe ct); | 1140 restoreClip(context, localPaintingInfo.paintDirtyRect, layerForegroundRe ct); |
| 1145 } | 1141 } |
| 1146 | 1142 |
| 1147 void RenderLayer::paintForegroundWithPhase(PaintPhase phase, GraphicsContext* co ntext, | 1143 void RenderLayer::paintForegroundWithPhase(PaintPhase phase, GraphicsContext* co ntext, |
| 1148 const LayerPaintingInfo& localPaintingInfo, RenderObject* paintingRootForRen derer, LayoutPoint& layerLocation, ClipRect& layerForegroundRect) | 1144 const LayerPaintingInfo& localPaintingInfo, RenderObject* paintingRootForRen derer, LayoutPoint& layerLocation, ClipRect& layerForegroundRect) |
| 1149 { | 1145 { |
| 1150 PaintInfo paintInfo(context, pixelSnappedIntRect(layerForegroundRect.rect()) , phase, paintingRootForRenderer, localPaintingInfo.rootLayer->renderer()); | 1146 PaintInfo paintInfo(context, pixelSnappedIntRect(layerForegroundRect.rect()) , phase, paintingRootForRenderer, localPaintingInfo.rootLayer->renderer()); |
| 1151 renderer()->paint(paintInfo, layerLocation); | 1147 renderer()->paint(paintInfo, layerLocation); |
| 1152 } | 1148 } |
| 1153 | 1149 |
| 1154 void RenderLayer::paintOutline(GraphicsContext* context, const LayerPaintingInfo & localPaintingInfo, | |
| 1155 RenderObject* paintingRootForRenderer, LayoutPoint& layerLocation, ClipRect& layerOutlineRect) | |
| 1156 { | |
| 1157 if (layerOutlineRect.isEmpty()) | |
| 1158 return; | |
| 1159 | |
| 1160 PaintInfo paintInfo(context, pixelSnappedIntRect(layerOutlineRect.rect()), P aintPhaseSelfOutline, paintingRootForRenderer, localPaintingInfo.rootLayer->rend erer()); | |
| 1161 clipToRect(localPaintingInfo, context, layerOutlineRect, DoNotIncludeSelfFor BorderRadius); | |
| 1162 renderer()->paint(paintInfo, layerLocation); | |
| 1163 restoreClip(context, localPaintingInfo.paintDirtyRect, layerOutlineRect); | |
| 1164 } | |
| 1165 | |
| 1166 void RenderLayer::paintMask(GraphicsContext* context, const LayerPaintingInfo& l ocalPaintingInfo, | 1150 void RenderLayer::paintMask(GraphicsContext* context, const LayerPaintingInfo& l ocalPaintingInfo, |
| 1167 RenderObject* paintingRootForRenderer, LayoutPoint& layerLocation, ClipRect& layerBackgroundRect) | 1151 RenderObject* paintingRootForRenderer, LayoutPoint& layerLocation, ClipRect& layerBackgroundRect) |
| 1168 { | 1152 { |
| 1169 if (localPaintingInfo.clipToDirtyRect) | 1153 if (localPaintingInfo.clipToDirtyRect) |
| 1170 clipToRect(localPaintingInfo, context, layerBackgroundRect, DoNotInclude SelfForBorderRadius); // Mask painting will handle clipping to self. | 1154 clipToRect(localPaintingInfo, context, layerBackgroundRect, DoNotInclude SelfForBorderRadius); // Mask painting will handle clipping to self. |
| 1171 | 1155 |
| 1172 // Paint the mask. | 1156 // Paint the mask. |
| 1173 // FIXME: Eventually we will collect the region from the fragment itself ins tead of just from the paint info. | 1157 // FIXME: Eventually we will collect the region from the fragment itself ins tead of just from the paint info. |
| 1174 PaintInfo paintInfo(context, pixelSnappedIntRect(layerBackgroundRect.rect()) , PaintPhaseMask, paintingRootForRenderer, localPaintingInfo.rootLayer->renderer ()); | 1158 PaintInfo paintInfo(context, pixelSnappedIntRect(layerBackgroundRect.rect()) , PaintPhaseMask, paintingRootForRenderer, localPaintingInfo.rootLayer->renderer ()); |
| 1175 renderer()->paint(paintInfo, layerLocation); | 1159 renderer()->paint(paintInfo, layerLocation); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1409 // Now check our overflow objects. | 1393 // Now check our overflow objects. |
| 1410 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation, | 1394 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation, |
| 1411 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants); | 1395 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants); |
| 1412 if (hitLayer) { | 1396 if (hitLayer) { |
| 1413 if (!depthSortDescendants) | 1397 if (!depthSortDescendants) |
| 1414 return hitLayer; | 1398 return hitLayer; |
| 1415 candidateLayer = hitLayer; | 1399 candidateLayer = hitLayer; |
| 1416 } | 1400 } |
| 1417 | 1401 |
| 1418 LayoutRect layerBounds; | 1402 LayoutRect layerBounds; |
| 1419 ClipRect backgroundRect, foregroundRect, outlineRect; | 1403 ClipRect backgroundRect, foregroundRect; |
| 1420 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects); | 1404 ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects); |
| 1421 clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, backgro undRect, foregroundRect, outlineRect); | 1405 clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, backgro undRect, foregroundRect); |
| 1422 | 1406 |
| 1423 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. | 1407 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. |
| 1424 if (isSelfPaintingLayer() && foregroundRect.intersects(hitTestLocation)) { | 1408 if (isSelfPaintingLayer() && foregroundRect.intersects(hitTestLocation)) { |
| 1425 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. | 1409 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. |
| 1426 HitTestResult tempResult(result.hitTestLocation()); | 1410 HitTestResult tempResult(result.hitTestLocation()); |
| 1427 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestDescendants) | 1411 if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, H itTestDescendants) |
| 1428 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) { | 1412 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra nsformState.get())) { |
| 1429 if (result.isRectBasedTest()) | 1413 if (result.isRectBasedTest()) |
| 1430 result.append(tempResult); | 1414 result.append(tempResult); |
| 1431 else | 1415 else |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1847 } | 1831 } |
| 1848 } | 1832 } |
| 1849 | 1833 |
| 1850 void showLayerTree(const blink::RenderObject* renderer) | 1834 void showLayerTree(const blink::RenderObject* renderer) |
| 1851 { | 1835 { |
| 1852 if (!renderer) | 1836 if (!renderer) |
| 1853 return; | 1837 return; |
| 1854 showLayerTree(renderer->enclosingLayer()); | 1838 showLayerTree(renderer->enclosingLayer()); |
| 1855 } | 1839 } |
| 1856 #endif | 1840 #endif |
| OLD | NEW |