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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2743733004: Revert of Reduce copying of local data structures in GeometryMapper and PaintLayerClipper. (Closed)
Patch Set: Created 3 years, 9 months 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 | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp » ('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) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // behave as if it lives in an unclipped universe so it can prepaint, etc. 548 // behave as if it lives in an unclipped universe so it can prepaint, etc.
549 // This means that we need to check if we are actually clipped before 549 // This means that we need to check if we are actually clipped before
550 // setting up m_ancestorClippingLayer otherwise 550 // setting up m_ancestorClippingLayer otherwise
551 // updateAncestorClippingLayerGeometry will fail as the clip rect will be 551 // updateAncestorClippingLayerGeometry will fail as the clip rect will be
552 // infinite. 552 // infinite.
553 // FIXME: this should use cached clip rects, but this sometimes give 553 // FIXME: this should use cached clip rects, but this sometimes give
554 // inaccurate results (and trips the ASSERTS in PaintLayerClipper). 554 // inaccurate results (and trips the ASSERTS in PaintLayerClipper).
555 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, 555 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects,
556 IgnoreOverlayScrollbarSize); 556 IgnoreOverlayScrollbarSize);
557 clipRectsContext.setIgnoreOverflowClip(); 557 clipRectsContext.setIgnoreOverflowClip();
558 558 LayoutRect unsnappedParentClipRect =
559 ClipRect clipRect; 559 m_owningLayer.clipper(PaintLayer::DoNotUseGeometryMapper)
560 m_owningLayer.clipper(PaintLayer::DoNotUseGeometryMapper) 560 .backgroundClipRect(clipRectsContext)
561 .calculateBackgroundClipRect(clipRectsContext, clipRect); 561 .rect();
562 IntRect parentClipRect = pixelSnappedIntRect(clipRect.rect()); 562 IntRect parentClipRect = pixelSnappedIntRect(unsnappedParentClipRect);
563 owningLayerIsClipped = parentClipRect != LayoutRect::infiniteIntRect(); 563 owningLayerIsClipped = parentClipRect != LayoutRect::infiniteIntRect();
564 564
565 // TODO(schenney): CSS clips are not applied to composited children, and 565 // TODO(schenney): CSS clips are not applied to composited children, and
566 // should be via mask or by compositing the parent too. 566 // should be via mask or by compositing the parent too.
567 // https://bugs.chromium.org/p/chromium/issues/detail?id=615870 567 // https://bugs.chromium.org/p/chromium/issues/detail?id=615870
568 DCHECK(clippingContainer->style()); 568 DCHECK(clippingContainer->style());
569 owningLayerIsMasked = 569 owningLayerIsMasked =
570 owningLayerIsClipped && clippingContainer->style()->hasBorderRadius() && 570 owningLayerIsClipped && clippingContainer->style()->hasBorderRadius() &&
571 !ancestorRoundedCornersWontClip(layoutObject(), *clippingContainer); 571 !ancestorRoundedCornersWontClip(layoutObject(), *clippingContainer);
572 } 572 }
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 void CompositedLayerMapping::updateAncestorClippingLayerGeometry( 1145 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(
1146 const PaintLayer* compositingContainer, 1146 const PaintLayer* compositingContainer,
1147 const IntPoint& snappedOffsetFromCompositedAncestor, 1147 const IntPoint& snappedOffsetFromCompositedAncestor,
1148 IntPoint& graphicsLayerParentLocation) { 1148 IntPoint& graphicsLayerParentLocation) {
1149 if (!compositingContainer || !m_ancestorClippingLayer) 1149 if (!compositingContainer || !m_ancestorClippingLayer)
1150 return; 1150 return;
1151 1151
1152 ClipRectsContext clipRectsContext(compositingContainer, 1152 ClipRectsContext clipRectsContext(compositingContainer,
1153 PaintingClipRectsIgnoringOverflowClip, 1153 PaintingClipRectsIgnoringOverflowClip,
1154 IgnoreOverlayScrollbarSize); 1154 IgnoreOverlayScrollbarSize);
1155 1155 IntRect parentClipRect = pixelSnappedIntRect(
1156 ClipRect parentClipRect; 1156 m_owningLayer.clipper(PaintLayer::DoNotUseGeometryMapper)
1157 m_owningLayer.clipper(PaintLayer::DoNotUseGeometryMapper) 1157 .backgroundClipRect(clipRectsContext)
1158 .calculateBackgroundClipRect(clipRectsContext, parentClipRect); 1158 .rect());
1159 1159 ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
1160 IntRect snappedParentClipRect(pixelSnappedIntRect(parentClipRect.rect())); 1160 m_ancestorClippingLayer->setPosition(
1161 1161 FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
1162 DCHECK(snappedParentClipRect != LayoutRect::infiniteIntRect()); 1162 m_ancestorClippingLayer->setSize(FloatSize(parentClipRect.size()));
1163 m_ancestorClippingLayer->setPosition(FloatPoint(
1164 snappedParentClipRect.location() - graphicsLayerParentLocation));
1165 m_ancestorClippingLayer->setSize(FloatSize(snappedParentClipRect.size()));
1166 1163
1167 // backgroundRect is relative to compositingContainer, so subtract 1164 // backgroundRect is relative to compositingContainer, so subtract
1168 // snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y 1165 // snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y
1169 // to get back to local coords. 1166 // to get back to local coords.
1170 m_ancestorClippingLayer->setOffsetFromLayoutObject( 1167 m_ancestorClippingLayer->setOffsetFromLayoutObject(
1171 snappedParentClipRect.location() - snappedOffsetFromCompositedAncestor); 1168 parentClipRect.location() - snappedOffsetFromCompositedAncestor);
1172 1169
1173 if (m_ancestorClippingMaskLayer) { 1170 if (m_ancestorClippingMaskLayer) {
1174 m_ancestorClippingMaskLayer->setOffsetFromLayoutObject( 1171 m_ancestorClippingMaskLayer->setOffsetFromLayoutObject(
1175 m_ancestorClippingLayer->offsetFromLayoutObject()); 1172 m_ancestorClippingLayer->offsetFromLayoutObject());
1176 m_ancestorClippingMaskLayer->setSize(m_ancestorClippingLayer->size()); 1173 m_ancestorClippingMaskLayer->setSize(m_ancestorClippingLayer->size());
1177 m_ancestorClippingMaskLayer->setNeedsDisplay(); 1174 m_ancestorClippingMaskLayer->setNeedsDisplay();
1178 } 1175 }
1179 1176
1180 // The primary layer is then parented in, and positioned relative to this 1177 // The primary layer is then parented in, and positioned relative to this
1181 // clipping layer. 1178 // clipping layer.
1182 graphicsLayerParentLocation = snappedParentClipRect.location(); 1179 graphicsLayerParentLocation = parentClipRect.location();
1183 } 1180 }
1184 1181
1185 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( 1182 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(
1186 const PaintLayer* compositingStackingContext, 1183 const PaintLayer* compositingStackingContext,
1187 const PaintLayer* compositingContainer, 1184 const PaintLayer* compositingContainer,
1188 IntPoint graphicsLayerParentLocation) { 1185 IntPoint graphicsLayerParentLocation) {
1189 if (!m_overflowControlsHostLayer) 1186 if (!m_overflowControlsHostLayer)
1190 return; 1187 return;
1191 1188
1192 // To position and clip the scrollbars correctly, m_overflowControlsHostLayer 1189 // To position and clip the scrollbars correctly, m_overflowControlsHostLayer
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2872 containingSquashedLayer(clippingContainer, layers, layers.size()); 2869 containingSquashedLayer(clippingContainer, layers, layers.size());
2873 // Must be there, otherwise 2870 // Must be there, otherwise
2874 // CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner would have 2871 // CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner would have
2875 // disallowed squashing. 2872 // disallowed squashing.
2876 ASSERT(ancestorPaintInfo); 2873 ASSERT(ancestorPaintInfo);
2877 2874
2878 // FIXME: this is a potential performance issue. We should consider caching 2875 // FIXME: this is a potential performance issue. We should consider caching
2879 // these clip rects or otherwise optimizing. 2876 // these clip rects or otherwise optimizing.
2880 ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer, 2877 ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer,
2881 UncachedClipRects); 2878 UncachedClipRects);
2882 ClipRect parentClipRect; 2879 IntRect parentClipRect = pixelSnappedIntRect(
2883 paintInfo.paintLayer->clipper(PaintLayer::DoNotUseGeometryMapper) 2880 paintInfo.paintLayer->clipper(PaintLayer::DoNotUseGeometryMapper)
2884 .calculateBackgroundClipRect(clipRectsContext, parentClipRect); 2881 .backgroundClipRect(clipRectsContext)
2885 2882 .rect());
2886 IntRect snappedParentClipRect(pixelSnappedIntRect(parentClipRect.rect())); 2883 ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
2887 DCHECK(snappedParentClipRect != LayoutRect::infiniteIntRect());
2888 2884
2889 // Convert from ancestor to local coordinates. 2885 // Convert from ancestor to local coordinates.
2890 IntSize ancestorToLocalOffset = paintInfo.offsetFromLayoutObject - 2886 IntSize ancestorToLocalOffset = paintInfo.offsetFromLayoutObject -
2891 ancestorPaintInfo->offsetFromLayoutObject; 2887 ancestorPaintInfo->offsetFromLayoutObject;
2892 snappedParentClipRect.move(ancestorToLocalOffset); 2888 parentClipRect.move(ancestorToLocalOffset);
2893 return snappedParentClipRect; 2889 return parentClipRect;
2894 } 2890 }
2895 2891
2896 void CompositedLayerMapping::doPaintTask( 2892 void CompositedLayerMapping::doPaintTask(
2897 const GraphicsLayerPaintInfo& paintInfo, 2893 const GraphicsLayerPaintInfo& paintInfo,
2898 const GraphicsLayer& graphicsLayer, 2894 const GraphicsLayer& graphicsLayer,
2899 const PaintLayerFlags& paintLayerFlags, 2895 const PaintLayerFlags& paintLayerFlags,
2900 GraphicsContext& context, 2896 GraphicsContext& context,
2901 const IntRect& clip /* In the coords of rootLayer */) const { 2897 const IntRect& clip /* In the coords of rootLayer */) const {
2902 FontCachePurgePreventer fontCachePurgePreventer; 2898 FontCachePurgePreventer fontCachePurgePreventer;
2903 2899
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3488 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3493 name = "Decoration Layer"; 3489 name = "Decoration Layer";
3494 } else { 3490 } else {
3495 ASSERT_NOT_REACHED(); 3491 ASSERT_NOT_REACHED();
3496 } 3492 }
3497 3493
3498 return name; 3494 return name;
3499 } 3495 }
3500 3496
3501 } // namespace blink 3497 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698