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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 20723003: Fix pixel snapping issues when layers become composited (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 3610
3611 if (localPaintFlags & PaintLayerPaintingRootBackgroundOnly && !renderer()->i sRenderView() && !renderer()->isRoot()) 3611 if (localPaintFlags & PaintLayerPaintingRootBackgroundOnly && !renderer()->i sRenderView() && !renderer()->isRoot())
3612 return; 3612 return;
3613 3613
3614 // Ensure our lists are up-to-date. 3614 // Ensure our lists are up-to-date.
3615 updateLayerListsIfNeeded(); 3615 updateLayerListsIfNeeded();
3616 3616
3617 LayoutPoint offsetFromRoot; 3617 LayoutPoint offsetFromRoot;
3618 convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); 3618 convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
3619 3619
3620 IntRect rootRelativeBounds; 3620 LayoutRect rootRelativeBounds;
3621 bool rootRelativeBoundsComputed = false; 3621 bool rootRelativeBoundsComputed = false;
3622 3622
3623 // Apply clip-path to context. 3623 // Apply clip-path to context.
3624 bool hasClipPath = false; 3624 bool hasClipPath = false;
3625 RenderStyle* style = renderer()->style(); 3625 RenderStyle* style = renderer()->style();
3626 if (renderer()->hasClipPath() && !context->paintingDisabled() && style) { 3626 if (renderer()->hasClipPath() && !context->paintingDisabled() && style) {
3627 ASSERT(style->clipPath()); 3627 ASSERT(style->clipPath());
3628 if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) { 3628 if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) {
3629 hasClipPath = true; 3629 hasClipPath = true;
3630 context->save(); 3630 context->save();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
3711 paintBehavior |= PaintBehaviorSkipRootBackground; 3711 paintBehavior |= PaintBehaviorSkipRootBackground;
3712 else if (localPaintFlags & PaintLayerPaintingRootBackgroundOnly) 3712 else if (localPaintFlags & PaintLayerPaintingRootBackgroundOnly)
3713 paintBehavior |= PaintBehaviorRootBackgroundOnly; 3713 paintBehavior |= PaintBehaviorRootBackgroundOnly;
3714 3714
3715 LayerFragments layerFragments; 3715 LayerFragments layerFragments;
3716 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 3716 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
3717 // 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 3717 // 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
3718 // fragment should paint. 3718 // fragment should paint.
3719 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.region, localPaintingInfo.paintDirtyRect, 3719 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.region, localPaintingInfo.paintDirtyRect,
3720 (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRect s : PaintingClipRects, IgnoreOverlayScrollbarSize, 3720 (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRect s : PaintingClipRects, IgnoreOverlayScrollbarSize,
3721 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC lip, &offsetFromRoot); 3721 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC lip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
3722 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localP aintFlags, shouldPaintContent, &offsetFromRoot); 3722 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localP aintFlags, shouldPaintContent, &offsetFromRoot);
3723 } 3723 }
3724 3724
3725 if (isPaintingCompositedBackground) { 3725 if (isPaintingCompositedBackground) {
3726 // Paint only the backgrounds for all of the fragments of the layer. 3726 // Paint only the backgrounds for all of the fragments of the layer.
3727 if (shouldPaintContent && !selectionOnly) 3727 if (shouldPaintContent && !selectionOnly)
3728 paintBackgroundForFragments(layerFragments, context, transparencyLay erContext, paintingInfo.paintDirtyRect, haveTransparency, 3728 paintBackgroundForFragments(layerFragments, context, transparencyLay erContext, paintingInfo.paintDirtyRect, haveTransparency,
3729 localPaintingInfo, paintBehavior, paintingRootForRenderer); 3729 localPaintingInfo, paintBehavior, paintingRootForRenderer);
3730 } 3730 }
3731 3731
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 RenderLayer* childLayer = list->at(i); 3819 RenderLayer* childLayer = list->at(i);
3820 if (!childLayer->isPaginated()) 3820 if (!childLayer->isPaginated())
3821 childLayer->paintLayer(context, paintingInfo, paintFlags); 3821 childLayer->paintLayer(context, paintingInfo, paintFlags);
3822 else 3822 else
3823 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs); 3823 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs);
3824 } 3824 }
3825 } 3825 }
3826 3826
3827 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, 3827 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect,
3828 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint * offsetFromRoot, 3828 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint * offsetFromRoot,
3829 const LayoutRect* layerBoundingBox) 3829 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
3830 { 3830 {
3831 if (!enclosingPaginationLayer() || hasTransform()) { 3831 if (!enclosingPaginationLayer() || hasTransform()) {
3832 // For unpaginated layers, there is only one fragment. 3832 // For unpaginated layers, there is only one fragment.
3833 LayerFragment fragment; 3833 LayerFragment fragment;
3834 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv erlayScrollbarSizeRelevancy, respectOverflowClip); 3834 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv erlayScrollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation);
3835 calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragme nt.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot ); 3835 calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragme nt.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot );
3836 fragments.append(fragment); 3836 fragments.append(fragment);
3837 return; 3837 return;
3838 } 3838 }
3839 3839
3840 // Compute our offset within the enclosing pagination layer. 3840 // Compute our offset within the enclosing pagination layer.
3841 LayoutPoint offsetWithinPaginatedLayer; 3841 LayoutPoint offsetWithinPaginatedLayer;
3842 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ; 3842 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ;
3843 3843
3844 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate 3844 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3910 } 3910 }
3911 } 3911 }
3912 3912
3913 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 3913 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
3914 { 3914 {
3915 LayerFragments enclosingPaginationFragments; 3915 LayerFragments enclosingPaginationFragments;
3916 LayoutPoint offsetOfPaginationLayerFromRoot; 3916 LayoutPoint offsetOfPaginationLayerFromRoot;
3917 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa intBehavior); 3917 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa intBehavior);
3918 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p aintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect, 3918 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p aintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect,
3919 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint ingClipRects, IgnoreOverlayScrollbarSize, 3919 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint ingClipRects, IgnoreOverlayScrollbarSize,
3920 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent); 3920 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc umulation, &transformedExtent);
3921 3921
3922 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { 3922 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) {
3923 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 3923 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
3924 3924
3925 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 3925 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
3926 // the enclosing pagination layer. 3926 // the enclosing pagination layer.
3927 LayoutRect clipRect = fragment.backgroundRect.rect(); 3927 LayoutRect clipRect = fragment.backgroundRect.rect();
3928 3928
3929 // Now compute the clips within a given fragment 3929 // Now compute the clips within a given fragment
3930 if (parent() != enclosingPaginationLayer()) { 3930 if (parent() != enclosingPaginationLayer()) {
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
4543 return false; 4543 return false;
4544 } 4544 }
4545 4545
4546 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, 4546 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
4547 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) 4547 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset)
4548 { 4548 {
4549 LayerFragments enclosingPaginationFragments; 4549 LayerFragments enclosingPaginationFragments;
4550 LayoutPoint offsetOfPaginationLayerFromRoot; 4550 LayoutPoint offsetOfPaginationLayerFromRoot;
4551 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox); 4551 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
4552 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestLocation.region(), hitTestRect, 4552 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestLocation.region(), hitTestRect,
4553 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent); 4553 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
4554 4554
4555 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { 4555 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
4556 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 4556 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
4557 4557
4558 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 4558 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
4559 // the enclosing pagination layer. 4559 // the enclosing pagination layer.
4560 LayoutRect clipRect = fragment.backgroundRect.rect(); 4560 LayoutRect clipRect = fragment.backgroundRect.rect();
4561 4561
4562 // Now compute the clips within a given fragment 4562 // Now compute the clips within a given fragment
4563 if (parent() != enclosingPaginationLayer()) { 4563 if (parent() != enclosingPaginationLayer()) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4975 if (offsetFromRoot) 4975 if (offsetFromRoot)
4976 offset = *offsetFromRoot; 4976 offset = *offsetFromRoot;
4977 else 4977 else
4978 convertToLayerCoords(clipRectsContext.rootLayer, offset); 4978 convertToLayerCoords(clipRectsContext.rootLayer, offset);
4979 layerBounds = LayoutRect(offset, size()); 4979 layerBounds = LayoutRect(offset, size());
4980 4980
4981 // Update the clip rects that will be passed to child layers. 4981 // Update the clip rects that will be passed to child layers.
4982 if (renderer()->hasOverflowClip()) { 4982 if (renderer()->hasOverflowClip()) {
4983 // This layer establishes a clip of some kind. 4983 // This layer establishes a clip of some kind.
4984 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverfl owClip == RespectOverflowClip) { 4984 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverfl owClip == RespectOverflowClip) {
4985 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(o ffset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy)) ; 4985 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(o ffset + clipRectsContext.subPixelAccumulation, clipRectsContext.region, clipRect sContext.overlayScrollbarSizeRelevancy));
4986 if (renderer()->style()->hasBorderRadius()) 4986 if (renderer()->style()->hasBorderRadius())
4987 foregroundRect.setHasRadius(true); 4987 foregroundRect.setHasRadius(true);
4988 } 4988 }
4989 4989
4990 // If we establish an overflow clip at all, then go ahead and make sure our background 4990 // If we establish an overflow clip at all, then go ahead and make sure our background
4991 // rect is intersected with our layer's bounds including our visual over flow, 4991 // rect is intersected with our layer's bounds including our visual over flow,
4992 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden. 4992 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden.
4993 if (renderBox()->hasVisualOverflow()) { 4993 if (renderBox()->hasVisualOverflow()) {
4994 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though 4994 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though
4995 // we may need to inflate our clip specifically for shadows o r outsets. 4995 // we may need to inflate our clip specifically for shadows o r outsets.
4996 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the 4996 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
4997 // individual region boxes as overflow. 4997 // individual region boxes as overflow.
4998 LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverfl owRect(); 4998 LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverfl owRect();
4999 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // L ayers are in physical coordinates, so the overflow has to be flipped. 4999 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // L ayers are in physical coordinates, so the overflow has to be flipped.
5000 layerBoundsWithVisualOverflow.moveBy(offset); 5000 layerBoundsWithVisualOverflow.moveBy(offset + clipRectsContext.subPi xelAccumulation);
5001 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip) 5001 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip)
5002 backgroundRect.intersect(layerBoundsWithVisualOverflow); 5002 backgroundRect.intersect(layerBoundsWithVisualOverflow);
5003 } else { 5003 } else {
5004 // Shift the bounds to be for our region only. 5004 // Shift the bounds to be for our region only.
5005 LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsCont ext.region); 5005 LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsCont ext.region);
5006 bounds.moveBy(offset); 5006 bounds.moveBy(offset + clipRectsContext.subPixelAccumulation);
5007 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip) 5007 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip)
5008 backgroundRect.intersect(bounds); 5008 backgroundRect.intersect(bounds);
5009 } 5009 }
5010 } 5010 }
5011 5011
5012 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. 5012 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box.
5013 if (renderer()->hasClip()) { 5013 if (renderer()->hasClip()) {
5014 // Clip applies to *us* as well, so go ahead and update the damageRect. 5014 // Clip applies to *us* as well, so go ahead and update the damageRect.
5015 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, clipRe ctsContext.region); 5015 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset + clipR ectsContext.subPixelAccumulation, clipRectsContext.region);
5016 backgroundRect.intersect(newPosClip); 5016 backgroundRect.intersect(newPosClip);
5017 foregroundRect.intersect(newPosClip); 5017 foregroundRect.intersect(newPosClip);
5018 outlineRect.intersect(newPosClip); 5018 outlineRect.intersect(newPosClip);
5019 } 5019 }
5020 } 5020 }
5021 5021
5022 LayoutRect RenderLayer::childrenClipRect() const 5022 LayoutRect RenderLayer::childrenClipRect() const
5023 { 5023 {
5024 // FIXME: border-radius not accounted for. 5024 // FIXME: border-radius not accounted for.
5025 // FIXME: Regions not accounted for. 5025 // FIXME: Regions not accounted for.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5204 5204
5205 result.moveBy(delta); 5205 result.moveBy(delta);
5206 return result; 5206 return result;
5207 } 5207 }
5208 5208
5209 IntRect RenderLayer::absoluteBoundingBox() const 5209 IntRect RenderLayer::absoluteBoundingBox() const
5210 { 5210 {
5211 return pixelSnappedIntRect(boundingBox(root())); 5211 return pixelSnappedIntRect(boundingBox(root()));
5212 } 5212 }
5213 5213
5214 IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons t LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const 5214 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c onst LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
5215 { 5215 {
5216 if (!isSelfPaintingLayer()) 5216 if (!isSelfPaintingLayer())
5217 return IntRect(); 5217 return LayoutRect();
5218 5218
5219 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580). 5219 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580).
5220 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant()) 5220 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant())
5221 return IntRect(); 5221 return LayoutRect();
5222 5222
5223 RenderLayerModelObject* renderer = this->renderer(); 5223 RenderLayerModelObject* renderer = this->renderer();
5224 5224
5225 if (isRootLayer()) { 5225 if (isRootLayer()) {
5226 // The root layer is always just the size of the document. 5226 // The root layer is always just the size of the document.
5227 return renderer->view()->unscaledDocumentRect(); 5227 return renderer->view()->unscaledDocumentRect();
5228 } 5228 }
5229 5229
5230 LayoutRect boundingBoxRect = localBoundingBox(flags); 5230 LayoutRect boundingBoxRect = localBoundingBox(flags);
5231 5231
(...skipping 19 matching lines...) Expand all
5251 5251
5252 if (flags & UseLocalClipRectIfPossible) { 5252 if (flags & UseLocalClipRectIfPossible) {
5253 LayoutRect localClipRect = this->localClipRect(); 5253 LayoutRect localClipRect = this->localClipRect();
5254 if (localClipRect != PaintInfo::infiniteRect()) { 5254 if (localClipRect != PaintInfo::infiniteRect()) {
5255 if ((flags & IncludeSelfTransform) && paintsWithTransform(PaintBehav iorNormal)) 5255 if ((flags & IncludeSelfTransform) && paintsWithTransform(PaintBehav iorNormal))
5256 localClipRect = transform()->mapRect(localClipRect); 5256 localClipRect = transform()->mapRect(localClipRect);
5257 5257
5258 LayoutPoint ancestorRelOffset; 5258 LayoutPoint ancestorRelOffset;
5259 convertToLayerCoords(ancestorLayer, ancestorRelOffset); 5259 convertToLayerCoords(ancestorLayer, ancestorRelOffset);
5260 localClipRect.moveBy(ancestorRelOffset); 5260 localClipRect.moveBy(ancestorRelOffset);
5261 return pixelSnappedIntRect(localClipRect); 5261 return localClipRect;
5262 } 5262 }
5263 } 5263 }
5264 5264
5265 // FIXME: should probably just pass 'flags' down to descendants. 5265 // FIXME: should probably just pass 'flags' down to descendants.
5266 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); 5266 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants);
5267 5267
5268 const_cast<RenderLayer*>(this)->updateLayerListsIfNeeded(); 5268 const_cast<RenderLayer*>(this)->updateLayerListsIfNeeded();
5269 5269
5270 if (RenderLayer* reflection = reflectionLayer()) { 5270 if (RenderLayer* reflection = reflectionLayer()) {
5271 if (!reflection->isComposited()) { 5271 if (!reflection->isComposited()) {
5272 IntRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags); 5272 LayoutRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags);
5273 unionBounds.unite(childUnionBounds); 5273 unionBounds.unite(childUnionBounds);
5274 } 5274 }
5275 } 5275 }
5276 5276
5277 ASSERT(isStackingContainer() || (!posZOrderList() || !posZOrderList()->size( ))); 5277 ASSERT(isStackingContainer() || (!posZOrderList() || !posZOrderList()->size( )));
5278 5278
5279 #if !ASSERT_DISABLED 5279 #if !ASSERT_DISABLED
5280 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)); 5280 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this));
5281 #endif 5281 #endif
5282 5282
5283 if (Vector<RenderLayer*>* negZOrderList = this->negZOrderList()) { 5283 if (Vector<RenderLayer*>* negZOrderList = this->negZOrderList()) {
5284 size_t listSize = negZOrderList->size(); 5284 size_t listSize = negZOrderList->size();
5285 for (size_t i = 0; i < listSize; ++i) { 5285 for (size_t i = 0; i < listSize; ++i) {
5286 RenderLayer* curLayer = negZOrderList->at(i); 5286 RenderLayer* curLayer = negZOrderList->at(i);
5287 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) { 5287 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) {
5288 IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); 5288 LayoutRect childUnionBounds = curLayer->calculateLayerBounds(thi s, 0, descendantFlags);
5289 unionBounds.unite(childUnionBounds); 5289 unionBounds.unite(childUnionBounds);
5290 } 5290 }
5291 } 5291 }
5292 } 5292 }
5293 5293
5294 if (Vector<RenderLayer*>* posZOrderList = this->posZOrderList()) { 5294 if (Vector<RenderLayer*>* posZOrderList = this->posZOrderList()) {
5295 size_t listSize = posZOrderList->size(); 5295 size_t listSize = posZOrderList->size();
5296 for (size_t i = 0; i < listSize; ++i) { 5296 for (size_t i = 0; i < listSize; ++i) {
5297 RenderLayer* curLayer = posZOrderList->at(i); 5297 RenderLayer* curLayer = posZOrderList->at(i);
5298 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) { 5298 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) {
5299 IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); 5299 LayoutRect childUnionBounds = curLayer->calculateLayerBounds(thi s, 0, descendantFlags);
5300 unionBounds.unite(childUnionBounds); 5300 unionBounds.unite(childUnionBounds);
5301 } 5301 }
5302 } 5302 }
5303 } 5303 }
5304 5304
5305 if (Vector<RenderLayer*>* normalFlowList = this->normalFlowList()) { 5305 if (Vector<RenderLayer*>* normalFlowList = this->normalFlowList()) {
5306 size_t listSize = normalFlowList->size(); 5306 size_t listSize = normalFlowList->size();
5307 for (size_t i = 0; i < listSize; ++i) { 5307 for (size_t i = 0; i < listSize; ++i) {
5308 RenderLayer* curLayer = normalFlowList->at(i); 5308 RenderLayer* curLayer = normalFlowList->at(i);
5309 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) { 5309 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) {
5310 IntRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, d escendantFlags); 5310 LayoutRect curAbsBounds = curLayer->calculateLayerBounds(this, 0 , descendantFlags);
5311 unionBounds.unite(curAbsBounds); 5311 unionBounds.unite(curAbsBounds);
5312 } 5312 }
5313 } 5313 }
5314 } 5314 }
5315 5315
5316 // FIXME: We can optimize the size of the composited layers, by not enlargin g 5316 // FIXME: We can optimize the size of the composited layers, by not enlargin g
5317 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. 5317 // filtered areas with the outsets if we know that the filter is going to re nder in hardware.
5318 // https://bugs.webkit.org/show_bug.cgi?id=81239 5318 // https://bugs.webkit.org/show_bug.cgi?id=81239
5319 if (flags & IncludeLayerFilterOutsets) 5319 if (flags & IncludeLayerFilterOutsets)
5320 renderer->style()->filterOutsets().expandRect(unionBounds); 5320 renderer->style()->filterOutsets().expandRect(unionBounds);
5321 5321
5322 if ((flags & IncludeSelfTransform) && paintsWithTransform(PaintBehaviorNorma l)) { 5322 if ((flags & IncludeSelfTransform) && paintsWithTransform(PaintBehaviorNorma l)) {
5323 TransformationMatrix* affineTrans = transform(); 5323 TransformationMatrix* affineTrans = transform();
5324 boundingBoxRect = affineTrans->mapRect(boundingBoxRect); 5324 boundingBoxRect = affineTrans->mapRect(boundingBoxRect);
5325 unionBounds = affineTrans->mapRect(unionBounds); 5325 unionBounds = affineTrans->mapRect(unionBounds);
5326 } 5326 }
5327 5327
5328 LayoutPoint ancestorRelOffset; 5328 LayoutPoint ancestorRelOffset;
5329 if (offsetFromRoot) 5329 if (offsetFromRoot)
5330 ancestorRelOffset = *offsetFromRoot; 5330 ancestorRelOffset = *offsetFromRoot;
5331 else 5331 else
5332 convertToLayerCoords(ancestorLayer, ancestorRelOffset); 5332 convertToLayerCoords(ancestorLayer, ancestorRelOffset);
5333 unionBounds.moveBy(ancestorRelOffset); 5333 unionBounds.moveBy(ancestorRelOffset);
5334 5334
5335 return pixelSnappedIntRect(unionBounds); 5335 return unionBounds;
5336 } 5336 }
5337 5337
5338 void RenderLayer::clearClipRectsIncludingDescendants(ClipRectsType typeToClear) 5338 void RenderLayer::clearClipRectsIncludingDescendants(ClipRectsType typeToClear)
5339 { 5339 {
5340 // FIXME: it's not clear how this layer not having clip rects guarantees tha t no descendants have any. 5340 // FIXME: it's not clear how this layer not having clip rects guarantees tha t no descendants have any.
5341 if (!m_clipRectsCache) 5341 if (!m_clipRectsCache)
5342 return; 5342 return;
5343 5343
5344 clearClipRects(typeToClear); 5344 clearClipRects(typeToClear);
5345 5345
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
6380 } 6380 }
6381 } 6381 }
6382 6382
6383 void showLayerTree(const WebCore::RenderObject* renderer) 6383 void showLayerTree(const WebCore::RenderObject* renderer)
6384 { 6384 {
6385 if (!renderer) 6385 if (!renderer)
6386 return; 6386 return;
6387 showLayerTree(renderer->enclosingLayer()); 6387 showLayerTree(renderer->enclosingLayer());
6388 } 6388 }
6389 #endif 6389 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698