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

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: Adding another failing test expectation Created 7 years, 1 month 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 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 2003
2004 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !renderer()->isRend erView() && !renderer()->isRoot()) 2004 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !renderer()->isRend erView() && !renderer()->isRoot())
2005 return; 2005 return;
2006 2006
2007 // Ensure our lists are up-to-date. 2007 // Ensure our lists are up-to-date.
2008 m_stackingNode->updateLayerListsIfNeeded(); 2008 m_stackingNode->updateLayerListsIfNeeded();
2009 2009
2010 LayoutPoint offsetFromRoot; 2010 LayoutPoint offsetFromRoot;
2011 convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); 2011 convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
2012 2012
2013 IntRect rootRelativeBounds; 2013 if (compositingState() == PaintsIntoOwnBacking)
2014 offsetFromRoot.move(m_compositedLayerMapping->subpixelAccumulation());
2015
2016 LayoutRect rootRelativeBounds;
2014 bool rootRelativeBoundsComputed = false; 2017 bool rootRelativeBoundsComputed = false;
2015 2018
2016 // Apply clip-path to context. 2019 // Apply clip-path to context.
2017 bool hasClipPath = false; 2020 bool hasClipPath = false;
2018 RenderStyle* style = renderer()->style(); 2021 RenderStyle* style = renderer()->style();
2019 RenderSVGResourceClipper* resourceClipper = 0; 2022 RenderSVGResourceClipper* resourceClipper = 0;
2020 ClipperContext clipperContext; 2023 ClipperContext clipperContext;
2021 if (renderer()->hasClipPath() && !context->paintingDisabled() && style) { 2024 if (renderer()->hasClipPath() && !context->paintingDisabled() && style) {
2022 ASSERT(style->clipPath()); 2025 ASSERT(style->clipPath());
2023 if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) { 2026 if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 paintBehavior |= PaintBehaviorSkipRootBackground; 2128 paintBehavior |= PaintBehaviorSkipRootBackground;
2126 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) 2129 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly)
2127 paintBehavior |= PaintBehaviorRootBackgroundOnly; 2130 paintBehavior |= PaintBehaviorRootBackgroundOnly;
2128 2131
2129 LayerFragments layerFragments; 2132 LayerFragments layerFragments;
2130 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 2133 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
2131 // 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 2134 // 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
2132 // fragment should paint. 2135 // fragment should paint.
2133 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.region, localPaintingInfo.paintDirtyRect, 2136 collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaint ingInfo.region, localPaintingInfo.paintDirtyRect,
2134 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : P aintingClipRects, IgnoreOverlayScrollbarSize, 2137 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : P aintingClipRects, IgnoreOverlayScrollbarSize,
2135 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC lip, &offsetFromRoot); 2138 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowC lip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
2136 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); 2139 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot);
2137 } 2140 }
2138 2141
2139 if (shouldPaintBackground) 2142 if (shouldPaintBackground)
2140 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency, 2143 paintBackgroundForFragments(layerFragments, context, transparencyLayerCo ntext, paintingInfo.paintDirtyRect, haveTransparency,
2141 localPaintingInfo, paintBehavior, paintingRootForRenderer); 2144 localPaintingInfo, paintBehavior, paintingRootForRenderer);
2142 2145
2143 if (shouldPaintNegZOrderList) 2146 if (shouldPaintNegZOrderList)
2144 paintList(m_stackingNode->negZOrderList(), context, localPaintingInfo, p aintFlags); 2147 paintList(m_stackingNode->negZOrderList(), context, localPaintingInfo, p aintFlags);
2145 2148
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 RenderLayer* childLayer = list->at(i)->layer(); 2233 RenderLayer* childLayer = list->at(i)->layer();
2231 if (!childLayer->isPaginated()) 2234 if (!childLayer->isPaginated())
2232 childLayer->paintLayer(context, paintingInfo, paintFlags); 2235 childLayer->paintLayer(context, paintingInfo, paintFlags);
2233 else 2236 else
2234 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs); 2237 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs);
2235 } 2238 }
2236 } 2239 }
2237 2240
2238 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect, 2241 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect,
2239 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint * offsetFromRoot, 2242 ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollba rSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint * offsetFromRoot,
2240 const LayoutRect* layerBoundingBox) 2243 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
2241 { 2244 {
2242 if (!enclosingPaginationLayer() || hasTransform()) { 2245 if (!enclosingPaginationLayer() || hasTransform()) {
2243 // For unpaginated layers, there is only one fragment. 2246 // For unpaginated layers, there is only one fragment.
2244 LayerFragment fragment; 2247 LayerFragment fragment;
2245 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv erlayScrollbarSizeRelevancy, respectOverflowClip); 2248 ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOv erlayScrollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation);
2246 calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragme nt.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot ); 2249 calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragme nt.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot );
2247 fragments.append(fragment); 2250 fragments.append(fragment);
2248 return; 2251 return;
2249 } 2252 }
2250 2253
2251 // Compute our offset within the enclosing pagination layer. 2254 // Compute our offset within the enclosing pagination layer.
2252 LayoutPoint offsetWithinPaginatedLayer; 2255 LayoutPoint offsetWithinPaginatedLayer;
2253 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ; 2256 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ;
2254 2257
2255 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate 2258 // 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
2321 } 2324 }
2322 } 2325 }
2323 2326
2324 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 2327 void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c onst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2325 { 2328 {
2326 LayerFragments enclosingPaginationFragments; 2329 LayerFragments enclosingPaginationFragments;
2327 LayoutPoint offsetOfPaginationLayerFromRoot; 2330 LayoutPoint offsetOfPaginationLayerFromRoot;
2328 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa intBehavior); 2331 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.pa intBehavior);
2329 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p aintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect, 2332 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, p aintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect,
2330 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint ingClipRects, IgnoreOverlayScrollbarSize, 2333 (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : Paint ingClipRects, IgnoreOverlayScrollbarSize,
2331 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent); 2334 (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAcc umulation, &transformedExtent);
2332 2335
2333 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { 2336 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) {
2334 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 2337 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
2335 2338
2336 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 2339 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
2337 // the enclosing pagination layer. 2340 // the enclosing pagination layer.
2338 LayoutRect clipRect = fragment.backgroundRect.rect(); 2341 LayoutRect clipRect = fragment.backgroundRect.rect();
2339 2342
2340 // Now compute the clips within a given fragment 2343 // Now compute the clips within a given fragment
2341 if (parent() != enclosingPaginationLayer()) { 2344 if (parent() != enclosingPaginationLayer()) {
2342 enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLa yer, offsetOfPaginationLayerFromRoot); 2345 enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLa yer, offsetOfPaginationLayerFromRoot);
2343 2346
2344 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), painti ngInfo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, 2347 ClipRectsContext clipRectsContext(enclosingPaginationLayer(), painti ngInfo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
2345 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver flowContents) ? IgnoreOverflowClip : RespectOverflowClip); 2348 IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOver flowContents) ? IgnoreOverflowClip : RespectOverflowClip);
2346 LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rec t(); 2349 LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rec t();
2347 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); 2350 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot);
2348 clipRect.intersect(parentClipRect); 2351 clipRect.intersect(parentClipRect);
2349 } 2352 }
2350 2353
2351 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.paint DirtyRect, clipRect); 2354 parent()->clipToRect(paintingInfo.rootLayer, context, paintingInfo.paint DirtyRect, clipRect);
2352 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); 2355 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset);
2353 parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect); 2356 parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
2354 } 2357 }
2355 } 2358 }
2356 2359
2360 static inline LayoutSize subPixelAccumulationIfNeeded(const LayoutSize& subPixel Accumulation, CompositingState compositingState)
2361 {
2362 // Only apply the sub-pixel accumulation if we don't paint into our own back ing layer, otherwise the position
2363 // of the renderer already includes any sub-pixel offset.
2364 if (compositingState == PaintsIntoOwnBacking)
2365 return LayoutSize();
2366 return subPixelAccumulation;
2367 }
2368
2357 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 2369 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
2358 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 2370 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
2359 RenderObject* paintingRootForRenderer) 2371 RenderObject* paintingRootForRenderer)
2360 { 2372 {
2361 for (size_t i = 0; i < layerFragments.size(); ++i) { 2373 for (size_t i = 0; i < layerFragments.size(); ++i) {
2362 const LayerFragment& fragment = layerFragments.at(i); 2374 const LayerFragment& fragment = layerFragments.at(i);
2363 if (!fragment.shouldPaintContent) 2375 if (!fragment.shouldPaintContent)
2364 continue; 2376 continue;
2365 2377
2366 // Begin transparency layers lazily now that we know we have to paint so mething. 2378 // Begin transparency layers lazily now that we know we have to paint so mething.
2367 if (haveTransparency || paintsWithBlendMode()) 2379 if (haveTransparency || paintsWithBlendMode())
2368 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 2380 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
2369 2381
2370 if (localPaintingInfo.clipToDirtyRect) { 2382 if (localPaintingInfo.clipToDirtyRect) {
2371 // Paint our background first, before painting any child layers. 2383 // Paint our background first, before painting any child layers.
2372 // Establish the clip used to paint our background. 2384 // Establish the clip used to paint our background.
2373 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self. 2385 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self.
2374 } 2386 }
2375 2387
2376 // Paint the background. 2388 // Paint the background.
2377 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 2389 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
2378 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2390 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
2379 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 2391 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2380 2392
2381 if (localPaintingInfo.clipToDirtyRect) 2393 if (localPaintingInfo.clipToDirtyRect)
2382 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 2394 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
2383 } 2395 }
2384 } 2396 }
2385 2397
2386 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 2398 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
2387 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 2399 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
2388 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt) 2400 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt)
2389 { 2401 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 const LayerFragment& fragment = layerFragments.at(i); 2441 const LayerFragment& fragment = layerFragments.at(i);
2430 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) 2442 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty())
2431 continue; 2443 continue;
2432 2444
2433 if (shouldClip) 2445 if (shouldClip)
2434 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect); 2446 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect);
2435 2447
2436 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, localPaintingInfo.regio n, 0, 0, localPaintingInfo.rootLayer->renderer()); 2448 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, localPaintingInfo.regio n, 0, 0, localPaintingInfo.rootLayer->renderer());
2437 if (phase == PaintPhaseForeground) 2449 if (phase == PaintPhaseForeground)
2438 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequest s; 2450 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequest s;
2439 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 2451 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2440 2452
2441 if (shouldClip) 2453 if (shouldClip)
2442 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); 2454 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect);
2443 } 2455 }
2444 } 2456 }
2445 2457
2446 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 2458 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
2447 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer) 2459 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer)
2448 { 2460 {
2449 for (size_t i = 0; i < layerFragments.size(); ++i) { 2461 for (size_t i = 0; i < layerFragments.size(); ++i) {
2450 const LayerFragment& fragment = layerFragments.at(i); 2462 const LayerFragment& fragment = layerFragments.at(i);
2451 if (fragment.outlineRect.isEmpty()) 2463 if (fragment.outlineRect.isEmpty())
2452 continue; 2464 continue;
2453 2465
2454 // Paint our own outline 2466 // Paint our own outline
2455 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, localPaint ingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2467 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, localPaint ingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
2456 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius); 2468 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
2457 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 2469 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2458 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect); 2470 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect);
2459 } 2471 }
2460 } 2472 }
2461 2473
2462 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr aphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 2474 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr aphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
2463 RenderObject* paintingRootForRenderer) 2475 RenderObject* paintingRootForRenderer)
2464 { 2476 {
2465 for (size_t i = 0; i < layerFragments.size(); ++i) { 2477 for (size_t i = 0; i < layerFragments.size(); ++i) {
2466 const LayerFragment& fragment = layerFragments.at(i); 2478 const LayerFragment& fragment = layerFragments.at(i);
2467 if (!fragment.shouldPaintContent) 2479 if (!fragment.shouldPaintContent)
2468 continue; 2480 continue;
2469 2481
2470 if (localPaintingInfo.clipToDirtyRect) 2482 if (localPaintingInfo.clipToDirtyRect)
2471 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mas k painting will handle clipping to self. 2483 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mas k painting will handle clipping to self.
2472 2484
2473 // Paint the mask. 2485 // Paint the mask.
2474 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 2486 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
2475 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPai ntingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2487 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPai ntingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
2476 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 2488 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2477 2489
2478 if (localPaintingInfo.clipToDirtyRect) 2490 if (localPaintingInfo.clipToDirtyRect)
2479 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 2491 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
2480 } 2492 }
2481 } 2493 }
2482 2494
2483 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 2495 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
2484 RenderObject* paintingRootForRenderer) 2496 RenderObject* paintingRootForRenderer)
2485 { 2497 {
2486 for (size_t i = 0; i < layerFragments.size(); ++i) { 2498 for (size_t i = 0; i < layerFragments.size(); ++i) {
2487 const LayerFragment& fragment = layerFragments.at(i); 2499 const LayerFragment& fragment = layerFragments.at(i);
2488 if (!fragment.shouldPaintContent) 2500 if (!fragment.shouldPaintContent)
2489 continue; 2501 continue;
2490 2502
2491 if (localPaintingInfo.clipToDirtyRect) 2503 if (localPaintingInfo.clipToDirtyRect)
2492 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl ipping mask painting will handle clipping to self. 2504 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl ipping mask painting will handle clipping to self.
2493 2505
2494 // Paint the the clipped mask. 2506 // Paint the the clipped mask.
2495 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 2507 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
2496 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 2508 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccu mulation, compositingState())));
2497 2509
2498 if (localPaintingInfo.clipToDirtyRect) 2510 if (localPaintingInfo.clipToDirtyRect)
2499 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); 2511 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect);
2500 } 2512 }
2501 } 2513 }
2502 2514
2503 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo) 2515 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo)
2504 { 2516 {
2505 for (size_t i = 0; i < layerFragments.size(); ++i) { 2517 for (size_t i = 0; i < layerFragments.size(); ++i) {
2506 const LayerFragment& fragment = layerFragments.at(i); 2518 const LayerFragment& fragment = layerFragments.at(i);
2507 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.backgroundRect); 2519 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.backgroundRect);
2508 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) 2520 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea())
2509 scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoi nt(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.sub PixelAccumulation)), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); 2521 scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoi nt(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationI fNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))), pixelSnap pedIntRect(fragment.backgroundRect.rect()), true);
2510 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgrou ndRect); 2522 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgrou ndRect);
2511 } 2523 }
2512 } 2524 }
2513 2525
2514 void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsCont ext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 2526 void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsCont ext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2515 { 2527 {
2516 // We need to do multiple passes, breaking up our child layer into strips. 2528 // We need to do multiple passes, breaking up our child layer into strips.
2517 Vector<RenderLayer*> columnLayers; 2529 Vector<RenderLayer*> columnLayers;
2518 RenderLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContainerNode(); 2530 RenderLayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? parent()->stackingNode() : m_stackingNode->ancestorStackingContainerNode();
2519 for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) { 2531 for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent()) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
2960 return false; 2972 return false;
2961 } 2973 }
2962 2974
2963 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, 2975 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
2964 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) 2976 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset)
2965 { 2977 {
2966 LayerFragments enclosingPaginationFragments; 2978 LayerFragments enclosingPaginationFragments;
2967 LayoutPoint offsetOfPaginationLayerFromRoot; 2979 LayoutPoint offsetOfPaginationLayerFromRoot;
2968 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox); 2980 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
2969 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestLocation.region(), hitTestRect, 2981 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestLocation.region(), hitTestRect,
2970 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent); 2982 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
2971 2983
2972 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { 2984 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
2973 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 2985 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
2974 2986
2975 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 2987 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
2976 // the enclosing pagination layer. 2988 // the enclosing pagination layer.
2977 LayoutRect clipRect = fragment.backgroundRect.rect(); 2989 LayoutRect clipRect = fragment.backgroundRect.rect();
2978 2990
2979 // Now compute the clips within a given fragment 2991 // Now compute the clips within a given fragment
2980 if (parent() != enclosingPaginationLayer()) { 2992 if (parent() != enclosingPaginationLayer()) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 if (offsetFromRoot) 3292 if (offsetFromRoot)
3281 offset = *offsetFromRoot; 3293 offset = *offsetFromRoot;
3282 else 3294 else
3283 convertToLayerCoords(clipRectsContext.rootLayer, offset); 3295 convertToLayerCoords(clipRectsContext.rootLayer, offset);
3284 layerBounds = LayoutRect(offset, size()); 3296 layerBounds = LayoutRect(offset, size());
3285 3297
3286 // Update the clip rects that will be passed to child layers. 3298 // Update the clip rects that will be passed to child layers.
3287 if (renderer()->hasOverflowClip()) { 3299 if (renderer()->hasOverflowClip()) {
3288 // This layer establishes a clip of some kind. 3300 // This layer establishes a clip of some kind.
3289 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverfl owClip == RespectOverflowClip) { 3301 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverfl owClip == RespectOverflowClip) {
3290 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(o ffset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy)) ; 3302 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(o ffset + clipRectsContext.subPixelAccumulation, clipRectsContext.region, clipRect sContext.overlayScrollbarSizeRelevancy));
3291 if (renderer()->style()->hasBorderRadius()) 3303 if (renderer()->style()->hasBorderRadius())
3292 foregroundRect.setHasRadius(true); 3304 foregroundRect.setHasRadius(true);
3293 } 3305 }
3294 3306
3295 // If we establish an overflow clip at all, then go ahead and make sure our background 3307 // If we establish an overflow clip at all, then go ahead and make sure our background
3296 // rect is intersected with our layer's bounds including our visual over flow, 3308 // rect is intersected with our layer's bounds including our visual over flow,
3297 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden. 3309 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden.
3298 if (renderBox()->hasVisualOverflow()) { 3310 if (renderBox()->hasVisualOverflow()) {
3299 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though 3311 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though
3300 // we may need to inflate our clip specifically for shadows o r outsets. 3312 // we may need to inflate our clip specifically for shadows o r outsets.
3301 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the 3313 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
3302 // individual region boxes as overflow. 3314 // individual region boxes as overflow.
3303 LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverfl owRect(); 3315 LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverfl owRect();
3304 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // L ayers are in physical coordinates, so the overflow has to be flipped. 3316 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // L ayers are in physical coordinates, so the overflow has to be flipped.
3305 layerBoundsWithVisualOverflow.moveBy(offset); 3317 layerBoundsWithVisualOverflow.moveBy(offset + clipRectsContext.subPi xelAccumulation);
3306 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip) 3318 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip)
3307 backgroundRect.intersect(layerBoundsWithVisualOverflow); 3319 backgroundRect.intersect(layerBoundsWithVisualOverflow);
3308 } else { 3320 } else {
3309 // Shift the bounds to be for our region only. 3321 // Shift the bounds to be for our region only.
3310 LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsCont ext.region); 3322 LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsCont ext.region);
3311 bounds.moveBy(offset); 3323 bounds.moveBy(offset + clipRectsContext.subPixelAccumulation);
3312 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip) 3324 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv erflowClip == RespectOverflowClip)
3313 backgroundRect.intersect(bounds); 3325 backgroundRect.intersect(bounds);
3314 } 3326 }
3315 } 3327 }
3316 3328
3317 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. 3329 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box.
3318 if (renderer()->hasClip()) { 3330 if (renderer()->hasClip()) {
3319 // Clip applies to *us* as well, so go ahead and update the damageRect. 3331 // Clip applies to *us* as well, so go ahead and update the damageRect.
3320 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, clipRe ctsContext.region); 3332 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset + clipR ectsContext.subPixelAccumulation, clipRectsContext.region);
3321 backgroundRect.intersect(newPosClip); 3333 backgroundRect.intersect(newPosClip);
3322 foregroundRect.intersect(newPosClip); 3334 foregroundRect.intersect(newPosClip);
3323 outlineRect.intersect(newPosClip); 3335 outlineRect.intersect(newPosClip);
3324 } 3336 }
3325 } 3337 }
3326 3338
3327 LayoutRect RenderLayer::childrenClipRect() const 3339 LayoutRect RenderLayer::childrenClipRect() const
3328 { 3340 {
3329 // FIXME: border-radius not accounted for. 3341 // FIXME: border-radius not accounted for.
3330 // FIXME: Regions not accounted for. 3342 // FIXME: Regions not accounted for.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 3529
3518 result.moveBy(delta); 3530 result.moveBy(delta);
3519 return result; 3531 return result;
3520 } 3532 }
3521 3533
3522 IntRect RenderLayer::absoluteBoundingBox() const 3534 IntRect RenderLayer::absoluteBoundingBox() const
3523 { 3535 {
3524 return pixelSnappedIntRect(boundingBox(root())); 3536 return pixelSnappedIntRect(boundingBox(root()));
3525 } 3537 }
3526 3538
3527 IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons t LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const 3539 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c onst LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
3528 { 3540 {
3529 if (!isSelfPaintingLayer()) 3541 if (!isSelfPaintingLayer())
3530 return IntRect(); 3542 return LayoutRect();
3531 3543
3532 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580). 3544 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580).
3533 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant()) 3545 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant())
3534 return IntRect(); 3546 return LayoutRect();
3535 3547
3536 RenderLayerModelObject* renderer = this->renderer(); 3548 RenderLayerModelObject* renderer = this->renderer();
3537 3549
3538 if (isRootLayer()) { 3550 if (isRootLayer()) {
3539 // The root layer is always just the size of the document. 3551 // The root layer is always just the size of the document.
3540 return renderer->view()->unscaledDocumentRect(); 3552 return renderer->view()->unscaledDocumentRect();
3541 } 3553 }
3542 3554
3543 LayoutRect boundingBoxRect = localBoundingBox(flags); 3555 LayoutRect boundingBoxRect = localBoundingBox(flags);
3544 3556
(...skipping 20 matching lines...) Expand all
3565 3577
3566 if (flags & UseLocalClipRectIfPossible) { 3578 if (flags & UseLocalClipRectIfPossible) {
3567 LayoutRect localClipRect = this->localClipRect(); 3579 LayoutRect localClipRect = this->localClipRect();
3568 if (localClipRect != PaintInfo::infiniteRect()) { 3580 if (localClipRect != PaintInfo::infiniteRect()) {
3569 if ((flags & IncludeSelfTransform) && shouldIncludeTransform) 3581 if ((flags & IncludeSelfTransform) && shouldIncludeTransform)
3570 localClipRect = transform()->mapRect(localClipRect); 3582 localClipRect = transform()->mapRect(localClipRect);
3571 3583
3572 LayoutPoint ancestorRelOffset; 3584 LayoutPoint ancestorRelOffset;
3573 convertToLayerCoords(ancestorLayer, ancestorRelOffset); 3585 convertToLayerCoords(ancestorLayer, ancestorRelOffset);
3574 localClipRect.moveBy(ancestorRelOffset); 3586 localClipRect.moveBy(ancestorRelOffset);
3575 return pixelSnappedIntRect(localClipRect); 3587 return localClipRect;
3576 } 3588 }
3577 } 3589 }
3578 3590
3579 // FIXME: should probably just pass 'flags' down to descendants. 3591 // FIXME: should probably just pass 'flags' down to descendants.
3580 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); 3592 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants);
3581 3593
3582 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); 3594 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
3583 3595
3584 if (m_reflectionInfo) { 3596 if (m_reflectionInfo) {
3585 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer(); 3597 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer();
3586 if (!reflectionLayer->compositedLayerMapping()) { 3598 if (!reflectionLayer->compositedLayerMapping()) {
3587 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags); 3599 LayoutRect childUnionBounds = reflectionLayer->calculateLayerBounds( this, 0, descendantFlags);
3588 unionBounds.unite(childUnionBounds); 3600 unionBounds.unite(childUnionBounds);
3589 } 3601 }
3590 } 3602 }
3591 3603
3592 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size())); 3604 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size()));
3593 3605
3594 #if !ASSERT_DISABLED 3606 #if !ASSERT_DISABLED
3595 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); 3607 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode());
3596 #endif 3608 #endif
3597 3609
3598 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own 3610 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own
3599 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute. 3611 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute.
3600 // This applies to all z-order lists below. 3612 // This applies to all z-order lists below.
3601 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; 3613 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ;
3602 while (RenderLayerStackingNode* node = iterator.next()) { 3614 while (RenderLayerStackingNode* node = iterator.next()) {
3603 if (flags & IncludeCompositedDescendants || !node->layer()->compositedLa yerMapping()) { 3615 if (flags & IncludeCompositedDescendants || !node->layer()->compositedLa yerMapping()) {
3604 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags); 3616 LayoutRect childUnionBounds = node->layer()->calculateLayerBounds(th is, 0, descendantFlags);
3605 unionBounds.unite(childUnionBounds); 3617 unionBounds.unite(childUnionBounds);
3606 } 3618 }
3607 } 3619 }
3608 3620
3609 // FIXME: We can optimize the size of the composited layers, by not enlargin g 3621 // FIXME: We can optimize the size of the composited layers, by not enlargin g
3610 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. 3622 // filtered areas with the outsets if we know that the filter is going to re nder in hardware.
3611 // https://bugs.webkit.org/show_bug.cgi?id=81239 3623 // https://bugs.webkit.org/show_bug.cgi?id=81239
3612 if (flags & IncludeLayerFilterOutsets) 3624 if (flags & IncludeLayerFilterOutsets)
3613 renderer->style()->filterOutsets().expandRect(unionBounds); 3625 renderer->style()->filterOutsets().expandRect(unionBounds);
3614 3626
3615 if ((flags & IncludeSelfTransform) && shouldIncludeTransform) { 3627 if ((flags & IncludeSelfTransform) && shouldIncludeTransform) {
3616 TransformationMatrix* affineTrans = transform(); 3628 TransformationMatrix* affineTrans = transform();
3617 boundingBoxRect = affineTrans->mapRect(boundingBoxRect); 3629 boundingBoxRect = affineTrans->mapRect(boundingBoxRect);
3618 unionBounds = affineTrans->mapRect(unionBounds); 3630 unionBounds = affineTrans->mapRect(unionBounds);
3619 } 3631 }
3620 3632
3621 LayoutPoint ancestorRelOffset; 3633 LayoutPoint ancestorRelOffset;
3622 if (offsetFromRoot) 3634 if (offsetFromRoot)
3623 ancestorRelOffset = *offsetFromRoot; 3635 ancestorRelOffset = *offsetFromRoot;
3624 else 3636 else
3625 convertToLayerCoords(ancestorLayer, ancestorRelOffset); 3637 convertToLayerCoords(ancestorLayer, ancestorRelOffset);
3626 unionBounds.moveBy(ancestorRelOffset); 3638 unionBounds.moveBy(ancestorRelOffset);
3627 3639
3628 return pixelSnappedIntRect(unionBounds); 3640 return unionBounds;
3629 } 3641 }
3630 3642
3631 CompositingState RenderLayer::compositingState() const 3643 CompositingState RenderLayer::compositingState() const
3632 { 3644 {
3633 // This is computed procedurally so there is no redundant state variable tha t 3645 // This is computed procedurally so there is no redundant state variable tha t
3634 // can get out of sync from the real actual compositing state. 3646 // can get out of sync from the real actual compositing state.
3635 3647
3636 if (!m_compositedLayerMapping) 3648 if (!m_compositedLayerMapping)
3637 return NotComposited; 3649 return NotComposited;
3638 3650
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 } 4169 }
4158 } 4170 }
4159 4171
4160 void showLayerTree(const WebCore::RenderObject* renderer) 4172 void showLayerTree(const WebCore::RenderObject* renderer)
4161 { 4173 {
4162 if (!renderer) 4174 if (!renderer)
4163 return; 4175 return;
4164 showLayerTree(renderer->enclosingLayer()); 4176 showLayerTree(renderer->enclosingLayer());
4165 } 4177 }
4166 #endif 4178 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698