Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: sky/engine/core/rendering/RenderLayer.cpp

Issue 778753002: Remove PaintLayerPaintingOverflowContents. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | sky/engine/core/rendering/RenderLayerClipper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 { 939 {
940 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. 940 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC.
941 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document 941 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
942 // will do a full paintInvalidationForWholeRenderer(). 942 // will do a full paintInvalidationForWholeRenderer().
943 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye r->isRootLayer() && !layer->renderer()->isDocumentElement()) 943 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye r->isRootLayer() && !layer->renderer()->isDocumentElement())
944 return true; 944 return true;
945 945
946 return false; 946 return false;
947 } 947 }
948 948
949 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const RenderObject* renderer)
950 {
951 return (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowCli p : RespectOverflowClip;
952 }
953
954 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 949 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
955 { 950 {
956 // Non self-painting leaf layers don't need to be painted as their renderer( ) should properly paint itself. 951 // Non self-painting leaf layers don't need to be painted as their renderer( ) should properly paint itself.
957 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) 952 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
958 return; 953 return;
959 954
960 if (shouldSuppressPaintingLayer(this)) 955 if (shouldSuppressPaintingLayer(this))
961 return; 956 return;
962 957
963 // If this layer is totally invisible then there is nothing to paint. 958 // If this layer is totally invisible then there is nothing to paint.
(...skipping 15 matching lines...) Expand all
979 if (parent()) 974 if (parent())
980 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo. paintBehavior); 975 parent()->beginTransparencyLayers(context, paintingInfo.rootLaye r, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo. paintBehavior);
981 else 976 else
982 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav ior); 977 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav ior);
983 } 978 }
984 979
985 // Make sure the parent's clip rects have been calculated. 980 // Make sure the parent's clip rects have been calculated.
986 ClipRect clipRect = paintingInfo.paintDirtyRect; 981 ClipRect clipRect = paintingInfo.paintDirtyRect;
987 if (parent()) { 982 if (parent()) {
988 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects); 983 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects);
989 if (shouldRespectOverflowClip(paintFlags, renderer()) == IgnoreOverf lowClip)
990 clipRectsContext.setIgnoreOverflowClip();
991 clipRect = clipper().backgroundClipRect(clipRectsContext); 984 clipRect = clipper().backgroundClipRect(clipRectsContext);
992 clipRect.intersect(paintingInfo.paintDirtyRect); 985 clipRect.intersect(paintingInfo.paintDirtyRect);
993 986
994 // Push the parent coordinate space's clip. 987 // Push the parent coordinate space's clip.
995 parent()->clipToRect(paintingInfo, context, clipRect, paintFlags); 988 parent()->clipToRect(paintingInfo, context, clipRect, paintFlags);
996 } 989 }
997 990
998 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); 991 paintLayerByApplyingTransform(context, paintingInfo, paintFlags);
999 992
1000 // Restore the clip. 993 // Restore the clip.
(...skipping 17 matching lines...) Expand all
1018 void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti ngInfo& paintingInfo, PaintLayerFlags paintFlags) 1011 void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti ngInfo& paintingInfo, PaintLayerFlags paintFlags)
1019 { 1012 {
1020 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); 1013 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
1021 1014
1022 bool haveTransparency = paintFlags & PaintLayerHaveTransparency; 1015 bool haveTransparency = paintFlags & PaintLayerHaveTransparency;
1023 bool isSelfPaintingLayer = this->isSelfPaintingLayer(); 1016 bool isSelfPaintingLayer = this->isSelfPaintingLayer();
1024 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; 1017 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars;
1025 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; 1018 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase;
1026 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; 1019 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase;
1027 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; 1020 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase;
1028 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents;
1029 // Outline always needs to be painted even if we have no visible content. Al so, 1021 // Outline always needs to be painted even if we have no visible content. Al so,
1030 // the outline is painted in the background phase during composited scrollin g. 1022 // the outline is painted in the background phase during composited scrollin g.
1031 // If it were painted in the foreground phase, it would move with the scroll ed 1023 // If it were painted in the foreground phase, it would move with the scroll ed
1032 // content. When not composited scrolling, the outline is painted in the 1024 // content. When not composited scrolling, the outline is painted in the
1033 // foreground phase. Since scrolled contents are moved by paint invalidation in this 1025 // foreground phase. Since scrolled contents are moved by paint invalidation in this
1034 // case, the outline won't get 'dragged along'. 1026 // case, the outline won't get 'dragged along'.
1035 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s 1027 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s
1036 && ((isPaintingScrollingContent && isPaintingCompositedBackground) 1028 && ((isPaintingScrollingContent && isPaintingCompositedBackground)
1037 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); 1029 || (!isPaintingScrollingContent && isPaintingCompositedForeground));
1038 bool shouldPaintContent = isSelfPaintingLayer && !isPaintingOverlayScrollbar s; 1030 bool shouldPaintContent = isSelfPaintingLayer && !isPaintingOverlayScrollbar s;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 LayerPaintingInfo localPaintingInfo(paintingInfo); 1070 LayerPaintingInfo localPaintingInfo(paintingInfo);
1079 bool deferredFiltersEnabled = renderer()->document().settings()->deferredFil tersEnabled(); 1071 bool deferredFiltersEnabled = renderer()->document().settings()->deferredFil tersEnabled();
1080 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs()); 1072 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs());
1081 1073
1082 LayerFragments layerFragments; 1074 LayerFragments layerFragments;
1083 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 1075 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
1084 // 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 1076 // 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
1085 // fragment should paint. 1077 // fragment should paint.
1086 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.paintDirtyRect, 1078 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.paintDirtyRect,
1087 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, 1079 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects,
1088 shouldRespectOverflowClip(paintFlags, renderer()), &offsetFromRoot, localPaintingInfo.subPixelAccumulation); 1080 &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
1089 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); 1081 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot);
1090 } 1082 }
1091 1083
1092 if (filterPainter.haveFilterEffect()) { 1084 if (filterPainter.haveFilterEffect()) {
1093 ASSERT(this->filterInfo()); 1085 ASSERT(this->filterInfo());
1094 1086
1095 if (!rootRelativeBoundsComputed) 1087 if (!rootRelativeBoundsComputed)
1096 rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStacki ngChildren(paintingInfo.rootLayer, offsetFromRoot); 1088 rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStacki ngChildren(paintingInfo.rootLayer, offsetFromRoot);
1097 1089
1098 if (filterPainter.prepareFilterEffect(this, rootRelativeBounds, painting Info.paintDirtyRect)) { 1090 if (filterPainter.prepareFilterEffect(this, rootRelativeBounds, painting Info.paintDirtyRect)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). 1132 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set).
1141 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along 1133 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along
1142 // so it will be tested against as we descend through the renderers. 1134 // so it will be tested against as we descend through the renderers.
1143 RenderObject* paintingRootForRenderer = 0; 1135 RenderObject* paintingRootForRenderer = 0;
1144 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot)) 1136 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot))
1145 paintingRootForRenderer = localPaintingInfo.paintingRoot; 1137 paintingRootForRenderer = localPaintingInfo.paintingRoot;
1146 1138
1147 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText)); 1139 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText));
1148 1140
1149 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintCo ntent; 1141 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintCo ntent;
1150 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOve rflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground ); 1142 bool shouldPaintNegZOrderList = !isPaintingScrollingContent && isPaintingCom positedBackground;
1151 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintC ontent; 1143 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintC ontent;
1152 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground ; 1144 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground ;
1153 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; 1145 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars;
1154 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer()->hasMask(); 1146 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer()->hasMask();
1155 1147
1156 // FIXME(sky): Get rid of PaintBehavior argument now that it's always Normal . 1148 // FIXME(sky): Get rid of PaintBehavior argument now that it's always Normal .
1157 PaintBehavior paintBehavior = PaintBehaviorNormal; 1149 PaintBehavior paintBehavior = PaintBehaviorNormal;
1158 1150
1159 if (shouldPaintBackground) { 1151 if (shouldPaintBackground) {
1160 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency, 1152 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 LayerListMutationDetector mutationChecker(m_stackingNode.get()); 1229 LayerListMutationDetector mutationChecker(m_stackingNode.get());
1238 #endif 1230 #endif
1239 1231
1240 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); 1232 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit);
1241 while (RenderLayerStackingNode* child = iterator.next()) { 1233 while (RenderLayerStackingNode* child = iterator.next()) {
1242 child->layer()->paintLayer(context, paintingInfo, paintFlags); 1234 child->layer()->paintLayer(context, paintingInfo, paintFlags);
1243 } 1235 }
1244 } 1236 }
1245 1237
1246 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect, 1238 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
1247 ClipRectsCacheSlot clipRectsCacheSlot, ShouldRespectOverflowClip respectOver flowClip, const LayoutPoint* offsetFromRoot, 1239 ClipRectsCacheSlot clipRectsCacheSlot, const LayoutPoint* offsetFromRoot,
1248 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) 1240 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
1249 { 1241 {
1250 // For unpaginated layers, there is only one fragment. 1242 // For unpaginated layers, there is only one fragment.
1251 LayerFragment fragment; 1243 LayerFragment fragment;
1252 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, subPixelAcc umulation); 1244 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, subPixelAcc umulation);
1253 if (respectOverflowClip == IgnoreOverflowClip)
1254 clipRectsContext.setIgnoreOverflowClip();
1255 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr omRoot); 1245 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr omRoot);
1256 fragments.append(fragment); 1246 fragments.append(fragment);
1257 } 1247 }
1258 1248
1259 void RenderLayer::updatePaintingInfoForFragments(LayerFragments& fragments, cons t LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, 1249 void RenderLayer::updatePaintingInfoForFragments(LayerFragments& fragments, cons t LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags,
1260 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) 1250 bool shouldPaintContent, const LayoutPoint* offsetFromRoot)
1261 { 1251 {
1262 ASSERT(offsetFromRoot); 1252 ASSERT(offsetFromRoot);
1263 for (size_t i = 0; i < fragments.size(); ++i) { 1253 for (size_t i = 0; i < fragments.size(); ++i) {
1264 LayerFragment& fragment = fragments.at(i); 1254 LayerFragment& fragment = fragments.at(i);
1265 fragment.shouldPaintContent = shouldPaintContent; 1255 LayoutPoint newOffsetFromRoot = *offsetFromRoot;
1266 if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLaye rPaintingOverflowContents)) { 1256 fragment.shouldPaintContent = shouldPaintContent && intersectsDamageRect (fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLay er, &newOffsetFromRoot);
1267 LayoutPoint newOffsetFromRoot = *offsetFromRoot;
1268 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBo unds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFro mRoot);
1269 }
1270 } 1257 }
1271 } 1258 }
1272 1259
1273 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 1260 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
1274 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 1261 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
1275 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 1262 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
1276 { 1263 {
1277 for (size_t i = 0; i < layerFragments.size(); ++i) { 1264 for (size_t i = 0; i < layerFragments.size(); ++i) {
1278 const LayerFragment& fragment = layerFragments.at(i); 1265 const LayerFragment& fragment = layerFragments.at(i);
1279 if (!fragment.shouldPaintContent) 1266 if (!fragment.shouldPaintContent)
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 } 2188 }
2202 } 2189 }
2203 2190
2204 void showLayerTree(const blink::RenderObject* renderer) 2191 void showLayerTree(const blink::RenderObject* renderer)
2205 { 2192 {
2206 if (!renderer) 2193 if (!renderer)
2207 return; 2194 return;
2208 showLayerTree(renderer->enclosingLayer()); 2195 showLayerTree(renderer->enclosingLayer());
2209 } 2196 }
2210 #endif 2197 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | sky/engine/core/rendering/RenderLayerClipper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698